IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Doubt on GETMAIN, FREEMAIN behaviour


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Arunkumar Chandrasekaran

New User


Joined: 01 Jun 2010
Posts: 63
Location: India

PostPosted: Sun Aug 30, 2015 9:22 pm
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

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Sun Aug 30, 2015 11:22 pm
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Aug 31, 2015 8:30 am
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Aug 31, 2015 12:21 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Doubt about pl/1 (job offer) General Talk & Fun Stuff 5
No new posts doubt when executing a file when logg... TSO/ISPF 2
No new posts DB2 Timestamp field weird behaviour. DB2 8
No new posts GETMAIN / FREEMAIN versus STORAGE OBT... PL/I & Assembler 8
No new posts GETMAIN/FREEMAIN query CICS 9
Search our Forums:

Back to Top