Compaq COBOL for OpenVMS VAX and Compaq COBOL Compatibility and Migration
B.6 File Compatibility Across Languages and Platforms
Data Type Differences
Data types vary by programming language and by utilities. For example, Compaq
Fortran does not support the packed-decimal data type and, therefore, cannot
easily use PACKED-DECIMAL data in COBOL files.
You can use the following techniques to overcome data type incompatibilities:
• Use the NATIVE character set, which uses ASCII representation, for all data
in files intended for use across languages.
• If your requirements include processing non-ASCII data, you can specify a
character set in: (1) the SPECIAL-NAMES paragraph of the Environment
Division, along with (2) the CODE-SET clause in the SELECT statement.
Except for NATIVE, you must specify all character sets in the SPECIAL-
NAMES paragraph.
• Use common numeric data types (numeric data types that remain constant
across the application).
In the following example, the input file is written in EBCDIC. This creates a file
that would be difficult to handle in most languages other than COBOL on the
OpenVMS Alpha operating system.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES. ALPHABET FOREIGN-CODE IS EBCDIC.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INPUT-FILE ASSIGN TO "INPFIL"
CODE-SET IS FOREIGN-CODE.
.
.
.
B.7 LIB$INITIALIZE Interaction Between C and COBOL
If you use LIB$INITIALIZE when the main program is written in Compaq
COBOL and the initialize routine is written in Compaq C, the initialize routine
will not be called. If you are using Compaq COBOL for OpenVMS VAX on
OpenVMS VAX Version 7.1, however, the routine will be called; also, it will be
called if your main program is in C or in BASIC rather than COBOL, so this can
be a practical workaround.
The problem is due to the quadword alignment with which C creates the
LIB$INITIALIZE psect. The LIB$INITIALIZE psect requires longword
alignment. The programmer can explicitly specify longword alignment on
the extern_model pragma to avoid the problem.
B.8 Reserved Words
Depending on the use of the /RESERVED_WORDS qualifier or flag, there are a
number of additional reserved words in Compaq COBOL that are not reserved in
Compaq COBOL for OpenVMS VAX. See the appendix on reserved words in the
Compaq COBOL Reference Manual for complete information.
B–28 Compaq COBOL for OpenVMS VAX and Compaq COBOL Compatibility and Migration