View previous topic :: View next topic
|
Author |
Message |
Arunkumar Chandrasekaran
New User
Joined: 01 Jun 2010 Posts: 63 Location: India
|
|
|
|
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 |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|