Page 1 of 1

Static and Dynamic CALL in COBOL.

Posted: Thu Jan 23, 2014 5:23 pm
by Rahul
Hello,

Is the following understading correct?

If compiled as NODYNAM:
CALL 'literal' is a static call
CALL WS-label is a dynamic call

If compiled as DYNAM:
CALL 'literal' is a dynamic call
CALL WS-label is a dynamic call

But I'm confused why a type of CALL sould depends on compiler option - can't we just understand it directly looking at program?

Re: Static and Dynamic CALL in COBOL.

Posted: Thu Jan 23, 2014 6:24 pm
by William Collins
Your understanding is correct.

Your confusion would be nothing compared to that of the compiler if it did not know what sort of code to generate for something.

Here's a CALL I want to have in a system which uses dynamic loading of modules: CALL "A". Here's the same CALL but for a system where everything is fully linkedited/bound. CALL "A". So, to tell the compiler, I need the compiler option.

Re: Static and Dynamic CALL in COBOL.

Posted: Thu Jan 23, 2014 8:45 pm
by Robert Sample
can't we just understand it directly looking at program?
No, because as was stated CALL "literal" can be static OR dynamic -- and which it is will depend upon how the program is compiled, NOT ON ANYTHING IN THE PROGRAM!

Re: Static and Dynamic CALL in COBOL.

Posted: Thu Jan 23, 2014 9:31 pm
by Rahul
Thanks William and Robert.

I've seen many of my friends discussing this question that they have been asked in interview: " can't we just understand it directly looking at program". I'm not sure why they have been asked such question!

Re: Static and Dynamic CALL in COBOL.

Posted: Fri Jan 24, 2014 2:12 am
by dick scherrer
I'm not sure why they have been asked such question!
Usually so the interviewer can determine the depth of the applicant's knowledge/experience or how the applicant will react to an unplanned question/situation. Which is the reason for many (most) questions like this in an interview.