LOAD


The CICS LOAD statement is used to dynamically load a program, mapset, or table into main memory at runtime. This eliminates the need for pre-linking or pre-loading a module, improving memory efficiency.

When a CICS program uses the LOAD command, the requested resource is fetched from storage (if available) or from a load library. This command is useful when:

  • A program needs to load another module dynamically.
  • A table or file needs to be loaded into memory on demand.
  • A MAPSET needs to be accessed dynamically.

Key Features -

  • Loads programs, maps, tables, and data areas dynamically into working storage.
  • Increases efficiency by loading modules only when required.
  • Uses CICS storage areas to manage memory efficiently.
  • Once loaded, the resource remains in memory until deleted or replaced.

Syntax -

EXEC CICS LOAD
     PROGRAM(program-name)
     [LENGTH(length)]
	 [FLENGTH(length)]
     [SET(ptr-ref)]
	 [ENTRY(ptr-ref)]
	 [HOLD]
     [RESP(response-field)]
     [RESP2(response-field2)]
     END-EXEC.
  • PROGRAM(program-name) - Specifies the name of the CICS program, table, or mapset to load.
  • LENGTH(length) - Optional. It specifies the size of the memory area allocated for the loaded resource. LENGTH is a half-word binary value. The program, table, or map length can be up to 32K. If it exceeds 32K, use the FLENGTH parameter for the LOAD command.
  • FLENGTH(length) - Optional. The FLENGTH option serves the same purpose as the LENGTH option but is intended for larger programs, tables, or maps exceeding 32k in length. FLENGTH is a 4-byte (full-word binary area) field.
  • SET(ptr-ref) - Optional. It specifies the reference address pointer where a program, table, or map is loaded.
  • ENTRY(ptr-ref) - Optional. It is used to specify the address of the entry point for the application program, table, or map that has been loaded. If the ENTRY option is utilized in a multiplatform environment, the LOAD function will return a NULL pointer.
  • HOLD - Optional. It specifies that the loaded program, table, or map should not be released even after the LOAD command has completed. This state will continue until the RELEASE command is issued.
    If the HOLD option is omitted, the program, table, or map will be released automatically when the LOAD command finishes. The HOLD option is beneficial for programs or map sets that are executed repeatedly, as it helps reduce loading time before execution.
  • RESP(response-variable) - Optional. It captures the response code of the LOAD operation and used to check if the command executed successfully or encountered an error.
  • RESP2(response2-variable) - Optional. It captures the response2 code of the LOAD operation when the error occured.

Short Examples -


Scenario - Using CICS LOAD in a COBOL Program

...
PROCEDURE DIVISION.

    EXEC CICS LOAD
         PROGRAM('PROG1')
         INTO(WS-TABLE-AREA)
         RESP(WS-RESP)
         END-EXEC.

    IF WS-RESP = 0 THEN
		...
	END-IF.

Error Conditions -


Eror Condition RESP RESP2 Reason
INVREQ 16 30 The program manager domain is not yet initialized. This is probably because a load request was made in a first stage PLT.
LENGERR 22 19 LENGTH is used and the length of the loaded program is greater than 32 KB.
PGMIDERR 27 1 A program, table or map has no installed resource definition or program auto install was switched off.
27 2 A program is disabled.
27 3 A program was not loaded because the load not found or load new copy not issued.
27 9 The installed program definition is for a remote program.
27 21 The program auto install control program failed.
27 22 The model returned by the program auto install control program was not defined to CICS or was not enabled.
27 23 The program auto install control program returned invalid data.
27 24 Define for the program failed because auto install returned an invalid program name or definition.
NOTAUTH 70 101 A resource security check has failed on PROGRAM(program-name).