RELEASE


The RELEASE command is used to remove a program, table, or mapset that was previously loaded into main memory with a LOAD command. If the HOLD option was specified in the LOAD command, the loaded resource will not be released automatically at the end of the task and can only be released using a RELEASE command. This command can be issued either by the task that loaded the resource or by any other task.

When a CICS program uses the RELEASE command, it tells CICS that the resource is no longer needed, allowing it to be unloaded from memory when system storage is low or upon request.

Key Features -

  • Marks a loaded program, mapset, or table as eligible for removal from memory.
  • Does not immediately remove the resource, but allows CICS to reclaim memory when needed.
  • Optimizes storage utilization by freeing unused resources.
  • Ensures that large programs or infrequently used modules do not occupy memory unnecessarily.

Syntax -

EXEC CICS RELEASE
     PROGRAM(program-name)
     [RESP(response-field)]
     [RESP2(response-field2)]
     END-EXEC.
  • PROGRAM(program-name) - Specifies the name of the CICS program, table, or mapset to be released from memory.
  • RESP(response-variable) - Optional. It captures the response code of the RELEASE 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 RELEASE operation when the error occured.

Short Examples -


Scenario - Below is an example demonstrating how a CICS COBOL program releases a dynamically loaded program from memory.

...
PROCEDURE DIVISION.

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

    IF WS-RESP = 0 THEN
		...
	END-IF.
	
	...   -> use the loaded program
	
    EXEC CICS RELEASE
         PROGRAM('PROG1')
         RESP(WS-RESP)
         END-EXEC.

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

Error Conditions -


Eror Condition RESP RESP2 Reason
INVREQ 16 5 An invalid attempt is made by the program to release itself.
16 6 The command is issued for a program that is not loaded.
16 7 Either the command is issued for a program that was loaded without the HOLD option by another task or the program has been enabled as a global user exit.
16 17 The program is defined with RELOAD=YES.
16 30 The program manager domain is not yet initialized because a load request was made in a first stage PLT.
PGMIDERR 27 1 A program, table or mapset has no installed resource definition.
27 2 A program, table or mapset is disabled.
27 9 The installed program definition is for a remote program.
NOTAUTH 70 101 A resource security check has failed on PROGRAM(program-name).