I have input file of rec lenght 1107.Each group starts with record type 1 and ends with rec type 9(first character) .
I want to extract the first group 1 into a separate file.
Inputfile:
1|clientname1
2|address1
2|address2
9|Account1
9|account2
1|clientname2
2|address1
9|Account 3
2|address1
2|address2
9|Account1
9|account2
1|clientname2
2|address1
9|Account 3
//SYSIN DD *
SORT FIELDS=COPY,
SKIPREC=570
OUTREC IFTHEN=(WHEN=GROUP,END=(1,2,CH,EQ,C'9|'),PUSH(1108:ID=8))
OUTFIL BUILD=(1,1107),INCLUDE=(1108,8,ZD,EQ,1)
SORT FIELDS=COPY,
SKIPREC=570
OUTREC IFTHEN=(WHEN=GROUP,END=(1,2,CH,EQ,C'9|'),PUSH(1108:ID=8))
OUTFIL BUILD=(1,1107),INCLUDE=(1108,8,ZD,EQ,1)
with the above sync sort. I am missing the second instance of 9| record.
Actual output
1|clientname1
2|address1
2|address2
9|Account1
2|address1
2|address2
9|Account1
Expected output
1|clientname1
2|address1
2|address2
9|Account1
9|account2<-This record is missing.
2|address1
2|address2
9|Account1
9|account2<-This record is missing.
Appreciate your help!