|
HP COBOL Reference Manual
General Rules
All Formats
- An input screen item is one whose description contains a TO clause.
- An output screen item is one whose description contains a FROM
clause.
- A literal screen item is one whose description contains a VALUE
clause.
- An update screen item is one whose description contains a USING
clause.
- An input-output screen item is one whose description contains both
a FROM phrase and a TO phrase that may or may not reference the same
identifier. The rules for update screen items also apply to
input-output screen items.
- The LINE and COLUMN clauses should not be specified within a screen
description entry in such a way that fields overlap on the screen or
fall beyond the screen boundaries.
Format 1
- Format 1 is used for group screen items.
- All clauses within a group screen description entry are inherited
by subordinate screen description entries with the exception of the
BLANK SCREEN clause.
- If the SECURE clause is specified, it applies to each subordinate
input screen item.
- If the AUTO, FULL, or REQUIRED clauses are specified, they apply to
each subordinate input and update screen item.
- If the BACKGROUND-COLOR, FOREGROUND-COLOR, or SIGN clauses are
specified, they apply to each subordinate input, output, and update
screen item.
Format 2
- Format 2 is used to describe a literal screen item.
Format 3
- Format 3 is used to describe input, output, or update screen items.
<>
5.3.7 ACCESS MODE
Function
The ACCESS MODE clause specifies the order of access for a file's
records.
rel-key
is the file's RELATIVE KEY data item.
Syntax Rules
- rel-key must be the data-name of an unsigned
integer data item whose description does not contain a PICTURE symbol
(P). It can be qualified but cannot be in a record description entry
for the same file-name.
- The ACCESS MODE clause can be in the file's SELECT clause. However,
it cannot be in both the SELECT clause and file description entry for
the same file.
- If the USING or GIVING phrases of a SORT or MERGE statement contain
the name of the file, the ACCESS MODE RANDOM clause cannot be used for
the file.
- If rel-key is associated with an external file connector,
rel-key must reference the same data item in every program in
the run unit.
- If a START statement references a relative file, the program must
specify the RELATIVE KEY phrase for that file.
General Rules
All Formats
- If there is no ACCESS MODE clause, the access mode is sequential.
- For sequential access, the sequence in which the program accesses
the records depends on the organization of the file, as follows:
- Sequential files---The sequence is the same as that established by
the execution of WRITE statements that created or extended the file.
- Relative files---The sequence is the order of ascending relative
record numbers of the file's existing records.
- Indexed files---The sequence is the sort order (ascending or
descending) of record key values in the established Key of Reference.
Formats 2 and 3
- For random access, the value of rel-key (for relative
files) or a Record Key data item (for indexed files) indicates the
record to be accessed.
- For dynamic access, the program can access records sequentially and
randomly.
Format 2
- Relative record numbers uniquely identify records in relative
files. A record's relative record number identifies its ordinal
position in the file. The first record in the file has a relative
record number of 1. Subsequent records have consecutively higher
relative record numbers.
- The Relative Key data item associated with the execution of an
Input/Output statement is rel-key in the file description
entry (or SELECT clause) associated with the statement.
5.3.8 ALTERNATE RECORD KEY
Function
The ALTERNATE RECORD KEY clause specifies an alternate access path to
indexed file records.
General Format
alt-key
is the Record Key for the file. It is the data-name of a data item in a
record description entry for the file. It can be qualified, but it
cannot be a group item that contains a variable-occurrence data item.
The data item must be described as one of the following:
- Alphanumeric item
- Alphabetic item
- Group item
- Unsigned numeric display item
- COMP-3 integer
- COMP integer
seg-key
is a segmented-key name that represents the concatenation of one or
more (up to eight) occurrences of seg.
seg
is the data-name of a data item in a record description entry for the
file. It can be qualified, but it cannot be a group item that contains
a variable-occurrence data item. The data item must be described as one
of the following:
- Alphanumeric item
- Alphabetic item
- Group item
- Unsigned numeric display item
Syntax Rules
- The ALTERNATE RECORD KEY clause can be in the file's SELECT clause.
However, for the same file, it cannot be in both the SELECT clause and
file description entry.
- alt-key or the segments of seg-key cannot have
the same leftmost character position as that of the Prime Record Key
data item or any other alt-key or segment of seg-key
for the same file.
General Rules
- seg-key is the concatenation of all specified key
segments in the order specified.
- seg-key can be referenced only in a READ (Format 3) or
START statement.
- When a program creates an indexed file with one or more ALTERNATE
RECORD KEY clauses, each subsequent program referencing this indexed
file must:
- Use the same data description for alt-key or the segments
of seg-key.
- Define the same relative location in the record as alt-key
or the segments of seg-key.
- Specify the same number (or less) of ALTERNATE RECORD KEY clauses.
On Tru64 UNIX systems, you can specify a different number of
keys than was specified when the file was created, if the relaxed key
check option (
-relax_key_checking
) is used. <>
- Maintain the same order of ALTERNATE RECORD KEY clauses.
- Specify the same order of keys (ASCENDING or DESCENDING) in each
ALTERNATE RECORD KEY clause as the order used when the file was created.
- The DUPLICATES phrase specifies that two or more records in the
file can have duplicate values in the same alt-key or the
segments of seg-key. If there is no DUPLICATES phrase, two
records cannot have the same value in corresponding Alternate Record
Keys.
On OpenVMS, if the program was compiled with the
/CHECK=DUPLICATE_KEYS qualifier on the command line, and the duplicate
key specification on a file's FD (in other words, specified in the WITH
DUPLICATES phrase) does not match that of the actual file, a run-time
diagnostic will be issued when an attempt is made to open the file with
an OPEN statement. The /CHECK=DUPLICATE_KEYS qualifier is not
supported for remotely accessed files. Duplicate keys, key length, and
number of keys are not checked for remote files, that is, files
accessed over the network. <> On Tru64 UNIX systems,
DUPLICATES must match the specification for DUPLICATES when the file
was created, unless the relaxed key check option is used. <>
- If a file has more than one record description entry, only one of
these record description entries must describe alt-key or the
segments of seg-key. The character positions referenced by
alt-key or the segments of seg-key in that record
description are implicitly referenced in all other record description
entries for the file.
- A file can have up to 254 Alternate Record Keys.
- If the associated file connector is an external file connector, all
File Description entries in the run unit that are associated with the
file connector must define the same data description entry for
alt-key or the segments of seg-key, with the same
relative location within the record.
- Each key can be specified as ASCENDING or DESCENDING (ASCENDING is
the default). In an ASCENDING key, lower key values occur toward the
beginning of the sorted file. In a DESCENDING key, higher key values
occur toward the beginning of the sorted file.
Additional Reference
|