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
 

 

GetMain Problem: cannot do a FREEMAIN after processing

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

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Wed Mar 28, 2007 7:24 am    Post subject: GetMain Problem: cannot do a FREEMAIN after processing
Reply with quote

Hi all.

This is the scenario.

My program is processing a number of input message and for each input msg the output created in GETMAINed and the pointer is returned back to the calling program ..... now for the next message it will do the same processing and again GETMAIN memory and assign the address to a pointer ... now the 2nd time the orginal allocated memory address in the response message pointer is lost and not free, i mean the memory allocated by CICS for first msg is not freed ....as CICS releases the memory only on task termination and i cannot do a FREEMAIN after processing of each msg as i need to pass the memory pointer to the calling program ... as a result the CICS memory will go under stress and all resources are held up.

Can ne1 provide a feasible solution to this problem ...
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: Wed Mar 28, 2007 8:08 am    Post subject:
Reply with quote

Hello,

How about providing space in the calling program and rather than issuing a GETMAIN in the called module, return the message in the area provided by the caller?
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Wed Mar 28, 2007 8:18 am    Post subject:
Reply with quote

No Dick ..... the called module is supposed to process the input msg and then process the o/p msg to a proprietary format and then allocate space for the msg using GETMAIN and have to pass the pointer to the calling program .... the o.p msg can b of huge size which cannot b handled using commarea ... and the calling program cannot do this as it has to call subprograms based on the type of i/p msg received ....
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 743
Location: Germany

PostPosted: Wed Mar 28, 2007 5:43 pm    Post subject:
Reply with quote

Hi !

And how about a separate programm for doing GETMAIN & FREEMAIN.

So main-programm is calling that little prog, which is returning the adress
of the space. Then main-prog is calling your messaging-programm, providing you the pointer, where you could store your message. After receiving back the control, the main-prog cann call the new little prog for freemain-aktion.

If this little prog could be a assembler programm, i could send you the code.

Regards, UmeySan
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Wed Mar 28, 2007 6:34 pm    Post subject: Re: GetMain Problem: cannot do a FREEMAIN after processing
Reply with quote

Hi!
there is something not clear in Your post

Quote:

.....
the output created in GETMAINed and the pointer is returned back to the calling program
......
i need to pass the memory pointer to the calling program ...


Maybe there are hidden gotcha' s but there is no reason, in the calling program, not to to use the returned area address to free it !!

regards
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: Wed Mar 28, 2007 7:19 pm    Post subject:
Reply with quote

Hello,

My original thought was that the "free" be done by the caller when it was finished with the memory (but it did not work which is how we got to this point). If that has not been tried, surely that is a good idea.

Depending on the situation, the data might also be passed via a temporary table that is "keyed" by caller-id (whatever makes sense - terminal-id, uid, etc and a "line#" to allow for the unknown size at the time of the call) - inserts in the called module, reads/deletes back in the calling module. The caller would do a getmain and freemain to have memory for the msg. Depending on how big the data and how often this exchange happens, this may work well or may be more overhead than the system can handle.
Back to top
View user's profile Send private message
TG Murphy

Active User


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

PostPosted: Sat Apr 07, 2007 5:58 am    Post subject:
Reply with quote

Ashimer,

If you can, then do take Dick's advice on this. If you cannot, then here are some smelly suggestions, none of which I would submit to a programming contest...

The program that invokes you - does it use CALL or LINK?

1. If it uses CALL, then your program's working storage will persist from one call to the next. This should allow you to store your GETMAIN pointer in your working storage. When your caller CALLs you the 2nd time, the first thing you should do is FREEMAIN the original GETMAIN. Of course the caller must cooperate here by understanding that it should NOT use that pointer again.

2. If your invoker uses LINK, then tell them to use CALL. Then see step 1. If they cannot/won't use CALL, then arrange to have your LINKer pass you back the pointer on the 2nd link. Then you can issue the FREEMAIN.

3. If all else fails, make arrangements with your callers that although your program was responsible for doing the GETMAIN, their programs are responsible for the FREEMAIN.

What factors prompted you to use GETMAIN in your design? If we know more perhaps we can provide better help. Our CICS expert discourages us from using GETMAIN. Mind you there are very valid reasons for using GETMAIN.

We had a very similar problem as you. One of our programmers was relying on task termination to do the FREEMAINS but ran into SHORT-ON-STORAGE conditions. Luckily, they were able to FREEMAIN the data and all was well.
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Mon Apr 09, 2007 2:50 pm    Post subject:
Reply with quote

hi all ...thanks for ur suggestions .. here the msg being processed from front end is being passed from the first program to the last using pointers as the message is alwys too huge to be passed thru commarea or any other means .... now after processing the request the response message is being passed back to front end in the same way by using pointers .... here in case the request exceeds a max of n msgs cics goes under stress ... we were not able to freemain the previously processed msgs as it was required so as to maintain the history of processing .... newys came up with a temporary solution ..... but still will have to change the entire design itself so as to make it more feasible .... initially was using link now changed that to call and this is taking less amount of storage ... so reduced a lil bit of space by using "call' but yet to change the programs properly for msg processing ....
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Mon Apr 09, 2007 7:05 pm    Post subject: Re: GetMain Problem: cannot do a FREEMAIN after processing
Reply with quote

hi !
Quote:

.... we were not able to freemain the previously processed msgs as it was required so as to maintain the history of processing ...


I am not being picky but I would like You to notice that by telling
"We were not able.." You imply that You tried but You did not succeed
misleading all of us in giving You advice

In this case the right wording would be
"we are not allowed ..." / "we cannot ..."

when You ask for help please, please post all the details in the first post
You made all of us wonder about programming errors pointers getting lost and so on; and NOW You tell us that it is the application which requires You not to free the message buffers !?!

in this case nothing can be done quickly about SOS problems,
the solution would be write each message to TS ( maybe in segments if it is too long to fit in a single TS record) and upon success purge the TS queue
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 SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts Run stats processing on zIIP Engine Virendra Shambharkar DB2 9 Fri Oct 14, 2016 10:24 am
No new posts DB2 Streaming Batch Processing Problem Manshadi DB2 4 Sat Sep 24, 2016 12:14 pm


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