Calling A Basic Program; Calling A Basic Program From A Cobol Program - Compaq COBOL AAQ2G1FTK User Manual

Compaq computer accessories user manual
Table of Contents

Advertisement

Sample Run of GETROOT (OpenVMS)
$ RUN GETROOT
Enter number (with decimal point): 25.
The square root is:
5.0000
Enter number (with decimal point): )HELLO
** INVALID ARGUMENT FOR SQUARE ROOT
Enter number (with decimal point): 1000000.
The square root is: 1000.000000
1,000.0000
Enter number (with decimal point): 2.
The square root is:
1.4142
Enter number (with decimal point):
$

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 12–14 Calling a BASIC Program from a COBOL Program
IDENTIFICATION DIVISION.
PROGRAM-ID.
******************************************************
* 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
01 C-APPLICATION-NUMBER PIC 9(3) COMP.
01 ANNUAL-SALARY
01 C-ANNUAL-SALARY
01 MORTGAGE-RENT
01 C-MORTGAGE-RENT
01 YEARS-EMPLOYED
01 C-YEARS-EMPLOYED
01 YEARS-AT-ADDRESS
01 C-YEARS-AT-ADDRESS
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.
12.7 Calling Non-COBOL Programs from Compaq COBOL
Return
5.000000
1.414214
APPL.
PIC 999.
PIC 9(5).
PIC 9(5) COMP.
PIC 999.
PIC 9(3) COMP.
PIC 99.
PIC 9(2) COMP.
PIC 99.
PIC 9(2) COMP.
Interprogram Communication
Return
Return
Return
Return
Return
*
*
*
*
(continued on next page)
Interprogram Communication 12–27

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COBOL AAQ2G1FTK and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents