View previous topic :: View next topic
|
Author |
Message |
Paulo Roberto Schiavon
New User
Joined: 23 Feb 2007 Posts: 3 Location: S?o Paulo - Brazil
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
TG Murphy
Active User
Joined: 23 Mar 2007 Posts: 148 Location: Ottawa Canada
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Thanks for the clarification |
|
Back to top |
|
|
TG Murphy
Active User
Joined: 23 Mar 2007 Posts: 148 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. |
|
Back to top |
|
|
|