Module lessons (2/2)
Subprograms: CALL, LINKAGE SECTION and GOBACK
Invoke static or dynamic external modules with BY REFERENCE vs BY CONTENT, map parameters to LINKAGE SECTION and distinguish GOBACK from STOP RUN.
What you'll learn in this lesson
- Invoke external COBOL programs via
CALLby consciously choosing betweenBY REFERENCE(mutable) andBY CONTENT(read-only) step. - Receive and return parameters in the called program by configuring
LINKAGE SECTIONandPROCEDURE DIVISION USING. - Avoid premature termination of the entire batch job by distinguishing
GOBACK./EXIT PROGRAM.(return to caller) fromSTOP RUN.(terminate process).
Overview
While PERFORM calls a paragraph in the same source file without formal parameters, CALL calls a separately compiled COBOL program passing it typed arguments.
The subprogram declares the parameters received inside the LINKAGE SECTION. (after WORKING-STORAGE) without allocating new physical memory (the address comes from the caller) and lists them in the header of PROCEDURE DIVISION USING:
Sections covered in this lesson
- 11. Calling side:
CALLstatic vs dynamic - 22.
BY REFERENCEvsBY CONTENTvsBY VALUE - 33. Called side:
LINKAGE SECTION.andPROCEDURE DIVISION USING - 44.
GOBACK./EXIT PROGRAM.vsSTOP RUN. - 5Try it yourself
Unlock "Subprograms: CALL, LINKAGE SECTION and GOBACK" and the full Course COBOL curriculum
Invoke static or dynamic external modules with BY REFERENCE vs BY CONTENT, map parameters to LINKAGE SECTION and distinguish GOBACK from STOP RUN.
Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Course COBOL plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.