Hello There,
I have this scenario which is planned to be covered through a Cobol program. Have been trying to workout the same using DFSORT(PARSE, IFTHEN) but without any success till now.
Scenario: There is this variable length file which contains two types of records indicated through a "Indicator Field". The need is to segregate the two types of record in two different files but the challenge is that the fields before "Indicator Field" may or may not occur which makes deriving of "Indicator Field" quite difficult.
Here is how the file structure looks like.
01 MASTER-RECORD.
05 KEY-FIELD PIC X(10).
05 SEGMENT-BYTE PIC X(01).
05 FIELD-01 PIC X(05) OCCURS 0 TO 1 DEPENDING ON SEGMENT-BYTE-BIT01.
05 FIELD-02 PIC X(02) OCCURS 0 TO 1 DEPENDING ON SEGMENT-BYTE-BIT02.
--
--
05 FIELD-08 PIC X(08) OCCURS 0 TO 1 DEPENDING ON SEGMENT-BYTE-BIT08.
05 X-FIELD-LENGTH PIC 9(02).
05 Y-FIELD-LENGTH PIC 9(02).
05 X-FIELD PIC X(01) OCCURS 0 TO 20 DEPENDING ON X-FIELD-LENGTH.
05 Y-FIELD PIC X(01) OCCURS 0 TO 30 DEPENDING ON Y-FIELD-LENGTH.
05 INDICATOR-FIELD PIC X(01). ===========> Possible values are "E" or Space
Many Thanks,
Muhammed H