I have a VB file records are 500 bytes long.
I have created a 4 step process that works but I would like to know if there is a way to combine the steps into 1 or even 2 steps?
Step 1 sums the two amounts needed for the '30' type records where position 39 is greater than 50. There are other '30' type records where position 39 is less than 50 that I do not want to touch.
//SORTIN DD DSN=file1in
//SORTOUT DD DSN=file1out
//SYSIN DD *
SORT FIELDS=(5,51,CH,A)
INCLUDE COND=(39,2,BI,GT,50,AND,54,2,CH,EQ,C'30')
SUM FIELDS=(105,6,PD,111,6,PD)
Step 2 eliminates all dupes of the '20' records where position 39 is greater than 50. There are other '20' type records where position 39 is less than 50 that I do not want to touch.
//SORTIN DD DSN=file1in
//SORTOUT DD DSN=file2out
//SYSIN DD *
SORT FIELDS=(5,51,CH,A)
INCLUDE COND=(39,2,BI,GT,50,AND,54,2,CH,EQ,C'20')
SUM FIELDS=NONE
Step 3 pulls off all records who did not get selected in either of the above two step position 39 is less than 50
//SORTIN DD DSN=file1in
//SORTOUT DD DSN=file3out
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(39,2,BI,LT,50)
Step 4 combines and sorts the three datasets together
//SORTIN DD DSN=file1out
// DD DSN=file2out
// DD DSN=file3out
//SORTOUT DD DSN=file4out
//SYSIN DD *
SORT FIELDS=(5,32,CH,A,37,2,BI,A,39,2,BI,A,41,3,CH,A,
44,4,BI,A,48,4,BI,A,52,2,BI,A,54,2,CH,A)
RECORD TYPE=V,LENGTH=(500)