How to extract records from binary field



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

How to extract records from binary field

Postby Jayakumar CR » Mon Jan 16, 2012 12:11 pm

Hi,

I have an input file of 80 bytes length. Position 9 contains a binary field of 4 digits.
I want to extract records from this binary field (ie 9,4,BI), and write the outputs to 5 different files.

Condition is that, all the records ending with 1 from this binary field should go to file 1, all the records ending with 2 should go to file 2 and so on...
For eg:, if the binary field contains a value 12345, that record should go to FILE 5 (as the last digit of "12345" is 5)

Can you help me write a sort card for this

Thanks,
Jay
Jayakumar CR
 
Posts: 1
Joined: Mon Jan 16, 2012 12:02 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to extract records from binary field

Postby BillyBoyo » Mon Jan 16, 2012 1:17 pm

I've assumed FB for your input. The overlay "edits" the binary field, but only gives it a length of 1, appended to the record. This is then tested, and dropped as the output goes to files 1-5. Note: anything ending in 6, 7, 8, 9 or 0 will just disappear. You might not want that...

//SPLIT5 EXEC PGM=SORT
//SYSIN DD *
                                                 
 INREC OVERLAY=(81:9,4,BI,M11,LENGTH=1)
 OPTION COPY
 OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'1'),
           BUILD=(1,80)
 OUTFIL FNAMES=OUT2,INCLUDE=(81,1,CH,EQ,C'2'),
           BUILD=(1,80)
 OUTFIL FNAMES=OUT3,INCLUDE=(81,1,CH,EQ,C'3'),
           BUILD=(1,80)
 OUTFIL FNAMES=OUT4,INCLUDE=(81,1,CH,EQ,C'4'),
           BUILD=(1,80)
 OUTFIL FNAMES=OUT5,INCLUDE=(81,1,CH,EQ,C'5'),
           BUILD=(1,80)
                                                 
//SYSOUT DD SYSOUT=*
//OUT1 DD DSN=your output 1
//OUT2 DD DSN=your output 2
//OUT3 DD DSN=your output 3
//OUT4 DD DSN=your output 4
//OUT5 DD DSN=your output 5
//SORTIN DD DSN=your input
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post