But if there are two occurs Clause one after the other like this:-
05 CO-CNT PIC 9(02).
05 COVERAGE-REC OCCURS 1 TO 15 TIMES
DEPENDING ON CO-CNT.
10 CO-HDR-ID PIC X(06)
10 CO-TYPE PIC X(03)
05 SC-CNT PIC 9(02).
05 CONTRIBUTIONS-REC OCCURS 1 TO 24 TIMES
DEPENDING ON SC-CNT.
10 SC-HDR-ID PIC X(06)
10 SC-TYP-OF-COVERAGE PIC X(03)
So in this will the copybook declared in this fasion hold good.
Because by decalring the copybook in the way you have told will take for the maximum number of occurences.
Say for record 1 there are 2 occurences of COVERAGE-REC and 1 occurence of CONTRIBUTIONS-REC.
To view this output the copybook also should be having only 2 occurences of COVERAGE-REC and one occurence of CONTRIBUTIONS-REC.
Will this be possible by declaring in the way mentioned?
Please let me know if you need any other info.
How you are putting data in the file? Try redefining that strucure with individual occurences. (This will destroy very purpose of depending on byt still..)
I havent 'played' much with depending on but trying it now.
Try Display required array elements one by one.
Maybe it could help.