[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP COBOL
Reference Manual


Previous Contents Index

Technical Notes

  • On all platforms, leading and trailing spaces and tabs are removed from file specifications before the OPEN statement executes.
  • When a COBOL OPEN statement executes on an OpenVMS system, the RMS facility:
    • Removes spaces and tab characters from the file specification
    • Translates lowercase letters in the file specification to uppercase
    • Performs logical name translation
  • .DAT is the default file type if one is not specified on an OpenVMS system. <>
  • On Tru64 UNIX, the suffixes added to indexed file names on a Tru64 UNIX system are .idx and .dat. <>
  • On Tru64 UNIX, file specifications are case sensitive.
  • Embedded spaces are allowed in file specifications on Tru64 UNIX systems. Thus "file name a" and "Monthly Report" are valid file specifications.
  • When a COBOL OPEN statement executes on a Tru64 UNIX system, HP COBOL attempts to match the file specification against an environment variable with the same spelling declared in the current login environment. If an exact match is found, the value of the matching environment variable becomes the file specification. Otherwise, the file specification remains unchanged. <>

Additional Reference

See Section 5.3.54 clause in Chapter 5, Data Division. For information on defining a file connector, refer to the Processing Files and Records chapter in the HP COBOL User Manual.

4.2.3 BLOCK CONTAINS

Function

On OpenVMS systems, the BLOCK CONTAINS clause specifies the size of a physical record. <>

On Tru64 UNIX systems, block size for INDEXED organization is for documentation purposes only. <>


smallest-block

is an integer literal. It specifies the minimum physical record size.

blocksize

is an integer literal. It specifies the exact or maximum physical record size.

Syntax Rule

The BLOCK CONTAINS clause can be in the file's Data Division file description entry. However, it cannot be in both the SELECT clause and the file description entry for the same file.

General Rules

  1. The BLOCK CONTAINS clause specifies physical record size.
  2. The compiler ignores smallest-block.
  3. The RECORDS phrase specifies physical record size in terms of logical records.
    • For a fixed-length record magnetic tape file, each physical record except the last contains blocksize records.
    • For a variable-length record magnetic tape file, the compiler computes the physical record size. It equals the size of the largest logical record, plus any overhead bytes, multiplied by blocksize.
  4. The CHARACTERS phrase specifies physical record size in terms of characters.
    The physical record size is the maximum of: (1) blocksize bytes, and (2) the size of the largest logical record; plus any overhead bytes for variable-length records.
  5. If there is no BLOCK CONTAINS clause, physical record size assumes a default value.
    The physical record size is the size of the largest record plus any overhead bytes.
  6. The size of physical records (in characters) must be a multiple of four. Otherwise, the I/O system rounds up the physical record size to the next multiple of four.

4.2.4 CODE-SET

Function

The CODE-SET clause specifies the representation of data on external media.


alpha-name

is the name of a character set defined in the SPECIAL-NAMES paragraph. It cannot be described with literals in the ALPHABET clause.

Syntax Rules

  1. The CODE-SET clause can be in the file's Data Division file description entry. However, it cannot be in both the SELECT clause and the file description entry for the same file.
  2. The CODE-SET clause applies only to files with sequential organization.

General Rules

  1. The CODE-SET clause identifies alpha-name as the character set used to represent the file data externally.
  2. alpha-name specifies how to convert character codes in the file to and from native character codes.
  3. Code conversion occurs during execution of an input or output operation. Conversion occurs as if the data were USAGE DISPLAY.
  4. Successful OPEN statement execution establishes the character set for code conversion. The set used is the one specified by alpha-name in the FILE-CONTROL paragraph implied by the OPEN statement.
  5. If there is no CODE-SET clause, no character conversion occurs during input-output operations. The native character set is the default.

Additional Reference

See the Section 4.1.3, SPECIAL-NAMES paragraph.

Example

In this example, the CODE-SET clause specifies that the data in INFILE is coded in the EBCDIC character code set as specified by an alphabet named EB. The SPECIAL-NAMES paragraph defines EB as the EBCDIC character set.


SPECIAL-NAMES.
    ALPHABET EB IS EBCDIC.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
    SELECT INFILE ASSIGN TO INFILE
      CODE-SET IS EB.

4.2.5 LOCK MODE (Alpha, I64)

Function

The LOCK MODE clause specifies a locking technique to use for a file. LOCK MODE is part of the X/Open COBOL standard.


Syntax Rules

  1. X/Open standard and Hewlett-Packard standard syntax cannot both be specified for the same file connector. Hence, if LOCK MODE is specified, the ALLOWING, APPLY LOCK-HOLDING, and REGARDLESS phrases cannot be specified for that file.
  2. The WITH LOCK ON RECORD clause is for documentation purposes only.
  3. The LOCK MODE IS MANUAL clause is not available for sequential or line sequential files.

General Rules

  1. When you specify LOCK MODE IS AUTOMATIC or LOCK MODE IS MANUAL, an OPEN statement (without the WITH LOCK phrase) opens the file in shareable mode. The LOCK MODE clause can be overridden by the WITH LOCK phrase of the OPEN statement.
  2. When you specify LOCK MODE IS EXCLUSIVE, a successful OPEN statement opens the file in exclusive mode. The OPEN statement cannot override LOCK MODE IS EXCLUSIVE.
  3. If you omit the LOCK MODE clause, opening the file causes it to become exclusive, unless you open it for INPUT, in which case the file becomes shareable.
  4. When you specify LOCK MODE IS AUTOMATIC for a file, a record lock is acquired by the successful execution of the READ statement and released on the successful execution of a subsequent I/O statement.
    If you specify LOCK MODE IS MANUAL, a record lock is acquired by the READ WITH LOCK statement.
  5. On Tru64 UNIX, the ROLLBACK phrase is used by ACMSxp applications to specify a recoverable file. You must compile with the -tps option to specify a recoverable file. <>
  6. A file that is opened in exclusive mode cannot be opened by any other access stream.
  7. A file that is in shareable mode can be opened by any number of access streams that do not require exclusive use.
  8. A file that does not reside on a mass storage device cannot be opened in shareable mode. <>

4.2.6 ORGANIZATION

Function

The ORGANIZATION clause specifies a file's logical structure.

On Alpha and I64 systems, the ORGANIZATION IS LINE SEQUENTIAL clause specifies a variant of sequential files compatible with the system text editor. <>


General Rules

  1. File organization is established when the file is created. It cannot be subsequently changed.
  2. If there is no ORGANIZATION clause, the default is SEQUENTIAL.
  3. On Alpha and Itanium systems, when LINE SEQUENTIAL organization is specified, the file is treated as consisting of variable length records, with each record containing one line of data. A line is a sequence of characters ending with a record terminator ( \n or x'0A'). The terminator is not counted in the length of the record.
  4. On Alpha and Itanium systems, a file with LINE SEQUENTIAL organization should only contain printable characters and the record terminator.
  5. On Alpha and Itanium systems, a file with LINE SEQUENTIAL organization may not be opened in I-O mode. <>
  6. All programs that open an existing file must specify the same organization with which the file was created.

Note

On Tru64 UNIX, a third-party product is required for INDEXED run-time support. Refer to the Release Notes for the latest details on how to obtain the INDEXED run-time support. <>


Previous Next Contents Index