what is the difference between static call and dynamic call?



what is the difference between static call and dynamic call?..

Answer / ravi

Here is the difference between static and dynamic calls, it
is mentioned very clearly in IBM COBOL Manual, read it
carefully, it should clear all your doubts regarding calls



WORKING-STORAGE SECTION.

01 PGM-NAME PIC X(08).

PROCEDURE DIVISION.

BEGIN-PARA.

MOVE “SUBPROG” TO PGM-NAME.

* Dynamic call

CALL PGM-NAME USING RECORD-1. ****** Here PGM-
NAME is called as identifier*******

*Static Call

CALL “SUBPROG” USING RECORD-2. ****** Here it is
CALL literal where literal is SUBPROG*******





If you do not know the program-name to be called until run
time, use the format CALL identifier, where identifier is a
data item that will contain the name of the called program
at run time. For example, you could use CALL identifier
when the program to be called varies depending on
conditional processing in your program. CALL identifier is
always dynamic, even if you use the NODYNAM compiler option.





Making static calls

When you use the CALL literal statement in a program that
is compiled using the NODYNAM and NODLL compiler options, a
static call occurs. With these options, all calls of the
CALL literal format are handled as static calls. In the
static CALL statement, the COBOL program and all called
programs are part of the same load module.



Making dynamic calls

When you use a CALL literal statement in a program that is
compiled using the DYNAM and the NODLL compiler options, or
when you use the CALL identifier statement in a program
that is compiled using the NODLL compiler option, a dynamic
call occurs.





Making both static and dynamic calls

You can use both static and dynamic CALL statements in the
same program if you compile the program with the NODYNAM
compiler option. In this case, with the CALL literal
statement the called subprogram will be link-edited with
the main program into one load module. The CALL identifier
statement results in the dynamic invocation of a separate
load module. When a dynamic CALL statement and a static
CALL statement to the same subprogram are issued within one
program, a second copy of the subprogram is loaded into
storage. Because this arrangement does not guarantee that
the subprogram will be left in its last-used state, results
can be unpredictable.



Performance considerations of static and dynamic calls

Because a statically called program is link-edited into the
same load module as the calling program, a static call is
faster than a dynamic call. A static call is the preferred
method if your application does not require the services of
the dynamic call.

Statically called programs cannot be deleted using CANCEL,
so static calls might take more main storage. If storage is
a concern, think about using dynamic calls. Storage usage
of calls depends on whether:

The subprogram is called only a few times. Regardless of
whether it is called, a statically called program is loaded
into storage; a dynamically called program is loaded only
when it is called.
You subsequently delete the dynamically called subprogram
with a CANCEL statement.
You cannot delete a statically called program, but you can
delete a dynamically called program. Using a dynamic call
and then a CANCEL statement to delete the dynamically
called program after it is no longer needed in the
application (and not after each call to it) might require
less storage than using a static call.

Is This Answer Correct ?    32 Yes 9 No

Post New Answer

More JCL Interview Questions

write a jcl to execute a job by 7:00 am on jan 20,1986?

0 Answers   IBM,


i just need the first and last record from a sequencial file?how

2 Answers  


01 GROSS-PAY 05 BASIC-PAY PIC 9(5) 05 ALLOWENCES PIC 9(3) if BASIC-PAY has a value 1000 and ALLOWENCES has a value of 250,what will be displayed by the statement DISPLAY GROSS-PAY a.1250 b.01000250 c.01250 d.1.250

1 Answers  


What is Cataloged Procedures?

0 Answers  


Name some of the JCL statements that are not allowed in procs.?

1 Answers  






Is it possiable to use a gdg in the INCLUDE statement in a SORT jcl? I am using this because I want to change the condition with out changing the jcl. Please provide with a sample code.

1 Answers  


i want to store 20 digits . how will u do it in cobol ?

0 Answers  


wht do u mean by internal reader in jcl ? wht is the use of internal reader ?

1 Answers   Syntel,


Hello Guys, I have 1+ Year Experience in MAINFRAME TESTING. After 1 Week I have an Interview With a Company on Mainframe Testing. Please Could You Guys Please Suggest me What Sections Should I prepare ?? ___Tell Me the Topic Or Appropriate Site & Links. ?? ---------------Thank You

0 Answers   IBM,


What is job control language?

0 Answers  


What will happen if two JOB statements are mentioned in an JCL continuously.

2 Answers   IBM,


What is a COND parameter in JCL?

10 Answers   TCS,


Categories