Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Why GETMAIN Command

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
View previous topic :: :: View next topic  
Author Message
bantu2405

New User


Joined: 03 Nov 2009
Posts: 2
Location: Pune

PostPosted: Tue Nov 24, 2009 4:13 pm    Post subject: Why GETMAIN Command
Reply with quote

Hi, Could you please tell me is it necessary to use GETMAIN in all the CICS programs, as it is used to allocate memory, but there are many CICS program in my system which hardly uses GETMAIN? I want to know exactly when should one use the GETMAIN?

Thanks a lot for you help
Back to top
View user's profile Send private message

PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2431
Location: Netherlands, Amstelveen

PostPosted: Tue Nov 24, 2009 4:29 pm    Post subject:
Reply with quote

Everybody has his own reason to obtain storage by GETMAIN. I always
use it for getting working storage and make it addressable by DSECT's.

For instance loading a PDS directory in storage, and then processing it
to read all members.
Or to generate vsam control blocks, dcb's, system control blocks defined
only in DSECT format.

In short there are numerous reasons to use it.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Nov 24, 2009 9:22 pm    Post subject:
Reply with quote

Hello,

Quote:
I want to know exactly when should one use the GETMAIN?
Sounds like a solution in search of a requirement. . .

Suggest you look at other code on the system that uses GETMAIN and see why/when this is typically used in your environment.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2431
Location: Netherlands, Amstelveen

PostPosted: Tue Nov 24, 2009 10:00 pm    Post subject:
Reply with quote

I forgot to mention that GETMAIN is also very often used in refreshable or re-enterable or reusable programs.
Back to top
View user's profile Send private message
Debabrata Pruseth

New User


Joined: 11 Dec 2008
Posts: 59
Location: Pune , India

PostPosted: Wed Nov 25, 2009 2:20 am    Post subject: Why GETMAIN Command
Reply with quote

Hi Bantu

The most practical scenario where you come to know the importance of using GETMAIN is when you don't use it properly and the working storage variables point to wrong memory address and pick up junk values . In this case your code will abend with ASRA and the whole lot of it and you will be scratching your head from where these junk values are coming from .

So start using GETMAIN wherever it is required , it is a good practice.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Nov 25, 2009 3:20 am    Post subject:
Reply with quote

Since this is the CICS forum, I will stay within the scope of CICS. And as such, will not get into a lot of detail; I am not going to elaborate on the background issues/whys/wherefores - that is available on the net and in manuals.

1. A GETMAIN is a request from the ops-system for additional storage for a task. After the issuance of a FREEMAIN, the storage is nolonger assigned to the TASK. Thus, a reduction of resources for a task - very important in CICS environment.

2. Often you don't know how much extra storage you need for an internal cobol table, or simply passing data to another module within the task. If the GETMAINing module was compiled with the maximum amount of potential storage requirements within Working-Storage, then the module would be larger than necessary.
(some situations would require x amount of storage, some y)
Acquiring the necessary amount of storage at runtime (via GETMAIN) means that the load module is smaller, thus requiring less CICS resources to load. We are talking about CICS - which is online/on demand - thus reducing the likelihood of the module not being loaded (thus task not executing) or preventing another task from be initiated due to lack of available storage -
(READ: because some idiot wrote a 4 meg module that runs 1000 times a day and hogs all the resources.)

3. Because many coders are too lazy to learn anything new (GETMAIN) and due to the fact that most programmers are only concerned with their own program - and not the impact on the system as a whole (using more storage than necessary) - they don't understand that the assignment of storage via the GETMAIN command - and the freeing of it with the FREEMAIN command - don't really take that much extra time. When properly used
(READ: have a formula in the module to determine how much memory to request during runtime- sometime repeated requests are necessary)
the impact of the module on the system as a whole does not stand-out; where as a memory hog does - everytime.

hopefully Bill Boyle will chime in with his expertise.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Nov 25, 2009 3:34 am    Post subject:
Reply with quote

Quote:
hopefully Bill Boyle will chime in with his expertise.

or correct any of my incorrect statements.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Nov 25, 2009 4:08 am    Post subject:
Reply with quote

That's Bill O'Boyle

My apologies Bill.

my 8000 year old brain suffers from long term usage.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Customizing the ISPF HILITE Command Pedro TSO/ISPF 3 Fri Mar 03, 2017 11:49 pm
No new posts GETMAIN / FREEMAIN versus STORAGE OBT... steve-myers PL/I & Assembler 8 Wed Feb 01, 2017 1:45 am
No new posts GETMAIN/FREEMAIN query Suja.Sai CICS 9 Tue Jan 31, 2017 12:01 pm
No new posts Fail to change physical VSAM filename... jacobdng CICS 7 Fri Jan 20, 2017 12:36 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us