Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
Unless/until you start building multi-thread code you won't need to use local-storage. Following is a bit from IBM:
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.
Joined: 23 Mar 2007 Posts: 149 Location: Ottawa Canada
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.