Thursday, November 20, 2008

What is Dynamic call in COBOL ?

In COBOL, the dynamic form of a subroutine call is coded like this:
01 SUBROUTINE-A PIC X(8) VALUE 'A'.
CALL SUBROUTINE-A USING arguments

The dynamic form of the CALL statement specifies the name of the subroutine using a variable; the variable contains the name of the subroutine to be invoked.
The difference is that the name of the subroutine is found in the variable SUBROUTINE-A. The compiled code will cause the operating system to load the subroutine when it is required instead of incorporating it into the executable. So, if you modify "A" and recompile it, you need not recompile/relink any of the executables that call "A".

NOTE : some compilers let you set options that will override the calling mechanisms shown above. Therefore, even if your program is coded to call a program statically, the compiler can convert it to the dynamic form of CALL if you set (or don't set). We will talk about these options later.

Hope this post made some things crispier. Please do provide your comments or reactions.

No comments: