FREEMAIN


Releases main storage that was acquired by using a GETMAIN request. FREEMAIN releases the following storages -

  • Main storage that was acquired by a GETMAIN command issued by the application program.
  • 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 the end of task.

Syntax -


FREEMAIN Syntax

Parameters -


DATA(data-area) -

Specifies the data area of main storage to be released. The length of storage released is the length by the GETMAIN request and not necessarily the length of the data area.

DATAPOINTER(ptr-value) -

Specifies the address of the main storage to be released as a pointer reference. This option specifies the pointer reference that was returned by a GETMAIN command using the SET option. The length of storage released is the length obtained by the GETMAIN request.

Error Conditions -


Below are the list of error conditions may occur in combination. If more than one occurs, only the first is passed to the application program.

Error ConditionRESP2, Description & SolutionSystem Action
16 INVREQ
1 - The storage specified by the DATA or DATAPOINTER parameter is not storage acquired by a GETMAIN command.
Solution -Modify the application program to specify the correct storage in FREEMAIN request.

2 - The storage area specified by the DATA or DATAPOINTER parameter is in key storage and the program issuing the FREEMAIN command is in user-key.
Solution -FREEMAIN command should not be issued on storage area in key. The storage automatically gets released. Modify the program to remove the FREEMAIN command.
Task abnormally terminated