Can static call be changed into dynamic call while at runtime.
Can static call be changed into dynamic call while at runtime.
Hi ,
Can a static call be changed to dynamic call during runtime in a COBOL program?
Can a static call be changed to dynamic call during runtime in a COBOL program?
- Robert Sample
- Global Moderator
- Posts: 1896
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Can static call be changed into dynamic call while at runtime.
No. A static call means that the subprogram was linked into the program's load module and hence it is part of the program and can only be called by that program. A dynamic call means that the subprogram exists in a load library as a separate load module and can be called by multiple programs at the same time. There is no way to convert from one to the other while executing the program.
Re: Can static call be changed into dynamic call while at runtime.
Thank you Robert. It was asked me in an interview question. I am not sure even if it could have been done what would be the use of such an arrangement?
- Robert Sample
- Global Moderator
- Posts: 1896
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Can static call be changed into dynamic call while at runtime.
The question was used to judge how well you understand COBOL calls. The advantages of static calls are they are slightly faster, and you won't get a run-time error for not finding the subprogram. The disadvantages are that if the subprogram has to be changed the main program has to be re-linked (which could be quite an adventure depending upon how many subprograms the main program has) and there is a run-time cost to locating and loading the subprogram. The advantages of dynamic calls is that they can be recompiled without affecting the main program, and multiple programs can use the same subprogram, and different versions of the subprogram can exist in different load libraries. The disadvantages of dynamic calls are that you have to have a STEPLIB pointing to the load library containing the subprogram, and they are slightly slower, and if you run the main program in a different LPAR it may use a different version of the subprogram.
There are times when a STEPLIB is not required, such as when the load library is in the LINK LIST concatenation, but then you can only access one version of the subprogram. One thing to be aware of is that CICS program calls are always dynamic now.
There are times when a STEPLIB is not required, such as when the load library is in the LINK LIST concatenation, but then you can only access one version of the subprogram. One thing to be aware of is that CICS program calls are always dynamic now.
Re: Can static call be changed into dynamic call while at runtime.
Thanks Robert.
So if a sub-program is changed, are we to compile all the main programs calling it? Whether or not the change in sub-program affects the main program?
So if a sub-program is changed, are we to compile all the main programs calling it? Whether or not the change in sub-program affects the main program?
- giskard reventlov
- Registered Member
- Posts: 11
- Joined: Wed Jul 29, 2020 4:42 pm
Re: Can static call be changed into dynamic call while at runtime.
it would be wiser to reach an agreement on the terminology ...So if a sub-program is changed, are we to compile all the main programs calling it? Whether or not the change in sub-program affects the main program?
if a dependency ( sub-program ) is changed the main-programs depending on it must be REBUILT,
if it is a full compile of everything or just a compile of the changed sub-program and a re-bind ( the term for the new linkage editor ) depends on Your change management tool setup
- Robert Sample
- Global Moderator
- Posts: 1896
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Can static call be changed into dynamic call while at runtime.
Depending upon what is changed in the subprogram, the main program may NOT need to be recompiled when a dynamic call is used. A dynamic call resolves the subprogram reference AT RUN TIME, not compile time, and hence the subprogram does not get linked in (bound) to the main program. What you described is a static call, which is totally different from a dynamic call. And we're not talking about a change management tool, we're talking about dynamic versus static calls (which are entirely language-dependent). A COBOL program that does not use DB2, for example, has no special requirements for linking / binding and dynamic subprograms have been supported in that environment for at least 20 to 30 years, if not longer.if a dependency ( sub-program ) is changed the main-programs depending on it must be REBUILT,
if it is a full compile of everything or just a compile of the changed sub-program and a re-bind ( the term for the new linkage editor ) depends on Your change management tool setup
If the change affects the interface between the main program and the subprogram, then of course the main program has to be recompiled as well. However, if the change only impacts the subprogram (such as changing a WORKING-STORAGE FILLER to a variable without changing the length), then the main program does not need to be recompiled.
- giskard reventlov
- Registered Member
- Posts: 11
- Joined: Wed Jul 29, 2020 4:42 pm
Re: Can static call be changed into dynamic call while at runtime.
I was not talking about dynamic calls!
Re: Can static call be changed into dynamic call while at runtime.
I am not sure what terminology you are referring to? Could you please elaborate?giskard reventlov wrote: ↑Thu Dec 17, 2020 6:53 pmit would be wiser to reach an agreement on the terminology ...
Re: Can static call be changed into dynamic call while at runtime.
Thanks but I've usually used 'BIND' in connection with COBOL-DB2 programs only.giskard reventlov wrote: ↑Thu Dec 17, 2020 6:53 pmif a dependency ( sub-program ) is changed the main-programs depending on it must be REBUILT,
if it is a full compile of everything or just a compile of the changed sub-program and a re-bind ( the term for the new linkage editor ) depends on Your change management tool setup
- giskard reventlov
- Registered Member
- Posts: 11
- Joined: Wed Jul 29, 2020 4:42 pm
Re: Can static call be changed into dynamic call while at runtime.
I am not that stupidThanks but I've usually used 'BIND' in connection with COBOL-DB2 programs only.
if You had cared to stay updated on the latest IBM terminology You would have known that
the good old linkage editor has been renamed/promoted to binder.
( look Yourself for the different behaviour of the binder when binding to PDSs vs PDSEs )
and also You did not notice that I wrote ...
re-bind ( the term for the new linkage editor )
Re: Can static call be changed into dynamic call while at runtime.
Robert - but why in the heaven we have static-calls there today? Do they really server any purpose?
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute