COBOL Manual for TNS and TNS/R Programs
Calling Other Programs and Routines
HP COBOL Manual for TNS and TNS/R Programs—522555-006
23-17
Restrictions on Calling Non-COBOL Routines
•
Returns a structured value.
•
Specifies a formal parameter whose type has no corresponding HP COBOL type
(to see which HP C types have corresponding HP COBOL types, see Appendix B,
Data Type Correspondence.
A HP COBOL program and an HP C program can share data under these conditions:
•
The HP COBOL and HP C programs are compiled with compilers of RVU D20.00
or later.
•
The HP COBOL and HP C programs run in the CRE.
•
If the HP COBOL program is compiled with the COBOL85 compiler (as opposed to
the NMCOBOL compiler), its external data is in the Extended-Storage Section.
•
Level-01 HP COBOL data items are described with the EXTERNAL clause.
•
HP C data names that the HP COBOL program references have no lowercase
letters or underscores.
•
For TNS processes, the HP C program uses the large memory model (because
HP COBOL passes all parameter addresses in 32 bits). (All native languages pass
parameter addresses in 32 bits.)
•
If the HP COBOL and HP C programs are sharing strings, the strings end in the
zero byte that HP C expects.
In Example 23-2, the HP COBOL and HP C programs share the data item MYVAR.
Example 23-2. HP COBOL and HP C Programs Sharing Data
HP COBOL Code:
* The SEARCH directive references the HP C object file.
?SYMBOLS; ENV COMMON; SEARCH SHOWEXTO
IDENTIFICATION DIVISION.
PROGRAM-ID. TEST-EXTERNAL.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES. SYMBOLIC NULLCHAR IS 1.
DATA DIVISION.
EXTENDED-STORAGE SECTION.
01 MYVAR EXTERNAL.
05 DATA-01 PIC X(20).
05 NULL-TERM PIC X.
PROCEDURE DIVISION.
STARTIT.
MOVE "abcdefghijlmnopqrstu" TO DATA-01.
MOVE NULLCHAR TO NULL-TERM.
ENTER C "SHOWEXT".
DISPLAY "Back in COBOL: " DATA-01.