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

Local-Storage Section in IBM COBOL


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Paulo Roberto Schiavon

New User


Joined: 23 Feb 2007
Posts: 3
Location: S?o Paulo - Brazil

PostPosted: Fri Mar 30, 2007 11:07 pm
Reply with quote

Hi,

When I was studying IBM's manuals I saw Local-Storage Section but I didn't understand it.

Somebody could explain this.

And why should I use the Parameter Global in declaration variable?!

Thanks!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Mar 31, 2007 12:31 am
Reply with quote

Hello,

Unless/until you start building multi-thread code you won't need to use local-storage. Following is a bit from IBM:
Quote:
Choosing LOCAL-STORAGE or WORKING-STORAGE: Because you must code your multithreaded programs as recursive, the persistence of data is that of any recursive program:

Data items in the LOCAL-STORAGE SECTION are automatically allocated for each instance of a program invocation. When a program runs in multiple threads simultaneously, each invocation has a separate copy of LOCAL-STORAGE data.
Data items in the WORKING-STORAGE SECTION are allocated once for each program and are thus available in their last-used state to all invocations of the program.
Back to top
View user's profile Send private message
TG Murphy

Active User


Joined: 23 Mar 2007
Posts: 148
Location: Ottawa Canada

PostPosted: Mon Apr 02, 2007 6:28 pm
Reply with quote

If your program is recursive, then you need LOCAL STORAGE. Recursive programs are not only required for multi-threading. We have 2 programs that need to be RECURSIVE and they both use LOCAL STORAGE.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Apr 02, 2007 8:13 pm
Reply with quote

Thanks for the clarification icon_smile.gif
Back to top
View user's profile Send private message
TG Murphy

Active User


Joined: 23 Mar 2007
Posts: 148
Location: Ottawa Canada

PostPosted: Sat Apr 07, 2007 5:17 am
Reply with quote

One more thing about LOCAL-STORAGE that I just discovered this week.

WORKING-STORAGE gets allocated from the HEAP, whereas LOCAL-STORAGE gets allocated from the STACK.

In our batch environment the STACK is configured to obtain its memory from below the line. HEAP draws from above the line.

(In CICS, both the HEAP and STACK get allocated from above the line. No problem there...)

We have a batch job that is abending because it is running out of memory below the line. We have been chasing this problem for 2 weeks - pulling our hair out.

It turns out that the 2 RECURSIVE program I mentioned early, both of which use LOCAL-STORAGE are major contributors to this problem. We also discovered that many programs had been mistakenly compiled using the DATA(24) option instead of DATA(31). We think the problem is under control now... fingers crossed. This job calls hundreds of different programs - it is a biggie...

We have sent out an advisory to our programmers to use LOCAL storage with care. I don't suggest for a moment that you should avoid using LOCAL storage - just be careful - if your LOCAL storage size is reasonable you won't run into any problems. In our case, one of our RECURSIVE programs has a LOCAL storage that is greater than 500K.

Where you work it could be that your default STACK settings are not the same as mine. So this may not be a concern for 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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top