View previous topic :: View next topic
|
Author |
Message |
Manish Kumar Agrawal
New User
Joined: 10 Jun 2006 Posts: 2 Location: India
|
|
|
|
Hi,
Can anybody help me to know that why all the working storage variables of a dynamically called program is reinitialized when it is called again.Which is not the case in static call unless and until you overwrite it. |
|
Back to top |
|
|
calspach
New User
Joined: 05 May 2006 Posts: 32 Location: USA
|
|
|
|
That's just one of the features between a dynamic and a static. One of the reasons why you choose which you should use. |
|
Back to top |
|
|
Manish Kumar Agrawal
New User
Joined: 10 Jun 2006 Posts: 2 Location: India
|
|
|
|
Hi calspach
I can't get u.Can u specify me in detail. |
|
Back to top |
|
|
calspach
New User
Joined: 05 May 2006 Posts: 32 Location: USA
|
|
|
|
When you dynamically call a program, the program that is called is pulled into memory each time it's called. Therefore that re-initializes all the variables each time it's called. If you make changes to the called program and recompile it, those changes will be seen the next time you call it.
When you do a static call, the program that is called is pulled into the calling program when you compile. Therefore, you don't need to re-initialize the variables each time it's called, cause it only belongs to the one program that it's a part of. When it's static, its like the called program actually becomes part of the calling program. If you make changes to the called program but don't recompile the calling, your changes won't be seen. |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Manish Kumar Agrawal,
Quote: |
Can anybody help me to know that why all the working storage variables of a dynamically called program is reinitialized when it is called again.Which is not the case in static call unless and until you overwrite it.
|
Normally, Dynamic called subprograms do not reinitialize the working storage variables. The first time the subprogram is called it is loaded into memory, and stays there until the calling program ends. There are two exceptions. 1 ? you specified the ?INITIAL? attribute on the subprogram, or 2 - the calling program did a ?CANCEL? of the subprogram.
Check these three links.
Dynamic CALL Statement
PROGRAM-ID Paragraph
CANCEL Statement
Dave |
|
Back to top |
|
|
|