Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Compiler and Runtime Migration Guide


Example 4: Using the OCCURS DEPENDING ON clause

In OS/VS COBOL, if the LINKAGE SECTION contained the object of the OCCURS DEPENDING ON clause, when the number of occurrences of the subject of the OCCURS clause changed, you would need to reset the object of the OCCURS DEPENDING ON clause to trigger the update of the group length. With Enterprise COBOL, this resetting is unnecessary because the length of the group is calculated whenever the structure is referenced.

During conversion, in your Enterprise COBOL program, remove any code that resets the contents of the object of the OCCURS DEPENDING ON clause. (These references are no longer necessary.)
           OS/VS COBOL                              Enterprise COBOL 


LINKAGE SECTION.                              LINKAGE SECTION.
  01 PARMLIST.
     05  FILLER          PIC S9(8).
     05  RECORD-POINTER  PIC S9(8).
     .
     .
  01  VAR-RECORD.                        01 VAR-RECORD.
    05  REC-OTHER-DATA   PIC X(30).       05  REC-OTHER-DATA     PIC X(30).
    05  REC-AMT-CNT      PIC 9(4).        05  REC-AMT-CNT        PIC 9(4).
    05  REC-AMT          PIC 9(5)         05  REC-AMT            PIC 9(5)
          OCCURS 1 TO 100 TIMES                 OCCURS 1 TO 100 TIMES
            DEPENDING ON REC-AMT-CNT.                DEPENDING ON REC-AMT-CNT.
     .                                     .
     .                                     .
PROCEDURE DIVISION.                   PROCEDURE DIVISION.
     .                                     .
     .                                     .
     EXEC CICS READ DATASET("INFILE")      EXEC CICS READ DATASET("INFILE")
         RIDFLD(INFILE-KEY)                     RIDFLD(INFILE-KEY)
         SET(RECORD-POINTER)                    SET(ADDRESS OF VAR-RECORD)
         LENGTH(RECORD-LEN)                             LENGTH(RECORD-LEN)
     END-EXEC.                             END-EXEC.
    MOVE REC-AMT-CNT TO REC-AMT-CNT.       .
    MOVE VAR-RECORD TO WS-RECORD-HOLD.    MOVE VAR-RECORD TO WS-RECORD-HOLD.
     .                                     .
     .                                     .

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)