Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Scope of Memory for a Variable During Link

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
Author Message
rathinakarthik

New User


Joined: 25 Jul 2006
Posts: 20

PostPosted: Wed Mar 05, 2008 2:46 am    Post subject: Scope of Memory for a Variable During Link
Reply with quote

Hi,

I am Linking from Program A to Program B.
In Program B i am storing some values in Working storage (B).I am passing the values back to Program A via a common Pointer.
I am dereferencing the pointer and using the values.

Now my clarification is ,whether the memory (Working storage of B) will be made availble to for use after this Pgm B ends or the entire task completes.

Please advise

Thank you.
Back to top
View user's profile Send private message
References
PostPosted: Wed Mar 05, 2008 2:46 am    Post subject: Re: Scope of Memory for a Variable During Link Reply with quote

CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 1002
Location: At my desk

PostPosted: Wed Mar 05, 2008 2:51 am    Post subject:
Reply with quote

As I see it, the return back from a EC LINK will free all storage associated with the linked level, i.e., the pointers 'may' no longer point to valid values.
Back to top
View user's profile Send private message
Bill O'Boyle

Active User


Joined: 14 Jan 2008
Posts: 138
Location: Orlando, FL, USA

PostPosted: Thu Mar 06, 2008 10:06 pm    Post subject: Scope of Memory for a Variable
Reply with quote

In a LINK-API, a new LE "Enclave" (love this term), is created and upon return, is terminated, with all WS returned to the operating system.

So, I would NOT rely upon the ability of the LINKING program to address WS which "had" (past tense) existed in the LINKED-TO program, who has now returned control to the LINKER. You may find that you can get away with this in a TEST environment, but as soon as this is placed into Production, all bets are off and you'll find yourself chasing down some "opportunities". icon_wink.gif

If you really need addressability, then you'll need GETMAIN storage, acquired by either the LINKER or the LINKEE.

Then, this storage address and its data will be preserved until task termination. However, the LINKER must have the ability to obtain this address, so it might be best if the storage were acquired first by the LINKER.

Try to avoid GETMAIN SHARED, because if an abend occurs after obtaining this SHARED storage, this storage becomes orphaned and cannot be addressed until the region is recycled. A high degree of orphaned storage may result in the region terminating with an "S80A" abend.

Another issue regarding SHARED storage is that it must be explicitly FREEMAINed and (unlike non-SHARED GETMAIN storage) will NOT automatically be FREEMAINed upon task termination.

The bottom line is, try not to use GETMAIN SHARED and if you do, understand the pitfalls.

One last thought. Have you looked into EXTERNAL WS data? This might also be a viable option.

HTH....

Regards,

Bill
Back to top
View user's profile Send private message
rathinakarthik

New User


Joined: 25 Jul 2006
Posts: 20

PostPosted: Mon Mar 10, 2008 5:36 pm    Post subject: Reply to: Scope of Memory for a Variable During Link
Reply with quote

Thank you Bill,
I will try the same.
Thank you.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1