LOAD TABLE (COBOL)

The LOAD TABLE statement loads a table (module or program) into the program pool and provides access to it through a COBOL LINKAGE SECTION entry.
idmscu
The LOAD TABLE statement loads a table (module or program) into the program pool and provides access to it through a COBOL LINKAGE SECTION entry.
Syntax
►►─── LOAD TABLE 
program
 ─────────────────────────────────────────────────────►  ►─── INTO 
01-level-program-location
 ─┬─ TO 
end-program-location 
────────┬────►                                       └─ POINTER 
table-location-pointer
 ─┘  ►─┬──────────────────────┬─┬────────────────────────────┬────────────────────►    └─ DICTNODE 
nodename
 ──┘ └─ DICTNAME 
dictionary-name 
─┘  ►─┬────────────────────────┬─────────────────────────────────────────────────►    └─ LOADLIB
 library-name 
─┘  ►─┬─ WAIT ◄ ─┬─ . ───────────────────────────────────────────────────────────►◄    └─ NOWAIT ─┘
Parameters
  • LOAD TABLE
    program
    Specifies the symbolic name of a user-defined field that contains the table, or the name itself enclosed in quotation marks.
  • INTO 
    01-level-program-location
     
    Specifies the LINKAGE SECTION entry of the 01-level record area that references the loaded table. Specify the symbolic name of a user-defined field that contains the name of the 01-level LINKAGE SECTION entry that was used to load the table.
    You cannot specify an OCCURS DEPENDING ON clause within
    01-level-program-location
    .
  • TO 
    end-program-location
    Specifies the end of the LINKAGE SECTION entry of the 01-level record area that references the loaded table. Specify the symbolic name of a user-defined dummy byte field or a field containing a data item that is not associated with the module being loaded. 
    End-program-location
     is subordinate to the 01-level record.
    This parameter is optional under COBOL 85.
  • POINTER 
    table-location-pointer
     
    Specifies a pointer to the table address (COBOL 85 only). Specify the symbolic name of a user-defined field that is to contain the pointer to the table address.
  • DICTNODE 
    nodename
    Specifies the node that controls the dictionary where the table resides. Specify the symbolic name of a user-defined eight-character field in variable storage, or the node name itself enclosed in quotation marks.
  • DICTNAME 
    dictionary-name
    Specifies the dictionary where the table resides. Specify the symbolic name of a user-defined eight-character field in variable storage, or the dictionary name itself enclosed in quotation marks.
  • LOADLIB 
    library-name
    Specifies the load library containing the table. Specify the symbolic name of a user-defined eight-character field in variable storage, or the library name itself enclosed in quotation marks.
  • WAIT
    Requests the issuing task to wait for sufficient storage when program pool storage is not immediately available to meet the requirements of the LOAD TABLE request. This value is the default.
    If you specify WAIT and an insufficient storage condition exists, the issuing task is placed in an inactive state. When the LOAD TABLE function is completed, control returns to the issuing task according to its previously established dispatching priority.
  • NOWAIT
    Requests the issuing task not to wait for storage to become available. If you specify NOWAIT and an insufficient storage condition exists, a value of 3402 (DC-NO-STORAGE) is returned to the ERROR-STATUS field.
Examples
The following source code defines the 01-level LINKAGE SECTION entry for use with the LOAD TABLE request for a table that was built from an Assembler program:
 LINKAGE SECTION.    01 STATE-TABLE.    02 STATES         OCCURS 50 TIMES.      03 STATE-ABB      PIC X(2).      03 STATE-FULL     PIC X(15).    02 END-STATE-TABLE     PIC X.
IDD edit and code tables contain special characters and variable-length fields. In general, these fields are not used in a COBOL program.
The following examples illustrate the use of the LOAD TABLE statement:
  • Example 1
    The following statement loads the STATECON table into the 01-level LINKAGE SECTION entry STATE-TABLE:
    LOAD TABLE 'STATECON'    INTO STATE-TABLE TO END-STATE-TABLE.
  • Example 2
    The following example defines the 01-level LINKAGE SECTION entry for use with the LOAD TABLE request for an IDD CODE TABLE, defined as follows:
    ADD TABLE NAME IS DECODMTH   TABLE DESCRIPTION IS 'MONTH CODE CONVERT'   TYPE IS CODE   SEARCH IS LINEAR   ENCLODE DATA IS ALPHANUMERICPIC 9(4) COMP.   TABLE IS UNSORTED   DUPLICATES ARE NOT ALLOWED   VALUES ARE ( 01 JAN 02 FEB 03 MAR 04 APR          05 MAY 06 JUN 07 JUL 08 AUG          09 SEP 10 OCT 11 NOV 12 DEC ).
    The following source code defines the 01-level LINKAGE SECTION entry for use with the LOAD TABLE request:
     LINKAGE SECTION.    01 MONTH-TABLE.    02 TABLE-HEADER.      03 HDR-NUM-ENTRIES   PIC 9(4) COMP.    02 TABLE-DATA.       OCCURS 12 TIMES.      03 DTA-FILLER1     PIC X(2).      03 DTA-MONTH-NUM    PIC 9(2).      03 DTA-FILLER2     PIC X.      03 DTA-MONTH-TXT    PIC X(3).    02 END-MONTH-TABLE     PIC X.
    The following statement loads the DECODMTH tables into the 01-level LINKAGE SECTION entry MONTH-TABLE:
    PROCEDURE DIVISION USING MONTH-TABLE.    LOAD TABLE 'DECODMTH'    INTO MONTH-TABLE TO END-MONTH-TABLE.
    The following requirements apply to BS2000:
    • Starting with COBOL85 compiler V2.2C and higher, each 01-level entry in the LINKAGE SECTION must be defined in the USING clause of the PROCEDURE DIVISION.
    • The TABLE definition must be the last definition in the LINKAGE SECTION.
Status Codes
After completion of the LOAD TABLE function, the ERROR-STATUS field in the CA IDMS/DC communications block indicates the outcome:
Status code
Meaning
0000
The request has been serviced successfully.
3401
The requested module cannot be loaded immediately due to insufficient storage. To wait would cause a deadlock.
3402
The requested module cannot be loaded because insufficient storage exists in the program pool.
3407
The requested module cannot be loaded because an I/O error has occurred during processing.
3414
The requested module cannot be loaded because it has been defined as nonconcurrent and is in use.
3415
The requested module has been overlaid temporarily in the program pool and cannot be reloaded immediately.
3435
The request cannot be serviced because the specified 01-level LINKAGE SECTION entry has been previously allocated or contains an OCCURS DEPENDING ON clause.
3436
The requested program is not defined in the program definition table (PDT) or is marked out of service, or null PDEs are not specified or valid in this CA IDMS/DC system.