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


Example 3: Accessing chained storage areas

 In an OS/VS COBOL CICS program, you would access chained storage areas by defining in the LINKAGE SECTION a storage area that contains a pointer to another storage area. You would then access the next chained area by copying the address of the next area into the associated BLL. It was also necessary to code a paragraph name following any statement that modified the contents of the BLL cell used to address the chained areas. With Enterprise COBOL, this chaining is simplified by using the SET statement to set the address of the chained area.

During conversion, do the following steps:

  1. Change the code that moves the next address from within a storage area to the associated BLL cell. Perform the identical function in Enterprise COBOL by using the ADDRESS OF special register associated with the current and next storage areas.
  2. If you like, remove the dummy paragraph names that follow references that change the contents of BLL cells. (This is good programming practice, but it is not essential.)
           OS/VS COBOL                                    Enterprise COBOL 


WORKING-STORAGE SECTION.                      WORKING-STORAGE SECTION.
01 WSDATA-HOLD PIC X(100).                    01 WSDATA-HOLD PIC X(100).
    .                                               .
    .                                               .
LINKAGE SECTION.                              LINKAGE SECTION.
01 PARAMETER-LIST.                                  .
    .                                               .
    .                                               .
    05  CHAINED-POINTER PIC S9(8) COMP.            .
    .                                               .
    .                                               .
01 CHAINED-STORAGE.                           01 CHAINED-STORAGE.
    05  CHS-NEXT.       PIC S9(8) COMP.           05 CHS-NEXT.    USAGE IS POINTER.
    05  CHS-DATA        PIC X(100).              05 CHS-DATA      PIC X(100)
    .                                               .
    .                                               .
PROCEDURE DIVISION.                         PROCEDURE DIVISION.
    .                                               .
    .                                               .
   MOVE CHS-NEXT. TO CHAINED-POINTER.           SET ADDRESS OF CHAINED-STORAGE TO CHS-NEXT.
ANY-PARAGRAPH-NAME.
    MOVE CHS-DATA TO WSDATA-HOLD.              MOVE CHS-DATA TO WS-DATA-HOLD.
    .                                               .
    .                                               .

Terms of use | Feedback

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