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
 

 

how to free the memory allocated thru getmain

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

New User


Joined: 04 Apr 2007
Posts: 3
Location: hyderabad

PostPosted: Fri Apr 27, 2007 5:35 pm    Post subject: how to free the memory allocated thru getmain
Reply with quote

Hi,

I got an expception at the begining of the program: 'OPERATIONAL EXCEPTION'. I checked the spool for that job and found some statements as: STORAGE VIOLATION sth like that.. In my program iam allocating memory of nearly 50k bytes through various getmain() commands..but not using freemain() command at the end of the program.. So tha main memory of the CICS got filled and that is the reason why iam getting this error.Is there any way to free the memory already allocated.Please help me..

Thanks
Chandra
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Fri Apr 27, 2007 5:42 pm    Post subject: Re: how to free the memory allocated thru getmain
Reply with quote

Quote:

.....
that is the reason why iam getting this error.Is there any way to free the memory already allocated.
.....


You are completely wrong :-)
filling up the cics address space of getmained storage without freeing it
will NOT cause any abend, CICS will trigger the SOS ( short on storage ) processing
with unpleasant effects on thruput and performance.

the storage violation is due to the fact that You are putting garbage in the storage accounting areas of the getmained storage, usually in the one at the end of it, probably because of having acquired too little, or for a wrong mapping of the area...

check all the lenght involved ( we cannot do it for You)

regards

e.s
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Apr 27, 2007 5:44 pm    Post subject:
Reply with quote

The storage gets freed at transaction end automatically. Prior to that you can issue freemains to free individual areas of storage.
You had better review your storage handling because it looks like you are stepping on a lot of toes out there, including your own. icon_eek.gif
Back to top
View user's profile Send private message
TG Murphy

Active User


Joined: 23 Mar 2007
Posts: 149
Location: Ottawa Canada

PostPosted: Fri Apr 27, 2007 10:58 pm    Post subject:
Reply with quote

Enrico,

Where I work the SOS condition often results in an abend. Abend code AEXY. This happens when CICS waits to see whether it can satisfy the storage request. If it waits long enough without being able to satisfy the request - AEXY abend occurs.

Perhaps other CICS shops are configured differently and do not experience the same behavior as us.... I'm just telling you what happens here - not saying that you are wrong in any way...

William is absolutely correct. GETMAINed storage that is not explicitly FREEMAINed will be freemained automatically at task termination. You can see this for yourself when you auxtrace a transaction.

Here is something to consider: The LE routine CEEGTST can be used to dynamically acquire storage. It behaves somewhat differently than CICS GETMAIN and if you understand the differences, you can use it to your advantage in some cases.

The big difference is this: Storage acquired by CEEGTST is automatically released when the run unit (or enclave) terminates. For example, LINK establishes a new unit. Thus a task that does a lot of LINKs will consist of a lot of run units. So storage acquired via CEEGTST will probably not hang around for the duration of your task. Typically, it will be freed much earlier.

Consider program A. It has its own working storage. This working storage will persist only as long as the run unit it belongs to is still active. If A is linked to, then its working storage will be freed when A returns to its linker. But if A is called, then its working storage will persist even after A terminates. The moment the run unit terminates, whenever that may happen, is when program A's working storage will be freemained.

Now - if program A happens to obtain storage dynamically via CEEGTST then the lifetime of this CEEGTST storage will be in perfect sync with the lifetime of A's working storage. This behavior is ideal for some situations - one example is data caching...

So... depending on your requirements, it is sometimes better to use GETMAIN - and sometimes better to use CEEGTST. A CICS auxtrace reveals that calls to CEEGTST result in a GETMAIN under the covers. Subsequent calls to CEEGTST may or may not result in GETMAIN.

Another bonus with CEEGTST is that it works in both batch and CICS. So you can use CEEGTST in a copybook that can be used by both batch and CICS programs. And in batch CEEGTST is the only way I know of to do a GETMAIN without calling Assembler.

Yet another bonus with CEEGTST is that you can group many allocations under the same umbrella and then freemain them all in one call - instead of having to freemain them individually.

Add CEEGTST to you toolbox. Check the LE Reference Manual for CEEGTST and other related routines...
Back to top
View user's profile Send private message
gokuldass

New User


Joined: 18 Mar 2005
Posts: 48
Location: india

PostPosted: Tue Oct 09, 2007 7:43 pm    Post subject:
Reply with quote

"You can see this for yourself when you auxtrace a transaction".

How to do this?

Regards,
Gokul
Back to top
View user's profile Send private message
TG Murphy

Active User


Joined: 23 Mar 2007
Posts: 149
Location: Ottawa Canada

PostPosted: Tue Oct 09, 2007 10:24 pm    Post subject:
Reply with quote

Transaction CETR can be used to activate an auxtrace. You may not have security rights to execute CETR. If not, you may need to ask your CICS programmer to do it.
Back to top
View user's profile Send private message
Earl

Active User


Joined: 17 Jun 2007
Posts: 148
Location: oklahoma

PostPosted: Wed Oct 10, 2007 2:57 am    Post subject:
Reply with quote

storage violation, you are walking on storage your task doesn't own.

if cobol, normally you are moving data past the end of storage acquired
for a table.

to get rid of getmain storage prior to task end, try freemain (but make
sure you don't try to use the area you just freed).

run your transaction through a simple CEDF session, you should be able
to isolate what section of code you are blowing up in.
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 Release quantity that was allocated v... Auryn JCL & VSAM 5 Thu May 18, 2017 6:02 pm
No new posts To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am
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 Not enough virtual memory is availabl... Vinay Pushpala IBM Tools 16 Tue Sep 13, 2016 4:37 pm


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