Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Programming Guide


Main programs, subprograms, and calls

If a COBOL program is the first program in a run unit, that COBOL program is the main program. Otherwise, it and all other COBOL programs in the run unit are subprograms. No specific source-code statements or options identify a COBOL program as a main program or subprogram.

Whether a COBOL program is a main program or subprogram can be significant for either of two reasons:

In the PROCEDURE DIVISION, a program can call another program (generally called a subprogram), and this called program can itself call other programs. The program that calls another program is referred to as the calling program, and the program it calls is referred to as the called program. When the processing of the called program is completed, the called program can either transfer control back to the calling program or end the run unit.

The called COBOL program starts running at the top of the PROCEDURE DIVISION.

related tasks  
Ending and reentering main programs or subprograms  
Transferring control to another program
  
Making recursive calls

related references  
Language Environment Programming Guide


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)