I/P File1
ZZZZZZZZZ02272019ZZZZZZ
AAAAAAA
BBBBBBB
CCCCCCC
DDDDDDD
EEEEEEE
ZZZZZZZZZ02272019ZZZZZZ000005
AAAAAAA
BBBBBBB
CCCCCCC
DDDDDDD
EEEEEEE
ZZZZZZZZZ02272019ZZZZZZ000005
I/P File2
ZZZZZZZZZ02272019ZZZZZZ
FFFFFFF
GGGGGGG
ZZZZZZZZZ02272019ZZZZZZ000002
FFFFFFF
GGGGGGG
ZZZZZZZZZ02272019ZZZZZZ000002
Output File
ZZZZZZZZZ02272019ZZZZZZ
AAAAAAA
BBBBBBB
CCCCCCC
DDDDDDD
EEEEEEE
FFFFFFF
GGGGGGG
ZZZZZZZZZ02272019ZZZZZZ000007 ---COPY OF THE HEADER PLUS RECORD COUNT
AAAAAAA
BBBBBBB
CCCCCCC
DDDDDDD
EEEEEEE
FFFFFFF
GGGGGGG
ZZZZZZZZZ02272019ZZZZZZ000007 ---COPY OF THE HEADER PLUS RECORD COUNT
I used the following SORT card and achieved what I want but I physically inserted the footer and then calculated the record count as you see. But I do want to copy the header into footer and then add the record count so that I get the updated date. Appreciate any help.
INREC BUILD=(1,600,SEQNUM,10,ZD)
SORT FIELDS=COPY
OUTFIL REMOVECC,BUILD=(1,600),OMIT=(601,10,ZD,GT,+1,AND,
1,9,CH,EQ,C'ZZZZZZZZZ'),
TRAILER1=(C'ZZZZZZZZZ02272019ZZZZZZ',COUNT-1=(M11,LENGTH=6))
SORT FIELDS=COPY
OUTFIL REMOVECC,BUILD=(1,600),OMIT=(601,10,ZD,GT,+1,AND,
1,9,CH,EQ,C'ZZZZZZZZZ'),
TRAILER1=(C'ZZZZZZZZZ02272019ZZZZZZ',COUNT-1=(M11,LENGTH=6))
Thanks
CODE' D