Static and Dynamic CALL in COBOL.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Rahul
Registered Member
Posts: 23
Joined: Thu Jan 23, 2014 9:06 am

Static and Dynamic CALL in COBOL.

Post 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?
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: Static and Dynamic CALL in COBOL.

Post 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.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Static and Dynamic CALL in COBOL.

Post 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!
Rahul
Registered Member
Posts: 23
Joined: Thu Jan 23, 2014 9:06 am

Re: Static and Dynamic CALL in COBOL.

Post 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!
dick scherrer
Former Team Member
Posts: 62
Joined: Wed Aug 07, 2013 6:43 pm

Re: Static and Dynamic CALL in COBOL.

Post 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.
Hope this helps,
d
Post Reply

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

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”