Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Vs Static call

Status
Not open for further replies.
Sep 20, 1998
1
0
0
US
Can anyone tell me the difference between Dynamic Call and Static Call which is called during run time.
 
A Static call is one which has been written in source code as a literal value in quotes after the CALL verb.<br>
Every time the calling program is run, the subprogram will be loaded into memory, and will reside there for the entire run of the calling prorgram. There must be enough memory for both programs (not usually a problem in modern systems).<br>
<br>
<br>
A Dynamic call is one written in the source code as a variable containing the name of the program in PIC X(8) format after the CALL verb.<br>
When the calling program is run, the subprogram is not loaded into memory until execution of the program reaches the CALL verb, at that time, the subprogram will be loaded into memory, and can be removed at a later time by a CANCEL verb.<br>
<br>
Some of the ideas behind Dynamic calls: to allow for different sub-programs to be called from the same point in the program; when multiple sub-programs are required, and not enough memory is available (again, usually not a problem anymore), the total number of subprograms loaded at one time can be managed through the CANCEL verb (the disadvantage being repeated loads and unloads of the machine code into memory); to avoid recompiling all calling programs every time a change is made to a common subprogram (if the subprogram is statically linked, and a change is made to the subprogram, then both the subprogram and calling program must be recompiled).
 
A Dynamic call is at run time and a Static call is at compile time. Using a Dynamic call will save you from recompiling all the calling programs when a called program is changed. However, most shops I've worked use Static as a default.
 
Be a little careful with the assumption that a name in quotes gives a static call. In our shop the defaults are set so that you will get a dynamic call unless you specifically request static calls for you program. I don't remember if the request is a parm to the compiler or to the linker, but the point is that the newer products from IBM are trying mightily to make COBOL behave more like other contemporary languages.
 
Could anyone tell me more about this, I have this problem I Every time the calling program is run, the subprogram loaded into memory, and reside there for the entire run of the calling prorgram. And when I CANCEL the program I still having this loaded into memory, and I´m having problems with the memory beacause I have an application for about 1000 users.
 
ramgarra -

Are you sure CANCEL is not unloading the subprogram? Does it have any subprograms that it calls that should also be canceled? What is your environment?

Glenn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top