FREEMAIN64

Release storage that was acquired by using a GETMAIN or GETMAIN64 request. This command is for use only in non-Language Environment (LE) AMODE(64) assembler language application programs.

FREEMAIN64

Read syntax diagramSkip visual syntax diagramFREEMAIN64DATA( data-area64)DATAPOINTER( ptr-value64)

Condition: INVREQ

This command is threadsafe.

Description

FREEMAIN64 releases the following storage:
  • Main storage that was acquired by a GETMAIN or GETMAIN64 command issued by the application.
  • Main storage that was acquired by a LOAD command for a program, map, or table that is defined with RELOAD=YES.
If the task that acquired the storage or loaded the program does not release it, CICS® releases the storage at task end, except for in the following situations:
  • The GETMAIN or GETMAIN64 command is specified the SHARED option. The storage remains allocated until another task issues a FREEMAIN or FREEMAIN64 request to release it.
  • The program is defined with RELOAD=YES. The storage remains allocated until another task issues a FREEMAIN or FREEMAIN64 request to release it.
  • The program is defined with RELOAD=NO but was loaded with the HOLD option. The program remains available until it is released by another task.
Note: In the first two situations listed, using FREEMAIN64 might create inter-transaction affinities that adversely affect the use of dynamic transaction routing. For more information about transaction affinities, see Affinity.

You can release CICS-key storage from a program only if it is being executed in CICS key. If the storage was obtained from CICS-key storage, and the program that issues the FREEMAIN64 request is in user-key, an INVREQ condition occurs with a RESP2 value of 2.

Options

DATA(data-area64)
Specifies the data area of main storage to be released.

In assembler language, data-area64 must be a relocatable expression that is a data reference.

The length of storage released is the length that was obtained by the original request and not necessarily the length of the data area.

DATAPOINTER(ptr-value64)
Specifies the address of the main storage to be released, as a 64-bit pointer reference. This storage can be storage that was acquired by a previous GETMAIN or GETMAIN64 request. For example, a 64-bit pointer reference to an area of 31-bit storage can be specified.

The length of storage released is the length that was obtained by the original request.

Conditions

16 INVREQ
RESP2 values:
1
The storage specified by the DATA or DATAPOINTER parameter is not storage acquired by a GETMAIN or GETMAIN64 command.
2
The storage area specified by the DATA or DATAPOINTER parameter is in CICS-key storage, and the program issuing the FREEMAIN64 command is in user-key.

Examples: Assembler

The following example releases storage by using the DATA option.
WORKAREA   DS   CL100
  .
  .
           EXEC CICS GETMAIN64 SET(9) FLENGTH(1048576)
           USING  WORKAREA,9
           EXEC CICS FREEMAIN64 DATA(WORKAREA)
The following example releases storage by using the DATAPOINTER option.
WORKAREA  DS   CL100
  .
          EXEC CICS GETMAIN SET(9) LENGTH(100)
          USING  WORKAREA,9
  .
  .
          DROP   9
  .
          EXEC CICS FREEMAIN64 DATAPOINTER(9)