CALL statement implicit program name resolution in COBOL
0 reputation · 06 Feb 2025, 03:12 UTC
When a COBOL CALL statement omits an explicit PROGRAM‑ID, the compiler must decide which program name to use for the implicit reference. The language standard does not prescribe this rule, so implementations vary: some compilers resolve the call to the host program’s name, while others use the containing module’s name.
In a local development environment the module‑name rule may succeed, but the same source deployed to a production compiler that follows the host‑program rule can attempt to call a non‑existent program, producing a runtime failure that only appears after deployment.
Because the behavior is vendor‑specific and not controllable through standard syntax, developers face an unresolved decision about how to guarantee consistent resolution across different build and runtime configurations.
What determines the implicit program name when a CALL lacks a PROGRAM‑ID? How can a project enforce a single resolution strategy without modifying every CALL? Is there a compiler option or coding practice that portably selects the desired name?