Wednesday, December 7, 2011

CICS : Why GETMAIN ?

"Basically GETMAIN is taking memory from main storage and the memory can be released usint FREEMAIN. In this case, under what circumstances GETMAIN is used ? What will be the advantage of using GETMAIN ?"

GETMAIN is used to give a linkage section field addressibility. (There are two other ways you can gain access to a linkage section field - In a called program if a parameter is passed, or using SET ADDRESS OF)

You can AVOID using GETMAIN, by defining the structure/fields in working storage. But for huge programs it is a big waste of SPACE, since CICS has to make these fields available during the entire execution of the program. To avoid this, it is better to define fields in linkage section, and use GETMAIN for them when you need the fields, and once done, use a FREEMAIN, so that you don't unnecessarily lock valuable SPACE.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.