raam_kumar
New User
Joined: 25 Apr 2007 Posts: 44 Location: chennai, India
|
|
|
|
Hi
I have below mentioned requirement.
I have a PS file which is of Lrecl = 500. i would like to sort by position's 11-14 with following conditions
1) output file should contain same No. of records
2) if there are any duplicate records with same content in pos 1-9 (there may be 'n' No. of records) and 11-14, except for the first occurences remaining values of positions 11-14 needs to be changed to a constat text
Here is the example
Input:
123456789 XXXX
123456789 XXXX
123456789 XXXX
123456789 ZZZZ
123456789 ZZZZ
Expected Output:
123456789 XXXX
123456789 YYYY
123456789 YYYY
123456789 ZZZZ
123456789 ZZZZ
Note:- only 'XXXX' needs to be changed to 'YYYY', other occurences (like zzzz) need not be changed. can anyone help me achieve this through SYNCSORT / SYNCTOOL |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
If I understand what you want correctly (and I'm not sure I do), you want to Sort by 11-14, and replace 'XXXX' with 'YYYY' for the second and subsequent occurrences of 'XXXX' for records with the same value in 1-9. If so, then here's a DFSORT job that will do that:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/500)
//SORTOUT DD DSN=... output file (FB/500)
//SYSIN DD *
OPTION EQUALS
SORT FIELDS=(11,4,CH,A)
OUTREC IFOUTLEN=500,
IFTHEN=(WHEN=INIT,
OVERLAY=(501:SEQNUM,8,ZD,RESTART=(1,14))),
IFTHEN=(WHEN=(11,4,CH,EQ,C'XXXX',AND,501,8,ZD,GT,+1),
OVERLAY=(11:C'YYYY'))
/*
|
If that's not what you want, then please explain more clearly what you do want with a better example that shows all of the variations. |
|