In the trailer there are separate fields for maintaining the different types of record counts. If there are 26 '02' type records, the trailer for maintenance record count should be 26 and so on for 04 types
I used the below sort card, but its not getting updated. It is simply copying the counts which are present in the input file.
//STEP04 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=TEST.ABC.CLASS.COMB.FILE,DISP=SHR
//SORTOUT DD DSN=TEST.ABC.CLASS.COMB.UPD1,DISP=...
//SYSIN DD *
SORT FIELDS=COPY
SUM FIELDS=NONE
OUTREC IFOUTLEN=189,
IFTHEN=(WHEN=(9,2,PD,EQ,2),OVERLAY=(190:SEQNUM,4,ZD,START=1)),
IFTHEN=(WHEN=(5,3,PD,EQ,99999),OVERLAY=(35:190,4))
IFTHEN=(WHEN=(9,2,PD,EQ,4),OVERLAY=(195:SEQNUM,4,PD,START=1)),
IFTHEN=(WHEN=(5,3,PD,EQ,99999),OVERLAY=(39:195,4))
/*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=TEST.ABC.CLASS.COMB.FILE,DISP=SHR
//SORTOUT DD DSN=TEST.ABC.CLASS.COMB.UPD1,DISP=...
//SYSIN DD *
SORT FIELDS=COPY
SUM FIELDS=NONE
OUTREC IFOUTLEN=189,
IFTHEN=(WHEN=(9,2,PD,EQ,2),OVERLAY=(190:SEQNUM,4,ZD,START=1)),
IFTHEN=(WHEN=(5,3,PD,EQ,99999),OVERLAY=(35:190,4))
IFTHEN=(WHEN=(9,2,PD,EQ,4),OVERLAY=(195:SEQNUM,4,PD,START=1)),
IFTHEN=(WHEN=(5,3,PD,EQ,99999),OVERLAY=(39:195,4))
/*
The input and output files are VB, 189 length.
Input file content: (first few columns)
0 2 0 0 ................
3202 2 531 2 ............
3202 2 531 4
8202 2 3530 2
8202 2 10138 2
8202 2 10138 4
8202 2 10138 4
8202 2 11231 2
8202 2 11231 4
8202 2 11231 4
8202 2 12238 2
8202 2 12238 4 ........
99999 2 9999999 999 ......+3 +3
('02' cnts) (04 cnts)
Manju