What is the default mode of calling COBOL programs? Static or dynamic?

Viewed 1347

I had an interview recently and was asked this question:

How are cobol programs are called when no compiler option specified? Static or dynamic?

I answered dynamic, but I am not sure what the correct answer is.

3 Answers

How are cobol programs are called when no compiler option specified? Static or dynamic?

That appears to be a trick question since the default is: CALL literal is static and CALL identifier is dynamic.

See http://publibfp.boulder.ibm.com/epubs/pdf/igy6pg20.pdf, Enterprise COBOL for z/OS, Programming Guide, Version 6.2, SC27-8714-01.

Page 338, DLL

Default is: NODLL

Pge 340, DYNAM

Default is: NODYNAM

Page 498, 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 CALL literal calls are handled as static calls.

Page 499, 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.

[Emphasis added]

The other answers on DYNAM are correct for how the compiler ships from IBM; making the assumption this is an IBM COBOL compiler.

Default: NODYNAM

That said, every installation sets their own installation defaults for the compiler that in most instances establishes the preferred minimum or default options which are different than the compiler defaults. In general, these are very different than the compiler defaults. Those defaults will tend not to change over time in order to maintain product consistency. They do not represent industry norms or preferences.

The compiler options are documented here for Enterprise COBOL for z/OS 6.2.0.

Note the comment about Installation Defaults:

Installation defaults: The default compiler options that were set up when your compiler was installed are in effect for your program unless you override those options. (In some installations, certain compiler options are fixed so that you cannot override them. If you have problems with the default options, contact your system administrator.) To determine which are the default options, run a test compilation without specifying any compiler options. The output listing lists the default options in effect at your site.

It's not exactly clear what compiler you are using, but I found some documentation for IBM Enterprise COBOL for z/OS 6.1.0 :

Use DYNAM to cause nonnested, separately compiled programs invoked through the CALL literal statement to be loaded for CALL, and deleted for CANCEL, dynamically at run time.

Here's the sample syntax provided:

DYNAM option syntax

.-NODYNAM-.   
>>-+-DYNAM---+-------------------------------------------------><

It further observes that

Default is: NODYNAM

Abbreviations are: DYN|NODYN

So, it looks like the default is static (non-dynamic), with dynamic being a compiler option.

If this is not the compiler you are using, please update your question so we can locate the correct version.

Related