HP OpenVMS Systems Documentation

Content starts here

User Manual

Previous Contents Index

B.5 Differences Between Releases and Across Operating Systems

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 and behavior.


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 -rkc 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.

  • File sharing for sequential and relative files on all systems remains essentially the same.
  • File sharing for indexed files has the following limitation: The OPEN statement ALLOWING READERS phrase is minimally supported for indexed files on Tru64 UNIX systems. Using the ALLOWING READERS phrase for indexed files is not recommended.
  • File-sharing protocols for all file organizations are in effect for Tru64 UNIX systems for the OPEN statement in OUTPUT mode, which is similar to EXTEND and I-O modes. On Tru64 UNIX systems, access is denied or granted depending on the file lock requested and the file lock held (with the exception of the READERS support noted previously). On OpenVMS Alpha and OpenVMS I64, a new version of the file is always created.
  • On Tru64 UNIX, manual record locking for files with the indexed organization has the following limitations:
    • For the READ and START statements, the REGARDLESS phrase is not fully supported. The read or start operation is performed but the soft record lock status is not returned.
    • The START statement does not detect or acquire a record lock.
    • The READ statement with the ALLOWING READERS phrase is not supported. It is treated as NO OTHERS if the file is opened in I-O mode or it is treated as ALL if the file is opened in INPUT mode.
    • The REWRITE and WRITE statements do not retain record locks.
    • The (current) RECORD phrase is not supported for the UNLOCK statement. The ALL RECORDS phrase is assumed for all UNLOCK statements.

B.5.3 VFC File Format

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:


B.5.4 File Attribute Checking (Tru64 UNIX)

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:

  • Number of keys
  • Size and position (within the record structure) of each key
  • Whether or not duplicates are allowed for each key

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 results.

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:

  • For an indexed file, the run-time system creates two files on the disk: one file with the dat extension, and the other file with the idx extension.
  • If you try to open an indexed file as a sequential file, the key part of any record other than a character key will be different. The reason is that the keys in a record are translated to a file format on disk.
  • When you open an existing indexed file, the RTL checks its key structure and returns a severe error if there is a serious mismatch.
    On Tru64 UNIX, this RTL check does not detect some differences that would be detected on an OpenVMS Alpha or I64 system, because all but signed 16- and 32-bit integers are mapped onto character strings. For example, if you write an indexed file using a key described as an unsigned 32-bit integer, the character string you will read is the integer with its bytes reversed.
    On an OpenVMS Alpha or I64 system, by contrast, you receive a severe error when you try to open a file with the incompatible key.

B.5.6 RMS Special Register References in Your Code

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

B.6 File Compatibility Across Languages and Platforms

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:

  • Print-controlled files that are created on the Tru64 UNIX operating system cannot be used as VFC files on the Alpha or I64 operating systems.
  • VFC files cannot be used on the Tru64 UNIX operating system.
  • On Tru64 UNIX, to read a file with variable-length records, you must describe the file as such in the program (use RECORD IS VARYING). On OpenVMS Alpha and OpenVMS I64, you can read a file with variable-length records by using a file description for fixed-length records.
  • On OpenVMS Alpha and OpenVMS I64, a file with fixed-length records can be described in a COBOL program with an FD specifying a length shorter than the file record length. On input, the extra data in each record is ignored on OpenVMS Alpha and I64. On Tru64 UNIX, the length specified for the FD must match the actual length of the records in the file; you must not use RECORD IS VARYING to read a file with fixed-length records.
  • On Alpha and I64, to read a file sequentially, use ORGANIZATION INDEXED, ACCESS SEQUENTIAL (or DYNAMIC), and READ NEXT.

Data Type Differences

Data types vary by programming language and by utilities. For example, HP 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 the SPECIAL-NAMES paragraph of the Environment Division, along with 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 OpenVMS Alpha and I64.


Previous Next Contents Index