Customizing the Copybook to Retrieve Multiple Records

In the array declaration of field WS-ROW-DATA, this API interface can retrieve a maximum of 100 records at a time.

Various header fields declared under WS-ROW-HEADER allow the API designer to customize how many records to retrieve in a single call. Define the number of records to be retrieved using IN-OFFSET and IN-LIMIT.

01  WS-ROW-AREA.
  03  WS-ROW-HEADER.
*    API Common request - response area
        05  IN-API-KEY                     PIC X(9).
        05  IN-TABLE-NAME                  PIC X(8).
        05  IN-VTS-NAME                    PIC X(8).
        05  IN-OFFSET                      PIC S9(9) COMP.
        05  IN-LIMIT                       PIC S9(9) COMP.
        05  OUT-TOTAL-RECS                 PIC S9(8) COMP.
        05  OUT-RECS-THIS-CALL             PIC S9(8) COMP.
        05  OUT-REC-SIZE                   PIC S9(8) COMP.
        05  OUT-ERROR-CODE                 PIC S9(8) COMP.
        05  OUT-ERROR-SUB-CODE             PIC S9(8) COMP.
        05  OUT-RESPONSE-MESSAGE           PIC X(80).
        05  OUT-FILLER                     PIC X(67).
*     API Specific area
  03  WS-ROW-DATA OCCURS 100 TIMES.

The fields related to actual data in the table’s copybook will need to be indented and listed beneath the WS-ROW-DATA field.