What is GETMAIN and FREEMAIN? What are the restrictions while using GETMAIN and FREEMAIN?

The concept of CICS GETMAIN is simply to provide the programmer the capacity of obtaining additional storage to augment storage acquired automatically by his program (e.g. WORKING-STORAGE in a COBOL program). The programmer may define certain fields (01 Levels) in the LINKAGE SECTION that may require the use of a GETMAIN to obtain the storage. These fields are usually output fields that are not passed to the program by another program (caller).

In the case of input fields the use of the SET can be used to point to the acquired area or a calling program can pass the address to the called program. The acquired area from a GETMAIN can be above or below the line. In addition storage acquired by a normal GETMAIN can be explicitly released by a FREEMAIN or automatically released when the task ends by CICS. However a program can acquire SHARED storage that comes out of the SDSA/ESDSA that requires an explict FREEMAIN as this type of storage is not automatically released at task end. The use of shared storage requires more control as incorrect use can quickly deplete the (E) DSA storage available.

2 comments:

  1. Excellent post and well explained about GETMAN

    ReplyDelete
  2. getmain and freemain are terms that relate to memory allocation and deallocation in computer programming. Pantun Perantu These functions are commonly used in mainframe environments, especially in languages like COBOL.

    ReplyDelete

Please Provide your feedback here