alwaysjai
New User
Joined: 29 Nov 2007 Posts: 1 Location: Edison, NJ
|
|
|
|
Hi, I would like to know if we can SORT a flat file only for particular record types within a group.
I have a file which will have Record-types 1, 2 and 3 (in the first byte) for each set. The Types 1 and 3 will be present only once for a group. But, Record-types 2 could be multiple within a group. I would like to SORT only the Record-types 2. Can someone let me know if there is a way to sort this file.
I cannot use the INCLUDE/OMIT condition as it would sort all Record-types 2 together.
Input file:
1A
2Y
2X
3B
1P
2S
2R
3Q
Output file: In Required Format:
1A
2X
2Y
3B
1P
2R
2S
3Q
Thanks in advance.
Jai. |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Jai,
You can use a DFSORT job like the following to do what you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1A
2Y
2X
3B
1P
2S
2R
3Q
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,PD)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'1'),
OVERLAY=(81:SEQNUM,8,PD)),
IFTHEN=(WHEN=NONE,
OVERLAY=(89:SEQNUM,8,PD,
81:81,8,PD,SUB,89,8,PD,TO=PD,LENGTH=8))
SORT FIELDS=(81,8,PD,A,1,1,CH,A,2,1,CH,A)
OUTREC BUILD=(1,80)
/*
|
|
|