First post here.
Hope someone can help with this SORT related issue.
I have a file that has (amongst other fields) columns A through E.
What I'm trying to do is to generate 2 sequence numbers (in cols 98 and 100 binary format) based on combinations of columns A through F, in a new column of the same file.
Currently using this JCL/sort (unsuccessfully).
//SORT01 EXEC PGM=SORT,REGION=4M
//SORTIN DD DSN=*.UNLOAD01.SYSREC00,DISP=SHR
//SORTOUT DD DSN=*.DELETE.CNVPOLS,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(TRK,(150,150),RLSE)
//SYSIN DD *
SORT FIELDS=(1,2,BI,A, A
3,3,CH,A, B
6,4,BI,A, C
10,2,BI,A, D
12,2,BI,A, E
14,4,BI,A) F
OUTREC OVERLAY=(98:SEQNUM,2,BI,RESTART=(1,9),
100:SEQNUM,2,BI,RESTART=(1,11))
/*
//SYSOUT DD SYSOUT=*
//SRTMSG DD SYSOUT=*
//SORTIN DD DSN=*.UNLOAD01.SYSREC00,DISP=SHR
//SORTOUT DD DSN=*.DELETE.CNVPOLS,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(TRK,(150,150),RLSE)
//SYSIN DD *
SORT FIELDS=(1,2,BI,A, A
3,3,CH,A, B
6,4,BI,A, C
10,2,BI,A, D
12,2,BI,A, E
14,4,BI,A) F
OUTREC OVERLAY=(98:SEQNUM,2,BI,RESTART=(1,9),
100:SEQNUM,2,BI,RESTART=(1,11))
/*
//SYSOUT DD SYSOUT=*
//SRTMSG DD SYSOUT=*
The method of generating the numbers is proving the issue.
The first generated number in column 98 should start at 1 and increment for each record where : A, B, C, E and F are the same and D is different.
The second generated number in column 100 should start at 1 and increment for each record where: A, B, C, D and F are the same and E is different.
So here is the input and expected generated output to make it clearer :
A B C D E F GEN_X (98) GEN_Y (100)
---------+---------+---------+---------+---------+---------+---------+------
1 A 38551 1 1 6560 1 1
1 A 38551 1 2 6560 1 2
1 A 51201 2 1 7373 1 1
1 A 51201 3 1 7373 2 1
1 A 59551 1 1 5856 1 1
1 A 59551 1 2 5856 1 2
1 A 62651 1 1 5166 1 0
1 A 62651 2 1 5166 2 0
1 A 63041 1 1 5200 1 0
1 A 63041 1 2 5200 2 0
1 A 63201 2 1 7300 1 0
1 A 78551 1 1 3856 1 0
1 A 78551 1 2 3856 2 0
1 A 78551 1 3 3856 3 0
---------+---------+---------+---------+---------+---------+---------+------
1 A 38551 1 1 6560 1 1
1 A 38551 1 2 6560 1 2
1 A 51201 2 1 7373 1 1
1 A 51201 3 1 7373 2 1
1 A 59551 1 1 5856 1 1
1 A 59551 1 2 5856 1 2
1 A 62651 1 1 5166 1 0
1 A 62651 2 1 5166 2 0
1 A 63041 1 1 5200 1 0
1 A 63041 1 2 5200 2 0
1 A 63201 2 1 7300 1 0
1 A 78551 1 1 3856 1 0
1 A 78551 1 2 3856 2 0
1 A 78551 1 3 3856 3 0
Possibly the sort may need to be done in two stages?
Thanks for any assistance - sorry about the long post!