File Section (Cont.) [ Micro Focus COBOL Language Reference ] MPE/iX 5.0 Documentation
Micro Focus COBOL Language Reference
File Section (Cont.)
Linage-Counter
The reserved word LINAGE-COUNTER is a name for a special register
generated by the presence of a LINAGE clause in a file description entry
for a record sequential file. The implicit description is that of an
unsigned integer whose size is equal to integer-1 or the data item
referenced by data-name-1 in the LINAGE clause.
The LINAGE Clause
Function.
The LINAGE clause allows the user to specify the depth of a logical page
in terms of number of lines. The user can also specify the size of the
top and bottom margins on the logical page, and the line number, within
the page body, at which the footing area begins.
It can be specified only for files with record sequential organization.
General Format.
Syntax Rules.
1. Data-name-1, data-name-2, data-name-3 and data-name-4 must
reference elementary unsigned numeric integer data items.
2. The value of integer-1 must be greater than zero.
3. The value of integer-2 must not be greater than integer-1.
4. The value of integer-3 and integer-4 can be zero.
General Rules.
1. The LINAGE clause allows the user to specify the size of a logical
page in terms of number of lines. The logical page size is the
sum of the values referenced by each phrase except the FOOTING
phrase. If the FOOTINGphrase is not specified, the values for
these functions are zero and no end-of-page condition independent
of the page overflow condition exists.
There is not necessarily any relationship between the size of the
logical page and the size of a physical page.
2. The value of integer-1 or the data item referenced by data-name-1
specifies the number of lines that can be written and/or spaced on
the logical page. The value must be greater than zero. That part
of the logical page in which these linesan be written and/or
spaced is called the page body.
3. The value of integer-2 or the data item referenced by data-name-2
specifies the line number within the page body at which the
footing area begins. The value must be greater than zero and not
greater than the value of integer-1 or the data item referenced by
data-name-1.
The footing area comprises the area of the logical page between
the line represented by the value of integer-2 of the data item
referenced by data-name-2, and the line represented by the value
of integer-1 or the data item referenced by data-name-1,
inclusive.
4. The value of integer-3 or the data item referenced by data-name-3
specifies the number of lines that comprise the top margin on the
logical page. The value can be zero.
The value of integer-4 or the data item referenced by data-name-4
specifies the number of lines that comprise the bottom margin on
the logical page. The value can be zero.
5. The value of integer-1, integer-3, and integer-4, if specified,
will be used at the time the file is opened by the execution of an
OPEN statement with the OUTPUT phrase, to specify the number of
lines that comprise each of the indicated sections of a logical
page. The value of integer-2, if specified, will be used at that
time to define the footing area. These values are used for all
logical pages written for the file during a given execution of the
program.
6. The values of the data items referenced by data-name-1,
data-name-3, and data-name-4, if specified at the time an open
statement with the OUTPUT phrase is executed for the file, will be
used to specify the number of lines that are to comprise each of
the indicated sections for the first logical page.
The value of the data item referenced by data-name-2, if
specified, will be used at the time an OPEN statement with the
OUTPUT phrase is executed for the file to define the footing area
for the first logical page.
7. A LINAGE-COUNTER is generated by the presence of a LINAGE clause.
The value in the LINAGE-COUNTERat any one time represents the line
number at which the device is positioned within the current page
body. The rules governing the LINAGE-COUNTER are as follows:
a. A separate LINAGE-COUNTER is supplied for each file
described in the File Section whose file description entry
contains a LINAGE clause.
b. LINAGE-COUNTER can be referenced, but can not be modified,
by PROCEDURE DIVISION statements. Since more than one
LINAGE-COUNTER can exist in a program, the user must
qualify LINAGE-COUNTER by file-name when necessary.
8. Each logical page is contiguous to the next with no additional
spacing provided.
9. The values of the data items, at the time a WRITE statement with
the ADVANCING PAGE phrase is executed or page overflow condition
occurs (see the section The WRITE Statement later in this
chapter), will be used to specify the number of lines that are to
comprise each of the indicated sections for the next logical page.
10. The value of the data item referenced by data-name-2, if
specified, will be used at the time a WRITE statement with the
ADVANCING PAGE phrase is executed or a page overflow condition
occurs, to define the footing area for the next logical page.
11. LINAGE-COUNTER is automatically modified, according to the
following rules, during the execution of a WRITE statement to an
associated file:
* When the ADVANCING PAGE phrase of the WRITE statement is
specified, the LINAGE-COUNTER is automatically reset to
one.
* When the ADVANCING identifier-2 or integer phrase of the
WRITE statement is specified, the LINAGE-COUNTER is
incremented by integer or the value of the data item
referenced by identifier-2.
* When the ADVANCING phrase of the WRITE statement is not
specified, the LINAGE-COUNTER is incremented by the value
one. (See the section The WRITE Statement later in this
chapter.)
* The value of LINAGE-COUNTERis automatically reset to one
when the device is repositioned to the first line that can
be written on for each of the succeeding logical pages.
(See the section The WRITE Statement later in this
chapter.)
12. The value of LINAGE-COUNTER is automatically set to one when an
OPEN statement is executed for the associated file.
The OCCURS Clause
Function.
The OCCURS clause eliminates the need for separate entries for repeated
data items and supplies information required for the application of
subscripts or indices.
General Formats.
Format 1.
Format 2.
Directives.
1. In addition to system directives which provide flagging and modify
the reserved word list, the following directives may impact either
the syntax or semantics described in this section. See your COBOL
System Reference For details.
* ODOOSVS - requests OS/VS COBOL compatible processing of the
OCCURS DEPENDING ON clause.
* ODOSLIDE - controls the processing of nested OCCURS
DEPENDING ON clauses and fixed data following an OCCURS
DEPENDING ON clause.
Syntax Rules.
1. Where both integer-1 and integer-2 are used, integer-1 must be
greater than, or equal to (ANS85)(OSVS), zero and integer-2 must
be greater than or equal to (OSVS)integer-1.
For OSVS, VSC2 and MF only: In Format 2, if "integer-1 TO" is
omitted, the default value one is assumed.
2. The data description of data-name-1 must describe a positive
integer.
3. Data-name-1, data-name-2, data-name-3,...can be qualified.
4. Data-name-2 must be either the name of the entry containing the
OCCURS clause or the name of an entry subordinate to the entry
containing the OCCURS clause.
5. Data-name-3, and so on, must be the name of an entry subordinate
to the group item which is the subject of this entry.
6. An INDEXED BYphrase is required if the subject of this entry, or
an entry subordinate to this entry, is to be referred to by
indexing, unless it is to be indexed by an index defined for
another table (see the section Indexing in the chapter Concepts of
the COBOL Language). (OSVS and VSC2)
The index-name identified by this clause is not defined elsewhere,
and not being data, cannot be associated with any data hierarchy.
7. A data description entry that contains Format 2 of the
OCCURSclause should only be followed, within that record
description, by data description entries which are subordinate to
it.
For OSVS and VSC2 only: A data description entry that contains
Format 2 of the OCCURS clause can be followed, within that record
description, by data description entries which are not subordinate
to it. The positions of these entries within the record will vary
at run time with the value of the data item referenced in the
DEPENDING ON clause
For OSVS, MF and VSC2 only: unless the NOODOSLIDE system
directive is set. In this case, the containing record is
considered as always containing the maximum number of occurrences
of the Format 2 item, irrespective of the value of data-name-1.
If the ODOSLIDE
directiveis,
For OSVS and VSC2 only: when the value of data-name-1 is changed,
the position referenced by identifiers following, but not
subordinate to, the table is changed. The data these items
contain can be lost.
8. The OCCURS clause cannot be specified in a data description entry
that:
a. has 66or 88level-number
b. describes an item whose size is variable. The size of an
item is variable if the data description of any subordinate
item contains Format 2 of the OCCURS clause.
For OSVS and VSC2 only: An OCCURS clause can be specified
for a data description subordinate to another item with a
Format 2 OCCURS clause.
9. The OCCURS clause should not be specified in a data description
entry at the 01level or as a 77level-number.
For MF only: This restriction is removed.
10. In Format 2, the data item defined by data-name-1 must not occupy
a character position within the range of the first character
position defined by the data description entry containing the
OCCURS clause and the last character position defined by the
record description entry containing that OCCURS clause.
If the ODOSLIDE system directive is set, data-name-1 must have a
fixed location.
11. If data-name-2 is not the subject of this entry, then:
a. all of the items identified by the data-names in the KEY IS
phrase must be within the group item which is the subject
of this entry
b. items identified by the data-name in the KEY IS phrase must
not contain an OCCURS clause
c. there must not be any entry that contains an OCCURS clause
between the items identified by the data-names in the KEY
ISphrase and the subject of this entry.
12. Index-name-1, index-name-2,...must be unique words within the
program.
For OSVS only: Index-name-1, index-name-2,...need not be unique
and can be qualified by the data-name which is the subject of this
entry.
13. For OSVS, MF and VSC2 only: The OCCURSclause can be specified for
external or internal floating-point data items.
General Rules.
1. The OCCURS clause is used in defining tablesand other homogenous
sets of repeated data items. Whenever the OCCURS clause is used,
the data-name which is the subject of this entry must be either
subscripted or indexed whenever it is referred to in a statement
other than SEARCH , SORT (MF), or USE FOR DEBUGGING. Further, if
the subject of this entry is the name of a group item, then all
data-names belonging to the group must be subscripted or indexed
whenever they are used as operands, except as the object of a
REDEFINES clause. (See the sections Subscripting, Indexing and
Identifier in the chapter Concepts of the COBOL Language.)
2. Except for the OCCURS clause itself, all data description clauses
associated with an item whose description includes an OCCURS
clause apply to each occurrence of the item described. (See the
restriction in general rule 20 under Data Description Entries
Other Than Condition-Names (and Constant-Names) (MF).)
3. Data-name-1 must have a fixed location, and must not follow an
item that contains an OCCURS DEPENDING ON clause.
4. The numberof occurrencesof the subject entry is defined as
follows:
a. In Format 1, the value of integer-2 represents the exact
number of occurrences.
b. In Format 2, the current value of the data item referenced
by data-name-1 represents the number of occurrences.
This format specifies that the subject of this entry has a
variable number of occurrences. The value of integer-2
represents the maximum number of occurrences and the value
of integer-1 represents the minimum number of occurrences.
This does not imply that the length of the subject of the
entry is variable, but that the number of occurrences is
variable.
The value of the data item referenced by data-name-1 must
fall within the range of integer-1 through integer-2.
Reducing the value of this data item makes the contents of
data items, whose occurrence numbers now exceed the value
of the data item referenced by data-name-1, unpredictable.
5. For ANS85 only: When a group item, having subordinate to it an
entry that specifies Format 2 of the OCCURSclause, is referenced,
the part of the table areaused in the operation is determined as
follows :
a. If the data item referenced by data-name-1 is outside the
group, only that part of the table area that is specified
by the value of the data item referenced by data-name-1 at
the start of the operation will be used.
b. If the data item referenced by data-name-1 is included in
the same group and the group data item is referenced as a
sending item, only that part of the table area that is
specified by the value of the data item referenced by
data-name-1 at the start of the operation will be used in
the operation. If the group is a receiving item, the
maximum length of the group will be used.
6. The KEY IS phrase is used to indicate that the repeated data is
arranged in ascendingor descending order according to the values
contained in data-name-2, data-name-3, and so on. The ascending
or descending order is determined according to the rules for
comparison of operands (see the sections Comparison of Numeric
Operands and Comparison of Nonnumeric Operands). The data-names
are listed in their descending order of significance.
The PICTURE Clause
Function.
The PICTURE clause describes the general characteristics and editing
requirements of an elementary item.
General Format.
Syntax Rules.
1. A PICTUREclause can be specified only at the elementary item
level.
2. A character-string consists of certain allowable combinations of
characters in the COBOL character set used as symbols. The
allowable combinations determine the category of the elementary
item.
3. The maximum number of characters allowed in the character- string
is 30.
4. The PICTURE clause must be specified for every elementary item
except an index data item pointer (VSC2)(MF) or internal
floating-point data item (OSVS)(VSC2)(MF) or the subject of a
RENAMES clause, in which case use of this clause is prohibited.
5. PIC is an abbreviation for PICTURE.
6. The asterisk when used as the zero suppression symbol and the
clause BLANK WHEN ZERO should not appear in the same entry.
For OSVS only: This construct is, however, permitted, in which
case zero suppression overrides the BLANK WHEN ZERO clause.
7. An integer in parentheses following a character indicates that the
character is repeated the number of times shown by the integer.
General Rules.
There are six categories of data that can be described with a PICTURE
clause: alphabetic, numeric, alphanumeric, alphanumeric edited, numeric
edited, and external floating-point (OSVS)(VSC2)(MF). General rules
within these categories are given below:
Alphabetic Data Rules.
1. Its PICTURE character-string can only contain the symbols "A" and
"B".
For ANS85 only: Its PICTURE character-string can contain only the
symbol "A".
2. Its contents when represented in standard data format must be one
or more alphabetic characters.
Numeric Data Rules.
1. Its PICTURE character-string can contain only the symbols "9",
"P", "S", and "V". The number of digit positions that can be
described by the PICTURE character-string must range from 1 to 18
inclusive.
2. If unsigned, the data in standard data format must be a
combination of the Arabic numerals "0", "1", "2", "3", "4", "5",
"6", "7", "8", and "9" ; if signed, the item can also contain a
"+", "-", or other representation of an operational sign. (See
the section The SIGN Clause later in this chapter.)
Numeric Data can also be held in formats other than standard data format
(see the section The USAGE Clause later in this chapter and the section
Selection Of Character Representation And Radix in the chapter Concepts
of the COBOL Language).
Alphanumeric Data Rules.
1. Its PICTURE character-string is restricted to certain combinations
of the symbols "A", "X", "9" , and the item is treated as if the
character-string contained all X "s. A PICTURE character-string
which contains all A"s or all 9"s does not define an alphanumeric
item.
2. Its contents when represented in standard data format can consist
of any characters in the computer's character set.
Alphanumeric Edited Data Rules.
1. Its PICTURE character-string is restricted to certain combinations
of the following symbols: "A", "X", "9", "B", "0", and "/" as
follows:
a. The character-string must contain at least one "B" and at
least one "X" or at least one "0" (zero) and at least one
"X" or at least one "/" (slash) and at least one "X", or:
b. The character-string must contain at least one "0" (zero)
and at least one "A" or at least one "/" (slant) and at
least one "A".
2. Its contents when represented in standard data format can consist
of any characters in the computer's set.
Numeric Edited Data Rules.
1. Its PICTURE character-string is restricted to certain combinations
of the symbols "B", "/", "P", "V" , "Z", "0", "9", ",", "." , "*",
"+", "-", "CR", "DB", and the currency symbol. The allowable
combinations are determined from the order of precedence of
symbols and the editing rules as follows:
a. The number of digit positions that can be represented in
the PICTURE character-string must range from 1 to 18
inclusive.
b. The character-string must contain at least one "0" , "B",
"/", "Z", "*", "+", ",", ".", "-", "CR" , "DB", or currency
symbol.
2. The contents of the character positions represent a digit must be
one of the numerals.
3. If all numeric edited character positions in the PICTURE
character-string are represented by an insertion character, at
least one of the insertion characters must be positioned to the
left of the decimal point.
For OSVS, VSC2 and MF only: External Floating-point Data Items.
1. The PICTURE string must have the following form:
A sign character must immediately precede both the mantissa and
the exponent.
A "+ " sign indicates that a positive sign will be used in the
output to represent positive values and that a negative sign will
represent negative values.
A "- "sign indicates that a blank will be used in the output to
represent positive values and that a negative sign will represent
negative values.
Each sign position occupies one byte of storage.
mantissa
The mantissa can contain the symbols:
9 . V
An actual decimal point can be represented with a period while an
assumed decimal point is represented by a V. Either an actual or an
assumed decimal point must be present in the mantissa; the decimal
point can be leading, embedded or trailing. The mantissa can
contain from 1 to 16 numeric characters.
E
Indicates the exponent.
exponent
The exponent must be a PIC "99".
2. The OCCURS, REDEFINES and RENAMES clauses can be associated with
external floating-point items.
3. The SIGN clause is documentary only and has no effect on the
representation of the sign.
4. The SYNCHRONIZED clause is documentary only.
5. The following clauses are invalid with external floating-point
items:
BLANK WHEN ZERO
JUSTIFIED
VALUE
MPE/iX 5.0 Documentation