Developing Compaq COBOL Programs
1.3 Developing Programs on OpenVMS Alpha
Example 1–2 Main Program and Subprograms
* CALLER.COB
IDENTIFICATION DIVISION.
PROGRAM-ID. CALLER.
******************************************************************
* This program calls a subprogram installed as a shareable image.*
******************************************************************
PROCEDURE DIVISION.
0.
CALL "SUBSHR1"
ON EXCEPTION
DISPLAY "First CALL failed. Program aborted."
END-CALL.
STOP RUN.
END PROGRAM CALLER.
* SUBSHR1.COB
IDENTIFICATION DIVISION.
PROGRAM-ID. SUBSHR1.
******************************************************************
* This program is linked as a shareable image. When it is called,*
* it calls another program installed as a shareable image.
*
******************************************************************
PROCEDURE DIVISION.
0.
DISPLAY "Call to SUBSHR1 successful. Calling SUBSHR2.".
CALL "SUBSHR2"
ON EXCEPTION
DISPLAY "Second call failed. Control returned to CALLER."
END-CALL.
END PROGRAM SUBSHR1.
* SUBSHR2.COB
IDENTIFICATION DIVISION.
PROGRAM-ID. SUBSHR2.
****************************************************************
* This program is linked as a shareable image and is called by *
* another shareable image.
*
****************************************************************
PROCEDURE DIVISION.
0.
DISPLAY "Call to SUBSHR2 successful!".
END PROGRAM SUBSHR2.
Example 1–3 shows a command procedure that compiles, links, and installs the
sample programs in Example 1–2.
Example 1–3 Command Procedure to Link a Program as a Shareable Image
$! Create the main program and subprograms to be installed as
$! shareable images. In this example CALLER.COB is the main program.
$! SUBSHR1.COB and SUBSHR2.COB are the subprograms to be installed
$! as shareable images.
$!
(continued on next page)
Developing Compaq COBOL Programs 1–45
Содержание COBOL AAQ2G1FTK
Страница 22: ......
Страница 30: ......
Страница 94: ......
Страница 110: ......
Страница 146: ......
Страница 180: ......
Страница 194: ...Processing Files and Records 6 1 Defi...
Страница 300: ......
Страница 490: ......
Страница 516: ......
Страница 517: ......
Страница 530: ......
Страница 534: ......
Страница 590: ......
Страница 620: ......