Subject: Assistance Needed with COBOL File Reading Structure

Dear [Recipient's Name],

I hope this message finds you well.

I am currently working on a COBOL program to read a file with the following 
format: length1, content1, length2, content2, and so on. An example of the data 
in the file is as follows:
```
00F00C0000FFF00F
0110140003156011
```

I intended to use the following copybook to read the data:
```cobol
05 LL1             PIC 9(2).
05 TT1             OCCURS 1 TO 2 TIMES
                   DEPENDING ON LL1.
05 LL2             PIC 9(2).
05 TT2             OCCURS 1 TO 2 TIMES
                   DEPENDING ON LL2.
```
However, I encountered an error:
```
IGYGR1137-S "OCCURS DEPENDING ON" object "LL2" was defined in a variably 
located area. Execution results are unpredictable.
```

The suggested structure to avoid this error is as follows:
```cobol
05 LL1             PIC 9(1).
05 LL2             PIC 9(1).
05 TT1             OCCURS 1 TO 2 TIMES
                   DEPENDING ON LL1.
   10  TT11        PIC X(1).
05 TT2             OCCURS 1 TO 3 TIMES
                   DEPENDING ON LL2.
   10  TT21        PIC X(1).
```
Unfortunately, this structure does not match the format of the file I need to 
read. Could you please advise on how to correctly read a file with this 
structure using COBOL?

Thank you for your any assistance !

Best regards,

Jason Cai

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to