7 calling non-cobol programs from compaq cobol – Compaq COBOL AAQ2G1FTK User Manual
Page 455
Interprogram Communication
12.6 Calling Compaq COBOL Programs from Other Languages
[3] After calling cobcall again:
================================
retval = 987654321
arg1
= 28
[4] After calling cobcancel:
============================
retval = 987654321
arg1
= 28
+------------------- From COBOL --------------------
| myVal
=
0
| arg1
=
28
| arg2
=
2
| arg3
=
3
| arg4
=
4
| retVal = 987654321
+ After ’add arg1 arg2 arg3 arg4 giving arg1 myVal’:
| myVal
=
37
| arg1
=
37
| arg2
=
2
| arg3
=
3
| arg4
=
4
| retVal = 987654321
+---------------------------------------------------
[5] After calling cobcall again:
================================
retval = 987654321
arg1
= 37
12.7 Calling Non-COBOL Programs from Compaq COBOL
Because the Compaq COBOL compiler is part of a common language
environment, a Compaq COBOL program can call a procedure written in
another language available in this environment. This communication among
high-level languages exists because these languages adhere to the OpenVMS
Calling Standard or the Compaq Tru64 UNIX Calling Standard for Alpha
Systems, as applicable, when generating a call to a procedure. Section 13.2
briefly describes the OpenVMS Alpha calling standard.
On OpenVMS, for more information, refer to the material on calling system
routines in the OpenVMS Programming Concepts manual, the OpenVMS RTL
Library (LIB$) Manual, and the OpenVMS System Services Reference Manual.
♦
12.7.1 Calling a Fortran Program
Calling a procedure written in Fortran allows you to take advantage of features of
that language. Example 12–12 demonstrates how to call a non-COBOL program
in the run unit.
Example 12–12 Calling a Fortran Program from a COBOL Program
IDENTIFICATION DIVISION.
PROGRAM-ID.
GETROOT.
****************************************************
* This program accepts a value from the terminal,
*
* calls the Fortran subroutine SQROOT, and passes
*
* the value as a character string. Program
*
* SQROOT returns the square root of the value.
*
****************************************************
(continued on next page)
Interprogram Communication 12–25