ILE COBOL Programmer's Guide

Incrementing Addresses Received from Another Program

The data passed from a calling program might contain header information that you want to ignore (for example, in data received from a CICS/400(R) application that is not migrated to the command level).

Because pointer data items are not numeric, you cannot directly perform arithmetic on them. You can, however, use the SET verb to increment the passed address in order to bypass header information.

You could set up the Linkage Section as follows:

       LINKAGE SECTION.
       01  RECORD-A.
         05  HEADER          PIC X(16).
         05  REAL-SALARY-REC PIC X(30).
                  
·
·
·
01 SALARY-REC. 05 PTR-NEXT-REC POINTER. 05 NAME PIC X(20). 05 DEPT PIC 9(4). 05 SALARY PIC 9(6).

Within the Procedure Division, base the address of SALARY-REC on the address of REAL-SALARY-REC:

       SET ADDRESS OF SALARY-REC TO ADDRESS OF REAL-SALARY-REC

SALARY-REC is now based on the address of RECORD-A + 16.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]