bit to 8 different char

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Vikas.betu
Member
Posts: 29
Joined: Tue Feb 18, 2014 9:13 pm

bit to 8 different char

Post by Vikas.betu » Tue Feb 18, 2014 9:19 pm

I have with flag information embeeded in a charactor. Each bit of a charactor indicates a statos of a specific flag. Means a byte has information about 8 different flags. I wanted to expand this bit information to a seperate charactor, as each character indicates a status of a flag (1/0) in a JCL. Can someone suggest me the solution?

I found 1 jcl for my requirment, but I am not getting what exactly going on in this
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/10)
//SORTOUT DD DSN=... output file (FB/10)
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=10,
IFTHEN=(WHEN=INIT,BUILD=(8C'0',9:9,2,11:1,1)),
IFTHEN=(WHEN=(11,1,BI,BO,X'80'),OVERLAY=(1:C'1'),HIT=NEXT),
IFTHEN=(WHEN=(11,1,BI,BO,X'40'),OVERLAY=(2:C'1'),HIT=NEXT),
IFTHEN=(WHEN=(11,1,BI,BO,X'20'),OVERLAY=(3:C'1'),HIT=NEXT),
IFTHEN=(WHEN=(11,1,BI,BO,X'10'),OVERLAY=(4:C'1'),HIT=NEXT),
IFTHEN=(WHEN=(11,1,BI,BO,X'08'),OVERLAY=(5:C'1'),HIT=NEXT),
IFTHEN=(WHEN=(11,1,BI,BO,X'04'),OVERLAY=(6:C'1'),HIT=NEXT),
IFTHEN=(WHEN=(11,1,BI,BO,X'02'),OVERLAY=(7:C'1'),HIT=NEXT),
IFTHEN=(WHEN=(11,1,BI,BO,X'01'),OVERLAY=(8:C'1'))

Can someone explain this ?

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Wed Feb 19, 2014 12:48 am

What this does is turns on all of the bits for that byte where each bit is "on".

Pick a 1-byte value - say the letter A.

Which 1s and 0s make up the letter A?
Well, first what is the hex representation for the letter A? x'C1'.

How is x'C1" shown in binary? b'1100 0001'.Which is what that code shuld produce - creating 8 bytes for the one.
Have a good one

Vikas.betu
Member
Posts: 29
Joined: Tue Feb 18, 2014 9:13 pm

Post by Vikas.betu » Wed Feb 19, 2014 1:48 am

Thanks for response. But I am new for DFSORT, I got this sort card from mainframe forum itselt. But not able to understand this

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Wed Feb 19, 2014 1:54 am

If you use the code you have and the explanation from the manual (and my brief explanation), you will be able to get the understanding.

It wiould be better to become comfortable with the sort before just copying things from the internet that you do not understand.

fwiw.
Have a good one

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Wed Feb 19, 2014 1:59 am

He he! Maybe you cn move this one? And delete the spurious posts afterwards?
Regards
Nic

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Wed Feb 19, 2014 2:08 am

Yup, 'tis moved and pruned 8)

dd

Vikas.betu
Member
Posts: 29
Joined: Tue Feb 18, 2014 9:13 pm

Post by Vikas.betu » Wed Feb 19, 2014 3:07 am

I got this sort partial, however the main problem I m facing below line
IFTHEN=(WHEN=INIT,BUILD=(8C'0',9:9,2,11:1,1)),

I don't want to waste your time, but I am trying to learn. If possbile then revert

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Wed Feb 19, 2014 3:38 am

You're not wasting my time - i just don't have as much as i'd prefer :)

The doc has a rather clear description of WHEN=INIT (first time). The BUILD generates 8 character zeros to be replaced with ones dependking on the character value (refer to the example i posted earlier).
Have a good one

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Re: bit to 8 different char

Post by William Collins » Wed Feb 19, 2014 4:17 am

Vikas.betu wrote:I have with flag information embeeded in a charactor. Each bit of a charactor indicates a statos of a specific flag. Means a byte has information about 8 different flags. I wanted to expand this bit information to a seperate charactor, as each character indicates a status of a flag (1/0) in a JCL. Can someone suggest me the solution?

I found 1 jcl for my requirment, but I am not getting what exactly going on in this

Code: Select all

//S1    EXEC  PGM=SORT                                              
//SYSOUT    DD  SYSOUT=*                                            
//SORTIN DD DSN=...  input file (FB/10) 
//SORTOUT DD DSN=...  output file (FB/10)                            
//SYSIN    DD    *                                                  
  OPTION COPY                                                        
  INREC IFOUTLEN=10,                                                
    IFTHEN=(WHEN=INIT,BUILD=(8C'0',9:9,2,11:1,1)),                  
    IFTHEN=(WHEN=(11,1,BI,BO,X'80'),OVERLAY=(1:C'1'),HIT=NEXT),      
    IFTHEN=(WHEN=(11,1,BI,BO,X'40'),OVERLAY=(2:C'1'),HIT=NEXT),      
    IFTHEN=(WHEN=(11,1,BI,BO,X'20'),OVERLAY=(3:C'1'),HIT=NEXT),      
    IFTHEN=(WHEN=(11,1,BI,BO,X'10'),OVERLAY=(4:C'1'),HIT=NEXT),      
    IFTHEN=(WHEN=(11,1,BI,BO,X'08'),OVERLAY=(5:C'1'),HIT=NEXT),      
    IFTHEN=(WHEN=(11,1,BI,BO,X'04'),OVERLAY=(6:C'1'),HIT=NEXT),      
    IFTHEN=(WHEN=(11,1,BI,BO,X'02'),OVERLAY=(7:C'1'),HIT=NEXT),      
    IFTHEN=(WHEN=(11,1,BI,BO,X'01'),OVERLAY=(8:C'1'))  


Can someone explain this ?
Where did you find that code?

If your DFSORT is fairly up-to-date:

Code: Select all

  OPTION COPY 
  INREC BUILD=(1,1,TRAN=BIT,9,2)

Vikas.betu
Member
Posts: 29
Joined: Tue Feb 18, 2014 9:13 pm

Post by Vikas.betu » Wed Feb 19, 2014 8:28 pm

I got this code from this forum only, I have tried your code but it is giving me syntax error :(

Vikas.betu
Member
Posts: 29
Joined: Tue Feb 18, 2014 9:13 pm

Post by Vikas.betu » Wed Feb 19, 2014 10:08 pm

I have a single char field, having values '.' or blanks(its a coded value through assembler prog). Now I need to decode these values to 8 bit field whose outputs looks like '1100 0001'(it's just a example). Can you guys provide me any jcl sort to resolve this. I am asking this directly as I am not able to make any change in above mentioned jcl coz it's bit different jcl what I understand from this.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Thu Feb 20, 2014 1:57 am

Copy the above and make the changes . . .

Why have you not posted the error(s)?

Keep in mind that most of the work getting help is yours. We can only help with what you show us.
Have a good one

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Thu Feb 20, 2014 12:34 pm

Did you note the "if your DFSORT is fairly up-to-date"?

Paste the full sysout from your step. We will need another way to do it, probably, as it sounds like your system does not support TRAN=

Vikas.betu
Member
Posts: 29
Joined: Tue Feb 18, 2014 9:13 pm

Post by Vikas.betu » Thu Feb 20, 2014 7:54 pm

Please find the sysout msg when I ran below job
----------------------------------------------------------------
//EMPACT1 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SORTIN DD DSN=INPUT,DISP=SHR
//SORTOUT DD DSN=OUTPUT,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(15,15),RLSE),
// DCB=(RECFM=FB,LRECL=0,BLKSIZE=0)
//SYSUDUMP DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,1,TRAN=BIT,9,2)
-------------------------------------------------------------------
********SYSOUT*********
609 LICEN
SYSIN :
OPTION COPY
INREC BUILD=(1,1,TRAN=BIT,9,2)
*
WER268A INREC STATEMENT : SYNTAX ERROR
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
******************************* Bottom of Data ********************************

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Thu Feb 20, 2014 10:21 pm

Hopefully, you have noticed that your system is using Syncsort rather than DFSORT.

The tran=bit is not yet available in Syncsort as far as i know.

You need to determine how to make the IFTHEN / OVERLAY work.
Have a good one

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others