HP OpenVMS Systems Documentation |
HP COBOL
|
Previous | Contents | Index |
In Figures 11-14 and 11-15, the output from the sample program is shown.
Figure 11-14 MENU-SCREEN Output (Alpha, I64)
+------------------------------------------------------------------------------+ | Daily Calendar | | | | | | || | | | | Show appointments for a day | | | | Schedule an appointment | | | | Cancel an appointment | | | | Print your appointments | | | | | | | | | | | | Use the arrow keys to move the cursor among menu items. | | Press <Return> when the cursor is at the desired item. | | Press <F10> to exit. | | | | || | | | +------------------------------------------------------------------------------+ |
Figure 11-15 SCHEDULE-SCREEN Output (Alpha, I64)
+------------------------------------------------------------------------------+ | Schedule Appointment | | | | | | | | Description of Appointment: | |Meeting with Bill and Susan | | | | | | Date of Appointment (DD/MM/YY): 01/03/94 | | | | Time of Appointment (HH:MM mm): 11:00 AM | | | | | | | | | | Use Cursor Keys to move within the fields. | | Press <Tab> to enter next field. | | Press <Return> when finished. | | | | | | | | | +------------------------------------------------------------------------------+ |
COBOL programs can communicate with each other, as well as with non-COBOL programs. Program-to-program communication is conducted by using one (or combinations) of the following:
This chapter includes the following information about interprogram communication:
A multiple COBOL program run unit consists of either of the following:
Separately compiled programs can be concatenated in one source file, or
can be written as separate source files.
12.1.1 Examples of COBOL Run Units
Example 12-1 shows a run unit with three separately compiled programs, none of which have contained programs. MAIN-PROGRAM ((1)) calls separate program SUB1 ((2)), that calls separate program SUB2 ((3)).
Example 12-1 Run Unit with Three Separately Compiled Programs |
---|
IDENTIFICATION DIVISION. IDENTIFICATION DIVISION. PROGRAM-ID. MAIN-PROGRAM. (1) PROGRAM-ID. SUB1. (2) . . . . . . CALL SUB1. CALL SUB2. . . . . . . STOP RUN. EXIT PROGRAM. END PROGRAM MAIN-PROGRAM END PROGRAM SUB1. IDENTIFICATION DIVISION. PROGRAM-ID. SUB2. (3) . . . EXIT PROGRAM. END PROGRAM SUB2. |
A separately compiled program has a nesting level number of 1. If this program contains other source programs, it is the outermost containing program. A contained program has a nesting level number greater than 1. |
Example 12-2 shows a run unit with one main program ((4)) and two contained programs (SUB1 ((5)) is a directly contained program of MAIN-PROGRAM; SUB2 ((6)) is an indirectly contained program of MAIN-PROGRAM).
Example 12-2 Run Unit with a Main Program and Two Contained Programs |
---|
IDENTIFICATION DIVISION. PROGRAM-ID. MAIN-PROGRAM. (4) . . . CALL SUB1. . . . STOP RUN. IDENTIFICATION DIVISION. PROGRAM-ID. SUB1. (5) . . . CALL SUB2. EXIT PROGRAM. IDENTIFICATION DIVISION. PROGRAM-ID. SUB2. (6) . . . EXIT PROGRAM. END PROGRAM SUB2. END PROGRAM SUB1. END PROGRAM MAIN-PROGRAM. |
Example 12-3 shows a run unit with three separately compiled programs ((7), (10), and (11)). One of the separately compiled programs, MAIN-PROGRAM ((7)), has two directly contained programs, SUB1 and SUB2 ((8) and (9)).
Example 12-3 Run Unit with Three Separately Compiled Programs, One with Two Contained Programs |
---|
IDENTIFICATION DIVISION. PROGRAM-ID. MAIN-PROGRAM. (7) . . . CALL SUB1. CALL SUB2. . STOP RUN. IDENTIFICATION DIVISION. PROGRAM-ID. SUB1. (8) . . . CALL SUB3. EXIT PROGRAM. END PROGRAM SUB1. IDENTIFICATION DIVISION. PROGRAM-ID. SUB2. (9) . . . EXIT PROGRAM. END PROGRAM SUB2. END PROGRAM MAIN-PROGRAM. IDENTIFICATION DIVISION. PROGRAM-ID. SUB3. (10) . . . CALL SUB4. . . . STOP RUN. IDENTIFICATION DIVISION. PROGRAM-ID. SUB4. (11) . . . EXIT PROGRAM. |
Previous | Next | Contents | Index |