CALL
The COBOL statement that runs another program and passes data to it, then continues when that program returns.
Also written CALL USING, subprogram, static call, dynamic call, GOBACK
CALL runs another program, usually called a subprogram, and waits for it to finish: CALL 'DATECHK' USING WS-DATE WS-RESULT. The items after USING are passed to the subprogram, which describes them in its LINKAGE SECTION. When the subprogram ends with GOBACK, the caller carries on from the next statement.
There are two ways a call can be made. In a static call, the subprogram is linked into the same load module as the caller, so they are always used together. In a dynamic call, the subprogram is loaded when it is first called. A dynamic subprogram can be changed and replaced without relinking every program that uses it. Which kind you get depends on how the call is written and on compile options.
Data is passed BY REFERENCE by default, which means the subprogram works on the caller's own fields. BY CONTENT passes a copy, so the caller's fields cannot be changed.
Most large COBOL systems are built from many small programs that call each other, often sharing common routines for dates, logging and error handling.
Where can I learn this hands-on?
Right here, at ZedBank. You take a junior job at a simulated bank and learn each part of the work by doing it, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- LINKAGE SECTIONThe part of a COBOL program's DATA DIVISION that describes data passed in from outside, such as from a calling program.
- Load moduleThe runnable form of a program, stored in a library, which JCL executes by name.
- Link-editCombining compiled object code with the other modules it needs into a single runnable program.
- CopybookA shared block of COBOL declarations kept in a library and included into programs, so a record layout is defined once.
- COBOLThe programming language most business logic on the mainframe is written in. Verbose by design, and still running the world's payments.