Spitt file based on key field and condition



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

Spitt file based on key field and condition

Postby trilochan_p » Thu Sep 26, 2013 2:24 pm

Hi,

I need sort code to splitt my input file into 2 files based on the key field (1 to 4) and condition filed(5 to 7), If PDF then goes that records into output file 2 else output file 1. Please see below input and output file records detail.

Input File:
1111PDF
1111
1111
2222PAP
2222
3333FAX
3333
3333
4444PDF
4444

Output File 1 (Non PDF Records):
2222PAP
2222
3333FAX
3333
3333

Output File 2 (PDF Records):
1111PDF
1111
1111
4444PDF
4444
trilochan_p
 
Posts: 15
Joined: Tue Dec 06, 2011 2:37 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Spitt file based on key field and condition

Postby BillyBoyo » Thu Sep 26, 2013 3:57 pm

What is the RECFM and LRECL of your file?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Spitt file based on key field and condition

Postby trilochan_p » Fri Sep 27, 2013 5:22 pm

RECFM = FB and LRECL=7
trilochan_p
 
Posts: 15
Joined: Tue Dec 06, 2011 2:37 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Spitt file based on key field and condition

Postby BillyBoyo » Fri Sep 27, 2013 5:59 pm

If you use INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,4)... you can PUSH the value from the first record of a group onto each record of a group (including that first one). If you locate this, temporarily, at position 8:, where you can put the value from 5,3.

You can then use two OUTFILs, one with an INCLUDE= for the PDF value in the extension, and the other OUTFIL having SAVE.

You can use BUILD on OUTFIL to cut the records back down to seven bytes again.
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