HP OpenVMS Systems Documentation
Certain HP COBOL features have unique behaviors, depending on
which operating system you are using, and sometimes these differences
differ from release to release. You should refer to the Release Notes
to get the most recent information about these differences. The next
few sections describe distinct differences in feature implementation
A REWRITE operation for an ISAM file is dependent on whether the DUPLICATES clause for the primary key is specified. There is an ambiguity when DUPLICATES is specified in one way at the time a file is created, and another way when it is reopened (a program should use the same declarations). HP COBOL for OpenVMS VAX, HP COBOL for OpenVMS Alpha, and HP COBOL for OpenVMS I64 use the specification of the current program. So, if DUPLICATES was specified for the primary key when a file was created, but not when reopened by the current program, the behavior will be as if DUPLICATES were not allowed.
HP COBOL for Tru64 UNIX issues a severe run-time error if
there is a mismatch, unless relax key checking (the
flag) is specified, in which case the behavior is inconsistent. In many
cases, you will get the behavior of the specification when the file was
created, but you should not rely on this.
B.5.2 File Sharing and Record Locking
With HP COBOL for Tru64 UNIX, certain file-sharing and record-locking operations might behave differently from the same operations on HP COBOL on OpenVMS Alpha and OpenVMS I64. HP COBOL for Tru64 UNIX issues warning diagnostics where applicable.
If a VFC file is created on OpenVMS Alpha or on OpenVMS I64 and then read on Tru64 UNIX, the data record will be returned with the 2-byte control string in the data record when it is read.
The workaround is to convert the file to a non-VFC format on OpenVMS Alpha or I64 by specifying /NOVFC. Alternatively, you can skip over the VFC bytes when you read the file on Tru64 UNIX.
The following files are by default created in VFC format on OpenVMS Alpha and I64:
Output with WRITE ADVANCING
HP COBOL on Tru64 UNIX provides limited file attribute checking. No file attribute checking is performed for sequential and relative files. For indexed files, HP COBOL verifies that the following file attributes match what is specified in the application:
If these attributes do not match, the file will not be opened and a fatal run-time error will occur (or Declaratives will be invoked, if applicable).
However, with the relax key checking option selected, HP COBOL for Tru64 UNIX will allow you to open a file that specifies fewer keys than were specified when the file was originally created. This option will provide correct results only in those cases where the unspecified keys are USAGE DISPLAY (PIC X). Also, -rkc allows you to open a file that specifies DUPLICATES for a key in a way differently from the specification given when the file was created.
There is an additional check in creating an indexed file: unless relax
key checking is specified, you cannot have two keys that are identical
except for whether DUPLICATES are allowed. If this restriction is
violated, there will be an explicit run-time error message and those
operations that are affected by DUPLICATES might give unexpected
B.5.5 Indexed Files
HP COBOL for Tru64 UNIX treats indexed files differently from the way they are treated by HP COBOL for OpenVMS Alpha, OpenVMS I64, and HP COBOL for OpenVMS VAX. Specifically, on Tru64 UNIX:
HP COBOL for Tru64 UNIX does not support RMS Special Registers. If you include them, you may receive the following general diagnostic message when you attempt to compile the program:
cobol: Severe: ...Undefined name
Files created by different programming languages may require special processing because of language and character set incompatibilities. The most common incompatibilities are data types and data record formats. You should be aware of the following:
You can use the following techniques to overcome data type incompatibilities:
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 OpenVMS Alpha and I64.
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. . . .