Compaq AAQ2G1FTK Marine Radio User Manual


 
Interprogram Communication
12.7 Calling Non-COBOL Programs from Compaq COBOL
Sample Run of GETROOT (OpenVMS)
$ RUN GETROOT
Return
Enter number (with decimal point): 25.
Return
The square root is: 5.000000
5.0000
Enter number (with decimal point): )HELLO
Return
** INVALID ARGUMENT FOR SQUARE ROOT
Enter number (with decimal point): 1000000.
Return
The square root is: 1000.000000
1,000.0000
Enter number (with decimal point): 2.
Return
The square root is: 1.414214
1.4142
Enter number (with decimal point):
Return
$
12.7.2 Calling a BASIC Program
The rich, yet easily accessed features of BASIC make that language a natural
environment for development of short routines to be called from COBOL.
Example 12–14 shows one example of a Compaq COBOL program that calls
a BASIC program.
Example 1214 Calling a BASIC Program from a COBOL Program
IDENTIFICATION DIVISION.
PROGRAM-ID. APPL.
******************************************************
* This COBOL program accepts credit application *
* information and passes this information to a BASIC *
* program that performs a credit analysis. Notice *
* that the data passed to the BASIC program is in *
* the standard binary format. *
******************************************************
DATA DIVISION.
WORKING-STORAGE SECTION.
01 APPLICATION-NUMBER PIC 999.
01 C-APPLICATION-NUMBER PIC 9(3) COMP.
01 ANNUAL-SALARY PIC 9(5).
01 C-ANNUAL-SALARY PIC 9(5) COMP.
01 MORTGAGE-RENT PIC 999.
01 C-MORTGAGE-RENT PIC 9(3) COMP.
01 YEARS-EMPLOYED PIC 99.
01 C-YEARS-EMPLOYED PIC 9(2) COMP.
01 YEARS-AT-ADDRESS PIC 99.
01 C-YEARS-AT-ADDRESS PIC 9(2) COMP.
PROCEDURE DIVISION.
010-BEGIN.
DISPLAY "Enter 3 digit application number".
ACCEPT APPLICATION-NUMBER.
IF APPLICATION-NUMBER = 999
DISPLAY "All applicants processed" STOP RUN.
MOVE APPLICATION-NUMBER TO C-APPLICATION-NUMBER.
DISPLAY "Enter 5 digit annual salary".
ACCEPT ANNUAL-SALARY.
MOVE ANNUAL-SALARY TO C-ANNUAL-SALARY.
(continued on next page)
Interprogram Communication 1227