![]() | Data Division | Data Division - Screen Section | ![]() |
A data description entry specifies the characteristics of a particular item of data
or the characteristics of a
programmer-defined type of data which can then be used to specify the
description of one or more particular items of data.
A level 01 data description
entry within the
Working-Storage Section or File Section determines whether the data
record and its subordinate data items have local names or global names.
A level 01 data description
in the Working-Storage Section determines the internal or external
attribute of the data record and its subordinate data items.
, if specified,
must immediately follow the level-number; the REDEFINES clause, when used, must immediately follow the data-name-1 or FILLER clause
if either is specified;
otherwise it must immediately follow the level number.
an
object reference,
a procedure
pointer,
a pointer
COMPUTATIONAL-1, COMPUTATIONAL-2,
FLOAT-SHORT or FLOAT-LONG in which case use of this clause is prohibited.
The EXTERNAL clause can be
specified only in data description entries in the Working-Storage
Section whose level-number is 01.
The
EXTERNAL clause and the REDEFINES clause must not be specified in
the same data description entry.
The
GLOBAL clause can be specified only in data description entries
whose level-number is 01.
Data-name-1 must be
specified for any entry containing the GLOBAL or EXTERNAL clause, or for
record descriptions associated with a file description entry which
contains the EXTERNAL or GLOBAL clause.
The TYPEDEF clause can only
be specified in data description entries whose level-number is 01.
The TYPEDEF clause can only
be used when data-name-1 is also specified. In other words, it cannot be
used in the same data description with either an explicit or implicit
FILLER clause.
Note that if the TYPEDEF
clause is specified for a group item, subordinate data descriptions
can be defined with either an implicit or explicit FILLER clause.
The SYNCHRONIZED clause
can be specified for a group item.
Literal-5 and integer-1
must not be floating-point values, must not be negative values
and must not be more than 18 digits.
Data-name-2 and
data-name-3 can be implicitly qualified.
The VALUE clause must not be specified
for data items of class index, object, or pointer.
Condition-names can be
associated with internal floating-point items.
Condition-names can be
associated with external floating-point items.
Format 4 defines a
constant-name, which is a symbolic name representing a constant value
assigned to it when the source code is passed through your COBOL system.
Your COBOL system replaces each reference to a constant-name by its
value.
The TYPEDEF clause allows
you to declare a group or elementary data description as a type
definition, which allows instances of that data description to be
declared as data items using data-name-1 as typedef-name-1 in the USAGE
clause. The type definition itself is not a data item with allocated
storage.
If the TYPEDEF clause is
specified at a group level, the components of the type definition are
implicitly declared for any data item of that type and are referenced
using the usual COBOL rules of qualification for the data item. The BLANK WHEN ZERO clause permits the blanking of an item when its value is zero.
This construct is,
however, permitted in which case, zero suppression overrides the BLANK
WHEN ZERO clause.
The BLOCK CONTAINS clause specifies the size of a physical record.
Although it is a part of the
standard COBOL definition, this feature is explicitly excluded from the
X/Open COBOL language definitions and should not be used in a conforming
X/Open COBOL source program.
This clause is documentary
only. The CODE-SET clause specifies the character code set used to represent data on the external media.
It can be specified only for files with record sequential
and line sequential
organization.
Although it is a part of the
standard COBOL definition, this feature is explicitly excluded from the
X/Open COBOL language definitions and should not be used in a conforming
X/Open COBOL source program.
These restrictions do not
apply.
These restrictions do not
apply.
Identifier-1 can be
qualified, but must not be subscripted.
Each identifier-1 must be a
data item described in the same record description for the file, and
must not itself be a record description.
If the optional FOR phrase
is specified, the CODE-SET clause specifies the character code to be
used for the data items named. If the FOR phrase is not specified, the
CODE-SET clause specifies the character code to be used for the whole
file.
The data in the record area
is always in ASCII. If alphabet-name has been equated in the
Special-Names paragraph to EBCDIC, then data affected by the CODE-SET
clause is translated from ASCII to EDCDIC as it is written to the file;
or from EBCDIC to ASCII as it is read from the file. If alphabet-name
has been equated in the Special-Names paragraph to STANDARD-1,
STANDARD-2, NATIVE, or ASCII, no translation is necessary.
For the purposes of this
translation, any data item to which a
CODE-SET clause applies is treated as alphanumeric. No account is
taken of the class and category of the item as described in its data
description.
If identifier-1 has an
OCCURS clause, the CODE-SET clause applies to only the first occurrence
of it. If identifier-1 has a subordinate item with an OCCURS clause, the
CODE-SET clause applies to the whole of identifier-1. The DATA RECORDS clause serves only as documentation for the names of data records with their associated file.
The DATA RECORDS clause of
the file description entry is classed as an obsolete element in the
ANSI'85 standard and is scheduled to be deleted from the next full
revision of the ANSI Standard.
All dialects in this COBOL
implementation fully support this syntax. The FLAGSTD Compiler directive
can be used to detect all occurrences of this syntax.
Although part of the standard
COBOL definition, this feature is explicitly excluded from the X/Open
COBOL language definitions and should not be used in a conforming X/Open
COBOL source program.
These data-names do not
have to be associated with any data description entry in the program.
Note: When using multiple 01 level items within an FD, if the SELECT statement contains key definitions, the key sizes must be contained within the minimum record length of that FD.
A data-name specifies the name of the data being described. The word FILLER can be used to specify an elementary item of the logical record that cannot be referred to explicitly.
, if specified,
must be the first word following the level-number in a data description entry.
If this clause is omitted,
the data item being described is treated as though FILLER had been
specified.
The EXTERNAL clause specifies that a data item or a file connector is external. The constituent data items and group items of an external data record are available to every runtime element in the run unit that describes that record.
Literal-1 must be a
nonnumeric or a national literal and
must not be a figurative constant.
The EXTERNAL clause must not be
specified for a data item of class object.
See your COBOL system
documentation on file handling for further information on files with the
EXTERNAL attribute.
Literal-1 identifies the
external name of an external data item or file connector. The same
external name must be used by all source
elements that reference the same external data item or file
connector.
The GLOBAL clause specifies that a data-name, a file-name, or a report-name is a global name. A global name is available to every program contained within the program which declares it.
The GLOBAL clause can
also be specified in the Linkage Section.
The JUSTIFIED clause specifies non-standard positioning of data within a receiving data item.
, or for a pointer data
item.
The JUSTIFIED clause
cannot be specified for external or internal floating-point data items.
The contents of the sending data item are not taken into account, that is, trailing spaces within the sending data item are not suppressed.
For example, if a data item PIC X(4) whose value is "A "
(that is, A followed by three spaces) is moved into a data item PIC
X(6) JUSTIFIED the result will be " A ".
If the same data item is moved to one with PIC X(3) JUSTIFIED the
result will be " " that is,
the leftmost character is truncated.
The LABEL RECORDS clause specifies whether labels are present.
The LABEL RECORDS clause is
classed as an obsolete element in the ANSI'85 standard and is scheduled to
be deleted from the next full revision of the ANSI Standard.
All dialects in this COBOL
implementation fully support this syntax. The FLAGSTD Compiler directive
can be used to detect all occurrences of this syntax.
Although it is a part of the
standard COBOL definition, this feature is explicitly excluded from the
X/Open COBOL language definitions and should not be used in a conforming
X/Open COBOL source program.
It is not required.
Data-name-1 is the name of
a label record and should have a 01 level-number record description,
with the same name, associated with it.
Data-name-1 must not
appear in the DATA RECORDS clause for the file.
Both LABEL RECORDS IS and
LABEL RECORD ARE are accepted as valid syntax.
This clause is documentary
only. The level-number shows the hierarchy of data within a logical record. In addition, it is used to identify entries for working-storage items, linkage items, condition-names
and the RENAMES clause.
,78
or 88. (See the section The FILE Description earlier in this chapter.)
, or 78
, Local-Storage
and Linkage Section must have level-numbers with the values 01 through 49, 66, 7 7
Level number 78 is
assigned to entries which define constant-names. It can be used only
as described in Format 4 of the data description skeleton earlier in
this chapter. 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 the size of integer-1 or the data item referenced by data-name-1 in the LINAGE clause.
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 sequential organization.
There is not necessarily any relationship between the size of the logical page and the size of a physical page.
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.
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.
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.
The OCCURS clause eliminates the need for separate entries for repeated data items and supplies information required for the application of subscripts or indices.
or equal to
zero and integer-2 must be greater than
or equal to
integer-1.
In Format 2, if "integer-1
TO" is omitted, the default value one is assumed.
This restriction is
removed.
This restriction is
removed.
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).
The index-name identified by this clause is not defined elsewhere, and not being data, cannot be associated with any data hierarchy.
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
unless the NOODOSLIDE
Compiler 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 Compiler dir
ective is set,
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.
An OCCURS clause can
be specified for a data description subordinate to another item
with a Format 2 OCCURS clause.
This restriction is
removed.
If the ODOSLIDE Compiler
directive is set, data-name-1 must have a fixed location.
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.
The
OCCURS clause can be specified for external or internal
floating-point data items.
The KEY clause must not be specified
for a data item of class object.
, SORT
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.)
and Constant-Names.)
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.
When a group item, having
subordinate to it an entry that specifies Format 2 of the
OCCURS clause, is referenced, the part of the table
area used in the operation is determined as follows:
The PICTURE clause describes the general characteristics and editing requirements of an elementary item.
This construct is,
however, permitted, in which case zero suppression overrides the BLANK
WHEN ZERO clause.
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
. General rules within these categories are given below:
Its PICTURE
character-string can contain only the symbol "A".
The PICTURE character-string can
contain up to 31 digit positions.
The PICTURE
character-string can contain up to 38 digit positions.
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).
The PICTURE character-string can
contain up to 31 digit positions.
The PICTURE
character-string can contain up to 38 digit positions.
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".
BLANK WHEN ZERO
JUSTIFIED
VALUE
The size of an elementary item, where size means the number of character positions occupied by the elementary item in standard data format, is determined by the number of allowable symbols that represent character positions. An integer which is enclosed in parentheses following the symbols "A", ",", "X" , "9", "P", "Z", "*", "B", "/", "0", "+", "", or the currency symbol indicates the number of replications of the symbol. Note that the following symbols can appear only once in a given PICTURE: "S" , "V", ".",
"E",
The functions of the symbols used to describe an elementary item are explained as follows:
Two general methods of performing editing in the PICTURE clause are available: insertion or suppression and replacement. Four types of insertion editing are available:
Two types of suppression and replacement editing are available:
The type of editing which can be performed upon an item is dependent upon the category to which the item belongs. Table 8-1 specifies which type of editing can be performed upon a given category.
Table 8-1: Editing Types For Data Categories
| Category | Type of Editing |
|---|---|
| Alphabetic | Simple insertion "B" only 1 |
| Numeric | None |
| Alphanumeric | None |
| Alphanumeric Edited | Simple insertion "0", "B" and "/" |
| Numeric Edited | All 2 |
| DBCS | Simple insertion |
| External floating-point | Special insertion |
Notes:
In the ANSI'74 standard,
PICTURE clauses containing both "A" and "B" are
treated as simple insertion in category Alphabetic. As the ANSI'85
standard does not support "B" in the Alphabetic category, the
ANSI'85 standard considers this PICTURE as simple insertion in the
Alphanumeric Edited category.
The "," (comma), "B" (space), "0" (zero), and " /" (slash) are used as the insertion characters. The insertion characters are counted in the size of the item and represent the position in the item into which the character will be inserted.
This type of editing is
valid for either numeric edited items or external floating-point items.
The "." (period) is used as the insertion character. In addition to being an insertion character it represents the decimal point for alignment purposes. The insertion character used for the actual decimal point is counted in the size of the item. The use of the assumed decimal point, represented by the symbol "V" and the actual decimal point, represented by the insertion character, in the same PICTURE character-string is disallowed. The result of special insertion editing is the appearance of the insertion character in the item in the same position as shown in the character-string.
The currency symbol and the editing sign control symbols "+" , "", "CR", "DB" are the insertion characters. Only one currency symbol and only one of the editing sign control symbols can be used in a given PICTURE character-string. When the symbols "CR" or "DB" are used, they represent two character positions in determining the size of the item and they must represent the rightmost character positions that are counted in the size of the item. The symbol "+" or "", when used, must be either the leftmost or rightmost character position to be counted in the size of the item. The currency symbol must be the leftmost character.
Table 8-2 : Editing Symbols in PICTURE Character-Strings
| Editing Symbol in Picture Character-string | Result | |
|---|---|---|
| Data Item Positive or Zero | Data Item Negative | |
| + | + | |
| | space | |
| CR | 2 spaces | CR |
| DB | 2 spaces | DB |
The currency symbol and the editing sign control symbols "+" and "" are the floating insertion characters and as such are mutually exclusive in a given PICTURE character-string.
Floating insertion editing is indicated in a PICTURE character-string by using a string of at least two of the floating insertion characters. This string of floating insertion characters can contain any of the simple insertion characters or have simple insertion characters immediately to the right of this string. These simple insertion characters are part of the floating string.
When the floating insertion character is the currency symbol, this string of floating insertion characters can have one of the editing sign control symbols "+", "", "CR" or " DB" immediately to the right of this string.
The leftmost character of the floating insertion string represents the leftmost limit of the floating symbol in the data item. The rightmost character of the floating string represents the rightmost limit of the floating symbols in the data item.
The second floating character from the left represents the leftmost limit of the numeric data that can be stored in the data item. Non-zero numeric data can replace all the characters at or to the right of this limit.
Floating insertion editing can be represented in a PICTURE character-string in only two ways. One way is to represent any or all of the leading numeric character positions on the left of the decimal point by the insertion character. The other way is to represent all of the numeric character positions in the PICTURE character-string by the insertion character.
If the insertion characters are only to the left of the decimal point in the PICTURE character-string, the result is that a single floating insertion character will be placed into the character position immediately preceding either the decimal point or the first non-zero digit in the data represented by the insertion symbol string, whichever is farther to the left in the PICTURE character-string. The character positions preceding the insertion character are replaced with spaces.
If all numeric character positions in the PICTURE character-string are represented by the insertion character, the result depends upon the value of the data. If the value is zero, the entire data item will contain spaces. If the value is not zero, the result is the same as when the insertion character is only to the left of the decimal point.
If all numeric positions in
the PICTURE character string are represented by the insertion character,
at least one numeric position must be to the left of the assumed or actual
decimal point.
To avoid truncation, the minimum size of the PICTURE character-string for the receiving data item must be the number of characters in the sending data item, plus the number of non-floating insertion characters being edited into the receiving data item, plus one for the floating insertion character.
The suppression of leading zeros in numeric character positions is indicated by the use of the alphabetic character "Z" or the character "*" (asterisk) as suppression symbols in a PICTURE character- string. These symbols are mutually exclusive in a given PICTURE character-string. Each suppression symbol is counted in determining the size of the item. If "Z" is used, the replacement character will be the space and if the asterisk is used, the replacement character will be "*".
Zero suppression and replacement is indicated in a PICTURE character-string by using a string of one or more of the allowable symbols to represent leading numeric character positions which are to be replaced when the associated character position in the data contains a zero. Any of the simple insertion characters embedded in the string of symbols or to the immediate right of this string are part of the string.
Zero suppression can be represented in a PICTURE character-string in only two ways. One way is to represent any or all of the leading numeric character positions to the left of the decimal point by suppression symbols. The other way is to represent all of the numeric character positions in the PICTURE character-string by suppression symbols.
If the suppression symbols appear only to the left of the decimal point, any leading zero in the data which corresponds to a symbol in the string is replaced by the replacement character. Suppression terminates at the first non-zero digit in the data represented by the suppression symbol string or at the decimal point, whichever is encountered first.
If all numeric character positions in the PICTURE character-string are represented by suppression symbols and the value of the data is not zero, the result is the same as if the suppression characters were only to the left of the decimal point. If the value is zero and the suppression symbol is "Z", the entire data item will be spaces. If the value is zero and the suppression symbol is "*", the data item will be all "*" except for the actual decimal point.
The symbols "+", "", "*", " Z" and the currency symbol, when used as floating replacement characters, are mutually exclusive within a given character-string.
Table 8-3 shows the order of precedence when using characters as symbols in a character-string. An "X" at an intersection indicates that the symbol(s) at the top of the column can precede, in a given character-string, the symbol(s) at the left of the row. Arguments appearing in braces indicate that the symbols are mutually exclusive. The currency symbol is indicated by the symbol "cs". At least one of the symbols "A " , "X", "Z", " 9" or "*", or at least two of the symbols "+" , "" or "cs" must be present in a PICTURE string.
In Table 8-3, non-floating insertion symbols "+" and "" , floating insertion symbols "Z", "*", " +", "", and "cs", and other symbol "P" appear twice in the PICTURE character precedence chart. The leftmost column and uppermost row for each symbol represents its use to the left of the decimal point position. The second appearance of symbol in the row and column represents its use to the right of the decimal point position.
Table 8-3: PICTURE Character Precedence Chart
| First Symbol | Non-Floating Insertion Symbols | Floating Insertion Symbols | Other Symbols | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Second Symbol | B | 0 | / | , | . | + |
+ |
CR DB |
CS | E | Z * |
Z * |
+ |
+ |
CS | CS | 9 | A X |
S | V | P | P | G | |
| Non-Floating Insertion Symbols | B | x | x | x | x | x | x | x | x | x | x | x | x | x | x | x | x | x | x | |||||
| 0 | x | x | x | x | x | x | x | x | x | x | x | x | x | x | x | x | x | |||||||
| / | x | x | x | x | x | x | x | x | x | x | x | x | x | x | x | x | x | |||||||
| , | x | x | x | x | x | x | x | x | x | x | x | x | x | x | x | x | ||||||||
| . | x | x | x | x | x | x | x | x | x | x | ||||||||||||||
| + |
||||||||||||||||||||||||
| + |
x | x | x | x | x | x | x | x | x | x | x | x | x | x | x | |||||||||
| CR DB |
x | x | x | x | x | x | x | x | x | x | x | x | x | x | ||||||||||
| CS | x | |||||||||||||||||||||||
| E | x | x | x | x | ||||||||||||||||||||
| Floating Insertion Symbols | Z * |
x | x | x | x | x | x | x | ||||||||||||||||
| Z * |
x | x | x | x | x | x | x | x | x | x | x | |||||||||||||
| + |
x | x | x | x | x | x | ||||||||||||||||||
| + |
x | x | x | x | x | x | x | x | x | |||||||||||||||
| CS | x | x | x | x | x | x | ||||||||||||||||||
| CS | x | x | x | x | x | x | x | x | x | |||||||||||||||
| Other Symbols | 9 | x | x | x | x | x | x | x | x | x | x | x | x | x | x | x | x | |||||||
| A X |
x | x | x | x | x | |||||||||||||||||||
| S | ||||||||||||||||||||||||
| V | x | x | x | x | x | x | x | x | x | x | x | x | ||||||||||||
| P | x | x | x | x | x | x | x | x | x | x | x | x | ||||||||||||
| P | x | x | x | x | x | |||||||||||||||||||
| G | x | x | ||||||||||||||||||||||
The
PROPERTY clause indicates that this data item is a property of the
object and that GET and/or SET methods are to be generated accordingly.
Note: A property-name may be defined in a superclass either by defining a method or a pair of methods with the PROPERTY phrase or by describing a data description entry with the PROPERTY clause.
If the subject of this entry is of class index, object, or pointer, the implicit definition of this method is as follows:
METHOD-ID. GET PROPERTY data-name. DATA DIVISION. LINKAGE SECTION. 01 LS-data-name data-description. PROCEDURE DIVISION RETURNING LS-data-name. par-name. SET LS-data-name TO data-name EXIT METHOD. END METHOD.
If the subject of this entry is of category alphanumeric-edited, national-edited, or numeric-edited, the implicit definition of this method is as follows:
METHOD-ID. GET PROPERTY data-name. DATA DIVISION. LINKAGE SECTION. 01 LS-data-name data-description. PROCEDURE DIVISION RETURNING LS-data-name. par-name. MOVE data-name TO LS-data-name (1:). EXIT METHOD. END METHOD.
Note: If the subject of the entry is edited, reference modification of the receiving item as the whole of itself prevents the editing rules from being reapplied to the data.
Otherwise, the implicit definition of this method is as follows:
METHOD-ID. GET PROPERTY data-name. DATA DIVISION. LINKAGE SECTION. 01 LS-data-name data-description. PROCEDURE DIVISION RETURNING LS-data-name. par-name. MOVE data-name TO LS-data-name EXIT METHOD. END METHOD.
Where LS-data-name has the data description of the subject of the entry, including its subordinate items, with the exception of:
If the subject of this entry is of class index, object, or pointer, the implicit definition of this method is as follows:
METHOD-ID. SET PROPERTY data-name. DATA DIVISION. LINKAGE SECTION. 01 LS-data-name data-description. PROCEDURE DIVISION USING LS-data-name. par-name. SET data-name TO LS-data-name EXIT METHOD. END METHOD.
If the subject of this entry is of category alphanumeric-edited, national-edited, or numeric-edited, the implicit definition of this method is as follows:
METHOD-ID. SET PROPERTY data-name. DATA DIVISION. LINKAGE SECTION. 01 LS-data-name data-description. PROCEDURE DIVISION USING LS-data-name. par-name. MOVE LS-data-name TO data-name (1:). EXIT METHOD. END METHOD.
Note: If the subject of the entry is edited, reference modification of the receiving item as the whole of itself prevents the editing rules from being reapplied to the data.
Otherwise, the implicit definition of this method is as follows:
METHOD-ID. SET PROPERTY data-name. DATA DIVISION. LINKAGE SECTION. 01 LS-data-name data-description. PROCEDURE DIVISION USING LS-data-name. par-name. MOVE LS-data-name TO data-name EXIT METHOD. END METHOD.
Where LS-data-name has the data description of the subject of the entry, including its subordinate items, with the exception of:
The RECORD clause specifies
either the number of character positions in a fixed length record or the
range of character positions in a variable length record. If the number of
character positions varies, the clause specifies the minimum and maximum
number of character positions.
The concepts of
FIXED and
VARIABLE
format files used throughout this section do not directly apply to
LINE SEQUENTIAL files. See your COBOL system documentation on file
handling for details on the implications of using LINE SEQUENTIAL files in
your COBOL implementation.
Although it is a part of the
standard COBOL definition, the RECORD CONTAINS clause is explicitly
excluded from the X/Open COBOL language definitions and should not be used
in a conforming X/Open COBOL source program.
Record descriptions for the file must not describe records which
contain fewer character positions than specified by integer-2, nor
records which contain a greater number of character positions than that
specified by integer-3.
Integer-3 must be greater
than integer-2.
Data-name-1 must describe
an elementary unsigned integer in the Working-Storage or Linkage
Section.
If the associated file
connector is an external file connector, all file description entries in
the run unit which are associated with that file connector must specify
the same values for integer-1 or integer-2 and integer-3. If the RECORD
clause is not specified, all record description entries associated with
this file connector must be the same length.
Line sequential files are
neither truly fixed nor truly variable format files: the presence or
absence of any RECORDING MODE, RECORD CONTAINS or RECORD VARYING IN SIZE
clause does not, therefore, impact their performance.
Format 2 is used to specify
variable length records. Integer-2 specifies the minimum number of
character positions to be contained in any record of the file. Integer-3
specifies the maximum number of character positions in any record of the
file.
The number of character
positions associated with a record description is determined by the sum
of the number of character positions in all elementary data items
excluding redefinitions and renamings, plus any implicit FILLER due to
synchronization. If a table is specified:
If integer-3 is not
specified, the maximum number of character positions to be contained in
any record of the file is equal to the greatest number of character
positions described for a record in that file.
If data-name-1 is
specified, the number of character positions in the record must be
placed into the data item referenced by data-name-1 before any RELEASE,
REWRITE, or WRITE statement is executed for the file.
If data-name-1 is
specified, the execution of a DELETE, RELEASE, REWRITE, START, or WRITE
statement or the unsuccessful execution of a READ or RETURN statement
does not alter the content of the data item referenced by data-name-1.
During the execution of a
RELEASE, REWRITE, or WRITE statement, the number of character positions
in the record is determined by the following conditions:
If the number of character positions in the logical record which is to be written is less than integer-2 or greater than integer-3, the output statement is unsuccessful and, except during execution of a RELEASE statement, the associated I/O status is set to a value indicating the cause of the condition.
If data-name-1 is
specified, after the successful execution of a READ or RETURN statement
for the file, the contents of the data item referenced by data-name-1
will indicate the number of character positions in the record just read.
If the INTO phrase is
specified in the READ or RETURN statement, the number of character
positions in the current record that participate as the sending data
items in the implicit MOVE statement is determined by the following
conditions: a.
The RECORDING MODE clause specifies the format of the logical records in the file.
F and FIXED are synonyms.
V and VARIABLE are
synonyms.
The "U" option is
documentary only.
Line sequential files are
neither truly fixed nor truly variable format files: the presence or
absence of any RECORDING MODE, RECORD CONTAINS or RECORD VARYING IN SIZE
clause does not, therefore, impact their performance. The REDEFINES clause allows the same computer storage area to be described by different data description entries.
Note that level-number and data-name-1
or FILLER
are shown in the above format to improve clarity. Level-number, and data-name-1
and FILLER
are not part of the REDEFINES clause.
or FILLER,
or it can follow the
PICTURE or USAGE clause.
78
or 88.
This clause can be used
on level 01 entries in the File Section.
The data description for
data-name-2 can contain a REDEFINES clause and
data-name-2 can be subordinate to an entry which contains a REDEFINES clause. Its data description cannot contain an OCCURS clause. However, data-name-2 can be subordinate to an item whose data description entry contains an OCCURS clause. In this case, the reference to data-name-2 in the REDEFINES clause cannot be subscripted or indexed. Neither the original definition nor the redefinition can include an item whose size is variable as defined in the OCCURS clause. (See the section The OCCURS Clause in this chapter.)
The data description for
data-name-2 can contain an OCCURS clause.
If the level number is
01, either or both of the original definition and the redefinition can
include an item whose size is variable as defined in the OCCURS
clause.
An external or internal
floating-point data item can be the subject or object of a REDEFINES
clause.
Data-name-2 must not be
qualified even if it is not unique since no ambiguity of reference
exists in this case because of the required placement of the REDEFINES
clause
.
Data-name-2 may be
qualified but any qualification specified is ignored.
The REDEFINES clause must not be
specified for a data item of class object.
The REDEFINES clause may
be specified for a data item of class object.
Data-name-2 must not be of class
object.
Data-name-2 may be of
class object.
except that the
data-name-1 area can be either smaller than the data-name-2 area
or be larger than the
data-name-2 area. In this case, extra storage is reserved to provide
sufficient storage for the number of character positions in the
largest of the redefining or redefined items.
It is important to observe that the REDEFINES clause specifies the redefinition of a storage area, not of the data items occupying the area.
or the data-name of any
other preceding redefinition of that entry.
The RENAMES clause permits alternative, possibly overlapping, groupings of elementary items.
Level-number 66 and data-name-1 are shown in the above format to improve clarity. Level-number and data-name-1 are not part of the RENAMES clause.
78,
88, or 01 entry.
When data-name-2 and
data-name-3 are not explicitly qualified and when no ambiguity of
reference exists, implied qualification of the 01 level item is used.
The SIGN clause specifies the position and the mode of representation of the operational sign when it is necessary to describe these properties explicitly.
This rule is removed.
This restriction is not
enforced. See the section The CODE-SET Clause in this chapter.
If a SIGN clause is
specified for an item (either an elementary numeric data description
entry or a group item) which is subordinate to a group item for which a
SIGN clause is also specified, then the SIGN clause specified in the
subordinate item takes precedence.
The SIGN clause is
treated as documentary for external floating-point items. For internal
floating-point items, the SIGN clause is invalid and will result in a
diagnostic message. The SYNCHRONIZED clause specifies the alignment of an elementary item on the natural boundaries of the computer memory.
Although it is a part of the
standard COBOL definition, this feature is explicitly excluded from the
X/Open COBOL language definitions and should not be used in a conforming
X/Open COBOL source program.
The SYNCHRONIZED clause
can appear with a non-elementary item.
It takes effect only if the IBMCOMP Compiler directive is set.
If the number of character positions required to store this data item is less than the number of character positions between those natural boundaries, the unused character positions (or portions thereof) must not be used for any other data item. Such unused character positions are, however, included in:
Thus the size of an elementary item is unchanged by the SYNCHRONIZED clause, but extra character positions are assigned by the use of the clause.
If the SYNCHRONIZED clause
is specified with a non-elementary item, then the clause applies to all
the items subordinate to that non-elementary item.
The TYPEDEF clause defines a record as a programmer-defined type definition.
If the TYPEDEF clause is specified for a group item, then subordinate items can be specified with OCCURS or REDEFINES clauses.
The VALUE clause cannot be specified either in the data descriptions specifying the TYPEDEF clause or in any subordinate item except for condition-names (88 level entries) within the TYPEDEF structure.
The USAGE clause specifies the format of a data item in the computer storage.
, BINARY, PACKED-DECIMAL
, COMPUTATIONAL-3
, COMPUTATIONAL-4
, or COMPUTATIONAL-5
must be declared with a PICTURE character-string that describes a numeric item (i.e. a PICTURE character-string that contains only the symbols "P", "S", "V", and "9"). See the section The PICTURE Clause earlier in this chapter.
An elementary data item
whose declaration contains no USAGE clause and that is subordinate to
a group item whose declaration contains a USAGE clause specifying a
format from the list may be declared with a PICTURE character-string
that describes an alphabetic, alphanumeric, alphanumeric-edited or
numeric-edited data item.
An elementary data item
whose declaration contains, or an elementary data item subordinate to a
group item whose declaration contains, a USAGE clause specifying
COMPUTATIONAL-5
or COMPUTATIONAL-X
must be declared with a
picture character-string that describes a numeric item
or describes an
alphanumeric item with a size of between one and eight bytes
inclusive. If it describes an alphanumeric item of size 1, 2, 3, 4, 5,
6, 7, or 8 bytes, then this is equivalent to specifying an integer
item with 2, 4, 7, 9, 12, 14, 16 or 18 decimal digit positions
respectively.
When COMPUTATIONAL-X is
specified and the PICTURE character-string describes a numeric item,
then that item must be unsigned.
The SYNCHRONIZED clause
can be specified for data items whose usage is INDEX.
COMP-1 is an
abbreviation for COMPUTATIONAL-1.
COMP-2 is an abbreviation for COMPUTATIONAL-2.
COMP-3 is an
abbreviation for COMPUTATIONAL-3.
COMP-4 is an
abbreviation for COMPUTATIONAL-4.
COMP-5 is an
abbreviation for COMPUTATIONAL-5.
COMP-X is an
abbreviation for COMPUTATIONAL-X.
the USING statement of
an ENTRY statement,
or the USING phrase of a CALL statement.
A pointer
or procedure-pointer
item can be referenced
explicitly only in a SET statement, a relation condition, the USING
phrase of a CALL statement, the USING phrase of a Procedure Division,
the USING statement of an ENTRY statement
or the GIVING phrase of
a CALL statement.
USAGE IS OBJECT,
USAGE IS POINTER,
or USAGE IS
PROCEDURE-POINTER
clause must not be a conditional variable.
Typedef-name-1 must be
previously defined in the same source file as a record with the
TYPEDEF clause.
If USAGE typedef-name-1 is
specified, the following clauses cannot also be specified:
It is an error to specify
USAGE typedef-name-1 if there is an explicit USAGE clause at a higher
level in the same hierarchy.
It is an error to specify
any subordinate items (items with a higher level number other than 78)
immediately following an item defined with USAGE typedef-name-1.
The USAGE OBJECT REFERENCE clause
must not be specified in the data description entry for a group item,
but may be specified on subordinate elementary data items.
The USAGE OBJECT REFERENCE clause must
not be specified in the File Section.
The USAGE OBJECT
REFERENCE clause can be specified in the File Section.
Note:Whether the object reference still references an active object depends on the application logic.
The
ACTIVE-CLASS phrase can be specified only in a factory definition,
object definition, or method definition.
except when there is a
PICTURE clause and the data item described is non-numeric
This clause is
equivalent to specifying USAGE IS COMPUTATIONAL-3.
The USAGE IS DISPLAY
clause is valid for the following types of items:
or pointer,
or procedure-pointer
data item is executed, no conversion of the index,
or pointer
or procedure-pointer
data item takes place.
The USAGE IS
COMPUTATIONAL-4 clause is equivalent to specifying USAGE IS
COMPUTATIONAL.
The USAGE IS POINTER
clause identifies a data item in which you can store the address of a
data item (see the section The SET Statement in this chapter).
The USAGE IS
PROCEDURE-POINTER clause specifies that a data item is a
procedure
pointer data item in which you can store the address of a
procedure. (See the
SET statement in this chapter.) The procedure can be written in
any language: if COBOL, it represents the Procedure Division of a
program that is not nested and identified by either:
If typedef-name-1
was specified as an elementary item, then the USAGE
typedef-name-1 clause specifies an elementary item with the same
attributes as the programmer-defined usage referenced by typedef-name-1.
If typedef-name-1 was
specified as a group item, then the USAGE typedef-name-1 clause
specifies a group item with an identical structure. The effect is as if
the data declarations subordinate to the data description entry
identified by typedef-name-1 had been specified identically, subordinate
to the item declared with the USAGE typedef-name-1 clause. Data-names of
the subordinate data items are identical to those declared within the
programmer-defined structure referenced by typedef-name-1 and can be
uniquely referenced using qualification.
A data item described with a USAGE
OBJECT REFERENCE clause is called an object reference. An object
reference is a data item of class object and category object-reference.
It shall contain either null or a reference to an object, subject to the
following rules:
The VALUE clause defines the value of constants, the initial value of working storage items, and the values associated with a condition name.
VALUES ARE can be used with
Format 1.
The VALUE clause may not
be used with external floating-point data items.
The VALUE clause may be
used with external floating-point data items.
The VALUE clause may be
used for an internal floating-point data item, that is an item defined
with USAGE COMP-1 or USAGE COMP-2. In this case literal-1 must either be
a floating-point literal, the figurative constant ZERO, or a numeric
literal representing the value zero.
Format 2 may be used to
define a conditional-variable associated with an internal floating-point
data item, but not an external floating-point data item. In this case,
literal-2 and literal-3 must be floating-point literals, the figurative
constant ZERO, or numeric literals representing the value zero.
Format 2 may be used to
define a condition-variable associated with an external floating-point
data item.
Literal-4 must not be equal
to any literal-2, and in any literal-2 THROUGH literal-3 pair, literal-4
cannot be greater than or equal to literal-2 and less than or equal to
literal-3. Format 3
All identifiers must have
been defined before the declaration of the level 78 item. If either
identifier-1 or identifier-3 (LENGTH parameters) is a group item, the
definition of that group must have been completed before the level 78
declaration, by the appearance of another data item at the same or lower
level number.
If the item is numeric
edited, the value can be a numeric literal or a nonnumeric literal.
If the value is a numeric literal, the value contained in the item
will be the same as if the numeric literal were moved to the numeric
edited item.
In the File Section and
the Linkage Section,
and Local-Storage
Section,
the VALUE clause can be
used in data item entries, but is documentary only.
The figurative constant
NULL can be specified in the VALUE clause only if the data item
is defined with USAGE POINTER or USAGE PROCEDURE-POINTER. This is the
only value you can specify in the VALUE clause for such an item. The
effect is to set the pointer in such a way that it is guaranteed not to
point to any data item.
A VALUE clause specified in
a data description entry that contains an OCCURS clause, or in an entry
that is subordinate to an OCCURS clause, causes every occurrence of the
associated data item to be assigned the specified value.
If a VALUE clause is
specified in a data description entry of a data item which is associated
with a variable occurrence data item, the initialization of the data
item behaves as if the value of the data item referenced by the
DEPENDING ON phrase in the OCCURS clause specified for the variable
occurrence data item is set to the maximum number of occurrences as
specified by that OCCURS clause. A data item is associated with a
variable occurrence data item in any of the following cases:
If a VALUE clause is associated with the data item referenced by a DEPENDING ON phrase, that value is considered to be placed in the data item after the variable occurrence data item is initialized.
A data item of class
object is initialized to null. The initial value takes effect
when VALUE clauses take effect and when storage for the data item is
allocated.
A data item of class pointer is
initialized to null. The initial value takes effect when VALUE clauses
take effect and when storage for the data item is allocated.
Format 3 can be used only
in a constant-name entry.
If literal-5 is specified
and not followed by an operator, the characteristic of the constant-name
is that of literal-5. Otherwise, the characteristic of the constant-name
is that of an integer.
Any number of arithmetic or
logical operators can be used. The result is evaluated using
integer arithmetic in strict left to right order. No parentheses can be
used. If any intermediate result is less than zero, the final value is
undefined. A constant-name may be used in place of integer-1.
The logical operations AND
and OR act on the binary representation in a bit-wise manner.
LENGTH of identifier-1 or
identifier-3 is the size of the storage allocated for identifier-1 or
identifier-3, respectively. If the identifier is a group item, the
length includes all subordinate data items.
The value returned by NEXT
is the offset at which the next byte of storage occurs after the
previous data declaration. If that data declaration was of a table
defined with an OCCURS clause, the value returned by NEXT is the offset
at which the next byte of storage occurs after the first element of the
table.
START of identifier-2 or
identifier-4 is the offset at which identifier-2 or identifier-4,
respectively, begins.
For rules 18 and 19, the
offset is defined as follows:
Offsets are not portable
across different COBOL implementations and no reliance should be placed
on particular values outside this compilation unit. The VALUE OF clause specifies the description of an item in the label records associated with a file.
The VALUE OF clause of the
file description entry is classed as an obsolete element in the ANSI'85
standard and is scheduled to be deleted from the next full revision of the
ANSI Standard.
All dialects in this COBOL
implementation fully support this syntax. The FLAGSTD Compiler directive
can be used to detect all occurrences of this syntax.
Although it is a part of the
standard COBOL definition, this feature is explicitly excluded from the
X/Open COBOL language definitions and should not be used in a conforming
X/Open COBOL source program.
Data-name-2 must be in the
Working-Storage Section.
Literal-2 must be a
nonnumeric literal and cannot be a figurative constant.
The
VALUE OF
FILE-ID clause cannot be used if external-file-reference,
data-name-1 or literal-1 has been specified in the ASSIGN clause in the
File-Control Entry (see the section The File-Control Entry
earlier in this chapter).
This clause is documentary
only.
The character-string
specified in literal-2 or data-name-2 is taken as the external
file-name.
Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names
used herein are protected by international law.
![]() | Data Division | Data Division - Screen Section | ![]() |