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
 

 

Doubt on GETMAIN, FREEMAIN behaviour

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

New User


Joined: 01 Jun 2010
Posts: 61
Location: India

PostPosted: Sun Aug 30, 2015 9:22 pm    Post subject: Doubt on GETMAIN, FREEMAIN behaviour
Reply with quote

Hi,

Please find what my program is doing below.
Code:

1) Sign-on MQ
2) Register to particular service ID in MQ

PERFORM until MQ-EMPTY

3) GETMAIN to a pointer A
4) SET ADDRESS OF VAR-A to pointer A
4) Receive XML Message from Que (GETQ) to VAR-A
5) STORE the XML into DB2
6)FREEMAIN

END-PERFORM


Here is my doubt. When I am testing the code thru Expediter,
before first receive VAR-A is having NULL and I am initializing to SPACES.
After receive MQ message is present in VAR-A.After FREEMAIN Expediter shows the same content but I cant access the variable.It seems fine to me.
but after the next GETMAIN same message is present in VAR-A.

is this normal behavior when GETMAIN the same memory after FREEMAIN.Also system allocates same memory every time the tranaction ask memory using GETMAIN?

Please let me know for more details.

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

prino

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Sun Aug 30, 2015 11:22 pm    Post subject:
Reply with quote

Why the flipping 'ell aren't you doing your items

3)
4)
6)

outside of the loop?????

GETMAIN and FREEMAIN are pretty expensive operations!
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7912
Location: Bellevue, IA

PostPosted: Mon Aug 31, 2015 8:30 am    Post subject:
Reply with quote

Quote:
is this normal behavior when GETMAIN the same memory after FREEMAIN.Also system allocates same memory every time the tranaction ask memory using GETMAIN?
GETMAIN can return the same storage after a FREEMAIN -- CICS has a pool of storage and a test region likely won't have enough other transactions requiring memory to cause a different starting address to be used. So yes, the same memory can be returned. Whether or not it has the old data will depend upon the CICS options in use at your site -- CICS can be set to initialize memory to some value (such as LOW-VALUES) but this is a site option.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Mon Aug 31, 2015 12:21 pm    Post subject: Reply to: Doubt on GETMAIN, FREEMAIN behaviour
Reply with quote

I was thinking "do 4 outside the loop, what does he mean?". Then I noticed there are two fours. I agree now :-)

You should be unconcerned with what is in the "VAR-A" (I do hope that's not its real stupid name) before you replace it with a message. So don't initialise to spaces, or anything else. Just a further waste of time.

Your GETMAIN request is served from available storage. If you subsequently FREEMAIN, it is returned to available storage. Another GETMAIN may, or may not, get the storage at the same address.
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 Doubt in MFS abdulrafi IMS DB/DC 2 Fri Oct 21, 2016 3:09 pm
No new posts Problem with GETMAIN command amitc23 CICS 6 Thu Sep 01, 2016 1:01 pm
No new posts $AJ behaviour when $PXEQ is in effect. vasanthz JCL & VSAM 2 Thu Feb 18, 2016 3:51 am
No new posts issues with memory in programs with c... sivakumar.karthik CICS 4 Thu Aug 13, 2015 8:56 pm
No new posts Doubt in using command code O Appu IMS DB/DC 4 Tue Jan 13, 2015 3:14 pm


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