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

Scope of Memory for a Variable During Link


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

New User


Joined: 25 Jul 2006
Posts: 24

PostPosted: Wed Mar 05, 2008 2:46 am
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
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Mar 05, 2008 2:51 am
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

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Mar 06, 2008 10:06 pm
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: 24

PostPosted: Mon Mar 10, 2008 5:36 pm
Reply with quote

Thank you Bill,
I will try the same.
Thank you.
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SCOPE PENDING option -check data DB2 2
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
Search our Forums:

Back to Top