The function of each user-defined word is described in the clause or statement
in which it appears.
Related Information:
Constraints for Referencing User-Defined Words
ΓòÉΓòÉΓòÉ 2.2.3. Constraints for Referencing User-Defined Words ΓòÉΓòÉΓòÉ
Generally, a user-defined word must belong to only one of the types of
user-defined words listed in the previous table and must be unique within each
type. There are two exceptions; a COBOL word may be used as a:
condition-name, data-name, or record-name
Level-number or Segment-number
For more information on the uniqueness of data reference, see Methods of Data
Reference.
The following types of user-defined words can be referenced by statements and
entries in that program in which the user-defined word is declared:
paragraph-name
section-name
The following types of user-defined words can be referenced by any COBOL
program:
library-name
program-name
text-name
The following types of names, when they are declared within a Configuration
Section, can be referenced by statements and entries either in that program
which contains a Configuration Section or in any program contained within that
program:
alphabet-name
class-name
condition-name
mnemonic-name
ΓòÉΓòÉΓòÉ 2.2.4. System-Names ΓòÉΓòÉΓòÉ
A system-name is a character-string that is defined by IBM to have a specific
meaning to the system. There are three types of system-names:
computer-name
language-name
implementer-name (which includes environment-name and assignment-name)
ΓòÉΓòÉΓòÉ 2.2.5. Reserved Words ΓòÉΓòÉΓòÉ
A reserved word is a character-string with a predefined meaning in a COBOL
source program, and can be used only as specified in the language defined
formats.
There are five types of reserved words:
Keywords
Optional words
Special characters
Figurative constants
Special registers
ΓòÉΓòÉΓòÉ 2.2.5.1. Keywords ΓòÉΓòÉΓòÉ
Keywords are reserved words that are required within a given clause, entry, or
statement.
ΓòÉΓòÉΓòÉ 2.2.5.2. Optional Words ΓòÉΓòÉΓòÉ
Optional words are reserved words that may be included in the format of a
clause, entry, or statement in order to improve readability. They have no
effect on the meaning or execution of the program. Optional words are shown in
formats as uppercase, but appear below the main path.
ΓòÉΓòÉΓòÉ 2.2.5.3. Special Characters ΓòÉΓòÉΓòÉ
There are two types of special character reserved words:
Arithmetic operators: + - / * **
See Arithmetic Operators.
Relational operators: < > = <= >=
See Relation Condition.
ΓòÉΓòÉΓòÉ 2.2.5.4. Figurative Constants ΓòÉΓòÉΓòÉ
Figurative constants are reserved words that name and refer to specific
constant values. The reserved words for figurative constants are:
ZERO/ZEROS/ZEROES
SPACE/SPACES
HIGH-VALUE/HIGH-VALUES
LOW-VALUE/LOW-VALUES
QUOTE/QUOTES
ALL literal
NULL/NULLS
The singular and plural forms of ZERO, SPACE, HIGH-VALUE, LOW-VALUE, QUOTE, and
NULL are equivalent, and may be used interchangeably. For example, if
DATA-NAME-1 is a 5-character data item, each of the following statements will
fill DATA-NAME-1 with five spaces:
MOVE SPACE TO DATA-NAME-1
MOVE SPACES TO DATA-NAME-1
MOVE ALL SPACES TO DATA-NAME-1
A figurative constant may be used wherever 'literal' appears in a format,
except where explicitly prohibited. When a numeric literal appears in a format,
only the figurative constant ZERO may be used.
-----IBM Extension-----
The figurative constant ZERO can be used as a Boolean literal.
---End of IBM Extension---
The length of a figurative constant depends on the context of the program. The
following rules apply:
When a figurative constant is associated with a data item (for example, when
it is moved to or compared with another item), the length of the figurative
constant character-string is equal to one (1) or to the number of character
positions in the associated data item, whichever is greater.
When a figurative constant, other than the ALL literal, is not associated
with another data item (for example, in a STOP, STRING, or UNSTRING
statement), the length of the character-string is one (1) character.
ΓòÉΓòÉΓòÉ 2.2.5.5. Special Registers ΓòÉΓòÉΓòÉ
Special registers are reserved words that name storage areas generated by the
compiler. Their primary use is to store information produced through specific
COBOL features. Each such storage area has a fixed name, and must not be
further defined within the program.
In the general formats of this specification, a special register can be used,
unless otherwise restricted, wherever a data-name or identifier is specified
provided that the special register is the same category as the data-name or
identifier. If qualification is allowed, special registers can be qualified as
necessary to provide uniqueness.
Each special register is discussed in the section indicated.
The special registers are:
ADDRESS OF
DB-FORMAT-NAME
DEBUG-ITEM
LENGTH OF
LINAGE-COUNTER
RETURN-CODE
SORT-RETURN
WHEN-COMPILED
ΓòÉΓòÉΓòÉ 2.2.6. Literals ΓòÉΓòÉΓòÉ
A literal is a character-string whose value is specified either by the
characters of which it is composed, or by the use of a figurative constant (See
page Figurative Constants). There are three types of literals:
Boolean Literals
Nonnumeric Literals
Numeric Literals
ΓòÉΓòÉΓòÉ 2.2.6.1. Boolean Literals ΓòÉΓòÉΓòÉ
-----IBM Extension-----
A Boolean literal is a character-string delimited on the left by the separator
B" and on the right by the quotation mark separator. The character-string
consists only of the character 0 or 1. The value of a Boolean literal is the
character itself, excluding the delimiting separators.
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 2.2.6.2. Nonnumeric Literals ΓòÉΓòÉΓòÉ
A nonnumeric literal is a character-string enclosed in quotation marks ("), and
can contain any allowable character from the EBCDIC character set. The maximum
length of a nonnumeric literal is 256 characters.
A nonnumeric literal must be enclosed in quotation marks (").
---------- If the *APOST compiler option is in effect, the nonnumeric
literal must be enclosed by apostrophes(').
---------- End of If the *APOST compiler option is in effect, the
nonnumeric literal The enclosing quotation marks (or apostrophes) are
excluded from the literal when the program is compiled. An embedded quotation
mark must be represented by a pair of quotation marks ("").
For example,
"THIS ISN""T WRONG"
----------
In an apostrophe literal, a double apostrophe ('') is reduced to a single
apostrophe when the double apostrophe is also a delimiter.
For example,
'THIS ISN''T WRONG'
represents
THIS ISN'T WRONG
---------- End of
Any punctuation characters included within a nonnumeric literal are part of
the value of the literal.
Every nonnumeric literal is in the alphanumeric data category. (Data
categories are described in Classes and Categories of Data.)
-----IBM Extension-----
You can use hexadecimal notation to form a hexadecimal nonnumeric literal.
ΓöîΓöÇΓöÇΓöÇ FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
ΓòÉΓòÉΓòÉ 4.19.2.3. References to COPY Libraries ΓòÉΓòÉΓòÉ
If more than one COBOL library is available to the compiler during compilation,
text-name can be qualified each time it is referenced.
ΓöîΓöÇΓöÇΓöÇ REFERENCES TO COPY LIBRARIES - FORMAT 3 ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
For rules on referencing COPY libraries, see COPY Statement.
ΓòÉΓòÉΓòÉ 4.19.2.4. Qualification Rules ΓòÉΓòÉΓòÉ
The rules for qualifying a name are:
A name can be qualified even though it does not need qualification.
Each qualifier must be of a higher level than the name it qualifies, and
must be within the same hierarchy.
For example:
01 FIELD-A
02 FIELD-B
05 SUB1
07 SUB2
02 FIELD-C
07 SUB1
A hierarchy includes all subordinate entries to the next equal or higher
level-number. Therefore, in the above example all entries are in the
hierarchy of FIELD-A. All entries from FIELD-B to, but not including,
FIELD-C are in the hierarchy of FIELD-B.
In the hierarchy of FIELD-A, SUB1 can be used twice; once as subordinate to
FIELD-B and once as subordinate to FIELD-C. In references to SUB-1, it must
be qualified as SUB-1 OF FIELD-B or SUB-1 OF FIELD-C. Within FIELD-B or
FIELD-C, SUB1 cannot be subordinate to itself.
The complete list of qualifiers for one data-name must not be the same as a
partial list of qualifiers for another.
If a data-name or a condition-name is assigned to more than one data item,
it must be qualified each time it is referred to (for the one exception, see
REDEFINES Clause).
If reference can be made unique by qualification, data-names may be defined
in more than one place in a given program or compilation unit.
If there is more than one combination of qualifiers that ensures uniqueness,
then any of these combinations can be used.
If referenced in the program, a section-name must be unique.
If referenced in the program, a paragraph-name must be unique within a
section. When a paragraph-name is qualified by a section-name, the word
SECTION must not appear. A paragraph-name need not be qualified when
referred to within the section in which it appears.
LINAGE-COUNTER must be qualified each time it is referenced if more than one
file description entry containing a LINAGE clause has been specified in the
source program.
Library-name must be unique in the system. Therefore, the first 10
characters of library-name must be unique.
Text-name (member-name) can be qualified by the library-name and file-name
in which it resides. (A hyphen is required between library-name and
file-name, without any intervening spaces.) If no library is specified, the
library list is searched. If no file-name is specified, QCBLLESRC is used.
-----IBM Extension-----
File-name is optional for the COPY statement, Format 1. If file-name is not
specified, the default is QCBLLESRC.
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 4.19.3. Subscripting ΓòÉΓòÉΓòÉ
Subscripting is a method of providing table references through the use of
positive integers. A subscript is a positive integer (or integer data item)
whose value specifies the occurrence number of a table element.
ΓöîΓöÇΓöÇΓöÇ SUBSCRIPTING - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
The END PROGRAM header indicates the end of a named COBOL source program. It
also separates each program in a sequence of source pograms. An END PROGRAM
header is optional for the last program in a sequence of source programs only
if that program does not contain any nested programs.
ΓöîΓöÇΓöÇΓöÇ END PROGRAM HEADER - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
Specifies that the collating sequence is to be determined by the program,
according to the following rules:
The order in which literals appear specifies the ordinal number, in
ascending sequence, of the character(s) in this collating sequence.
Each numeric literal specified must be an unsigned integer and must have a
value from 1 through 256 (the maximum number of characters in the EBCDIC
character set). The value of each literal specifies the relative position
of a character within the EBCDIC character set. For example:
literal 112 represents the EBCDIC character ?
literal 234 represents the EBCDIC character Z
literal 241 represents the EBCDIC numeric character 0.
Each character in a nonnumeric literal represents that actual character in
the EBCDIC character set. (If the nonnumeric literal contains more than one
character, each character, starting with the leftmost, is assigned a
successively ascending position within this collating sequence.)
Any EBCDIC characters not explicitly specified assume positions in this
collating sequence higher than any of the explicitly specified characters.
The relative order of the unspecified characters remains unchanged from the
EBCDIC collating sequence.
Within one alphabet-name clause, a given character must not be specified
more than once.
Each nonnumeric literal associated with a THROUGH or ALSO phrase must be 1
character in length (if it is longer, only the first character is kept, and
a warning is issued)
When the THROUGH phrase is specified, the contiguous EBCDIC characters
beginning with the character specified by literal-1 and ending with the
character specified by literal-2 are assigned successively ascending
positions in this collating sequence. This sequence may be either ascending
or descending within the original EBCDIC sequence. For example, if the
characters Z through S are specified, then for this collating sequence the
ascending values are: ZYXWVUTS.
When the ALSO phrase is specified, the EBCDIC characters specified as
literal-1, literal-3, and so on, are assigned to the same position in this
collating sequence. For example, if you specify:
"D" ALSO "N" ALSO "%"
the characters D, N, and % are all considered to be in the same position in
the collating sequence.
If specified as literals in the SPECIAL-NAMES paragraph, the figurative
constants HIGH-VALUE and LOW-VALUE are associated with hex FF and hex 00
respectively.
After all clauses in the SPECIAL-NAMES paragraph are processed, the
character having the highest ordinal position in this collating sequence is
associated with the figurative constant HIGH-VALUE. If more than one
character has the highest position, because of specification of the ALSO
phrase, the last character specified (or defaulted to when some characters
in the native collating sequence are not explicitly specified) is considered
to be the HIGH-VALUE character for procedural statements such as DISPLAY, or
as the sending field in a MOVE statement. (If all characters within the
native collating sequence were explicitly specified, and the ALSO phrase
example from above were specified as the high-order characters of this
collating sequence, the HIGH-VALUE character would be %.)
After all clauses in the SPECIAL-NAMES paragraph are processed, the
character having the lowest ordinal position in this collating sequence is
associated with the figurative constant LOW-VALUE. If more than one
character has the lowest position, because of specification of the ALSO
phrase, the first character specified is the LOW-VALUE character. (If the
ALSO phrase example given above were specified as the low-order characters
of the collating sequence, the LOW-VALUE character would be D.)
When literal-1, literal-2, or literal-3 is specified, the alphabet-name must
not be referred to in a CODE-SET clause (see CODE-SET Clause).
ΓòÉΓòÉΓòÉ 8.5.3. Coding Examples ΓòÉΓòÉΓòÉ
The following examples illustrate some uses for the ALPHABET clause.
If PROGRAM COLLATING SEQUENCE IS USER-SEQUENCE; if the alphabet-name clause is
specified as USER-SEQUENCE IS "D", "E", "F"; and if two Data Division items are
defined as follows:
77 ITEM-1 PIC X(3) VALUE "ABC".
77 ITEM-2 PIC X(3) VALUE "DEF".
then the following comparison is true:
IF ITEM-1 > ITEM-2
Characters D, E, and F are in ordinal positions 1, 2, and 3 of this collating
sequence. Characters A, B, and C are in ordinal positions 197, 198, and 199 of
this collating sequence.
If the alphabet-name clause is USER-SEQUENCE IS 1 THRU 247, 251 THRU 256, "7",
ALSO "8", ALSO "9"; if all 256 EBCDIC characters have been specified; and if
the two Data Division items are specified as follows:
77 ITEM-1 PIC X(3) VALUE HIGH-VALUE.
77 ITEM-2 PIC X(3) VALUE "789".
then both of the following comparisons are true:
IF ITEM-1 = ITEM-2 . . .
IF ITEM-2 = HIGH-VALUE . . .
They compare as true because the values "7", "8", and "9" all occupy the same
position (HIGH-VALUE) in this USER-SEQUENCE collating sequence.
If the alphabet-name clause is specified as USER-SEQUENCE IS "E", "D", "F" and
a table in the Data Division is defined as follows:
05 TABLE A OCCURS 6 ASCENDING KEY IS
KEY-A INDEXED BY INX-A.
10 FIELD-A ...
10 KEY-A ...
and if the contents in ascending sequence of each occurrence of KEY-A are A, B,
C, D, E, G, then the results of the execution of a SEARCH ALL statement for
this table will be invalid because the contents of KEY-A are not in ascending
order. The proper ascending order would be E, D, A, B, C, G.
ΓòÉΓòÉΓòÉ 8.6. CLASS Clause ΓòÉΓòÉΓòÉ
The CLASS clause relates a name to the specified set of characters listed in
that clause.
ΓöîΓöÇΓöÇΓöÇ CLASS CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
If no CONSOLE IS clause is specified, any ACCEPT or DISPLAY statement that has
no phrases specific to a particular format is treated as a standard ANSI COBOL
ACCEPT or DISPLAY statement.
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 8.8. CRT STATUS Clause ΓòÉΓòÉΓòÉ
-----IBM Extension-----
The CRT STATUS clause specifies a data item into which a status value is moved
after an extended ACCEPT statement.
ΓöîΓöÇΓöÇΓöÇ CRT STATUS CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
At the start of an extended ACCEPT operation, if data-name-1 contains a value
that is a valid character position on the screen, that position is used as the
initial position for the cursor. A valid position is a coordinate that lies on
the screen (that is, within the range from line 1, column 1, to line 24, column
80). After the ACCEPT operation, if the position in data-name-1 was valid,
data-name-1 is updated to show the position of the cursor at the end of the
operation.
If the CURSOR IS identifier contains an invalid value (such as spaces,
low-values, high-values or a value outside of the screen range), the cursor is
positioned at the start of the first input field that is active on the screen.
CURSOR IS has no effect on the positioning of fields on the screen.
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 8.11. DECIMAL-POINT IS COMMA Clause ΓòÉΓòÉΓòÉ
The DECIMAL-POINT IS COMMA clause exchanges the functions of the period and the
comma in PICTURE character strings and in numeric literals.
ΓöîΓöÇΓöÇΓöÇ DECIMAL-POINT IS COMMA CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
The LINKAGE TYPE clause specifies the type of linkage to be made on a CALL to
or a CANCEL of the program specified by literal-7, and to the type of linkage
to be made on the SET statement.
ΓöîΓöÇΓöÇΓöÇ LINKAGE TYPE CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
The assignment-name or literal makes the association between the file and the
external medium.
Any assignment-name or literal after the first is syntax checked, but has no
effect on the execution of the program
Assignment-name-1 or literal-1 consists of 3 parts:
Device
File name
Attribute
It has the following general structure:
ΓöîΓöÇΓöÇΓöÇ FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
Signifies interaction between a COBOL program and either a workstation user or
another system.
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 8.19. PADDING CHARACTER Clause ΓòÉΓòÉΓòÉ
The PADDING CHARACTER clause specifies the character which is to be used for
block padding on sequential files.
The PADDING CHARACTER clause is syntax checked, but no compile-time or run-time
verification checking is done, and the clause has no effect on the execution of
the program.
ΓöîΓöÇΓöÇΓöÇ PADDING CHARACTER CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
For EXTERNAL files, if data-name-6 is specified, it must reference an EXTERNAL
data item.
ΓòÉΓòÉΓòÉ 8.20. RECORD DELIMITER Clause ΓòÉΓòÉΓòÉ
The RECORD DELIMITER clause indicates the method of determining the length of a
variable-length record on an external medium. It can be specified only for
variable-length records.
The RECORD DELIMITER clause is syntax checked, but no compile-time or run-time
verification checking is done, and the clause is treated as documentation
ΓöîΓöÇΓöÇΓöÇ RECORD DELIMITER CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
The RECORD KEY clause must be specified for an indexed file. The RECORD KEY
clause specifies the data item within the record that is the record key for an
indexed file.
ΓöîΓöÇΓöÇΓöÇ RECORD KEY CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
Must be defined as an unsigned integer data item whose description does not
contain the PICTURE symbol P. Data-name-4 must not be defined in a record
description entry associated with this relative file. That is, the RELATIVE KEY
is not part of the record. Data-name-4 can be qualified.
For reads under sequential access, the RELATIVE KEY data item is updated with
the relative record number of the record being made available.
Data-name-4 is required for ACCESS IS SEQUENTIAL only when the START statement
is to be used. It is always required for ACCESS IS RANDOM and ACCESS IS
DYNAMIC. When the START statement is issued, the system uses the contents of
the RELATIVE KEY data item to determine the record at which sequential
processing is to begin.
If a value is placed in data-name-4, and a START statement is not issued, the
value is ignored and processing begins with the first record in the file.
-----IBM Extension-----
When the file is opened, the POSITION parameter on the OVRDBF CL command can be
used to set the file position indicator. This causes processing to begin with a
record other than the first record.
---End of IBM Extension---
If a relative file is to be referenced by a START statement, you must specify
the RELATIVE KEY clause for that file.
The ACCESS MODE IS RANDOM clause must not be specified for file-names specified
in the USING or GIVING phrase of a SORT or MERGE statement.
For EXTERNAL files, data-name-4 must reference an external data item, and the
RELATIVE KEY phrase in each associated file control entry must reference that
same external data item. (Relative keys are used with subfiles.)
ΓòÉΓòÉΓòÉ 8.24. FILE STATUS Clause ΓòÉΓòÉΓòÉ
The FILE STATUS clause monitors the execution of each input-output request for
the file.
ΓöîΓöÇΓöÇΓöÇ FILE STATUS CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
Γöé ΓööΓöÇΓöÇΓö¼ΓöÇRERUNΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöñ records Γö£ΓöÇΓö¼ΓöÇΓöÇΓöÇ.ΓöÇΓöÿ Γöé
Γöé ΓööΓöÇΓöÇΓö¼ΓöÇRERUNΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöñ records Γö£ΓöÇΓö¼ΓöÇΓöÇΓöÇ.ΓöÇΓöÿ Γöé
The SAME AREA clause specifies that two or more files, that do not represent
sort or merge files, are to use the same main storage area during processing.
The SAME AREA clause is syntax checked, but is treated as documentation.
ΓöîΓöÇΓöÇΓöÇ SAME AREA CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
The files named in a SAME AREA clause need not have the same organization or
access.
ΓòÉΓòÉΓòÉ 8.29. SAME RECORD AREA Clause ΓòÉΓòÉΓòÉ
The SAME RECORD AREA clause specifies that two or more files are to use the
same main storage area for processing the current logical record. All of the
files may be open at the same time.
Note: The SAME RECORD AREA clause is intended to make efficient use of main
storage. However, AS/400 virtual storage architecture eliminates the
need for this clause, and the clause is supported for compatibility
rather than for performance. Use of the SAME RECORD AREA clause
actually degrades performance and increases program size.
ΓöîΓöÇΓöÇΓöÇ SAME RECORD AREA CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
A logical record in the shared storage area is considered to be both of the
following:
A logical record of each opened output file using the SAME RECORD AREA
clause
A logical record of the most recently read input file using the SAME RECORD
AREA clause.
The SAME RECORD AREA clause allows transfer of data from one file to another
with no explicit data manipulation because the input/output record areas of
named files are identical, and all are available to the user.
More than one SAME RECORD AREA clause may be included in a program. However:
A specific file-name must not appear in more than one SAME RECORD AREA
clause.
If one or more file-names of a SAME AREA clause appear in a SAME RECORD AREA
clause, all the file-names in that SAME AREA clause must appear in that SAME
RECORD AREA clause. However, the SAME RECORD AREA clause may contain
additional file-names that do not appear in the SAME AREA clause.
If the SAME RECORD AREA is specified for several files, the record
description entries or the file description entries for these files must not
include the GLOBAL clause.
The SAME RECORD AREA clause cannot be used with EXTERNAL files.
ΓòÉΓòÉΓòÉ 8.30. SAME SORT AREA Clause ΓòÉΓòÉΓòÉ
The SAME SORT AREA clause optimizes the storage area assignment to a given SORT
statement.
The SAME SORT AREA clause is syntax checked, but is treated as documentation.
ΓöîΓöÇΓöÇΓöÇ SAME SORT AREA CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
When the SAME SORT AREA clause is specified, at least one file-name specified
must be a sort file. Files that are not sort files may also be specified. The
following rules apply:
More than one SAME SORT AREA clause may be specified. However, a given sort
file must not be named in more than one such clause.
If a file that is not a sort file is named in both a SAME AREA clause and in
one or more SAME SORT AREA clauses, all the files in the SAME AREA clause
must also appear in that SAME SORT AREA clause.
Files named in a SAME SORT AREA clause need not have the same organization
or access.
Files named in a SAME SORT AREA clause that are not sort files do not share
storage with each other unless the user names them in a SAME RECORD AREA
clause.
ΓòÉΓòÉΓòÉ 8.31. SAME SORT-MERGE AREA Clause ΓòÉΓòÉΓòÉ
The SAME SORT-MERGE AREA clause optimizes the storage area assignment to a
given SORT or MERGE statement.
The SAME SORT-MERGE AREA clause is syntax checked, but is treated as
documentation.
ΓöîΓöÇΓöÇΓöÇ SAME SORT-MERGE AREA CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
ΓòÉΓòÉΓòÉ 8.33. COMMITMENT CONTROL Clause ΓòÉΓòÉΓòÉ
-----IBM Extension-----
The COMMITMENT CONTROL clause specifies the files that will be placed under
commitment control when they are opened.
ΓöîΓöÇΓöÇΓöÇ COMMITMENT CONTROL CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
File-name-6 must be specified in the FILE CONTROL paragraph of the same program
as the I-O-CONTROL paragraph in which the COMMITMENT CONTROL clause appears.
These files will then be affected by the COMMIT and ROLLBACK statements. The
COMMIT statement allows the synchronization of changes to database records
while preventing other jobs from modifying those records until the COMMIT is
complete. The ROLLBACK statement provides a method of cancelling changes made
to database files when those changes should not be made permanent.
The COMMITMENT CONTROL clause can specify only files assigned to a device type
of DATABASE. Files under commitment control may have an organization of
sequential, relative or indexed, and may have any access mode valid for a
particular organization.
The system locks records contained in files under commitment control when these
records are accessed. Records remain locked until released by a COMMIT or
ROLLBACK statement.
Note: Always try to use files in a consistent manner to avoid record locking
problems, and to avoid reading records that have not yet been
permanently committed to the database. Typically, a file should either
always be accessed under commitment control or never be accessed under
commitment control.
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 9. Data Division ΓòÉΓòÉΓòÉ
The Data Division of a COBOL source program describes, in a structured manner,
all the data to be processed by the object program; also the relationship
between physical and logical records. The Data Division is optional in a COBOL
source program.
This section outlines the structure of the Data Division and explains the types
of data.
The Data Division must begin with the words DATA DIVISION, followed by a period
and a space.
The Data Division is divided into three sections:
File Section
Describes externally stored data (including sort-merge files).
Working-Storage Section
Describes internal data.
Linkage Section
Describes data made available by another program. It appears in the
called program and describes data items that are provided by the
calling program and are referred to by the called program. The
called program can be a nested program.
Each section has a specific logical function within a COBOL source program,
and each may be omitted from the source program when that logical function is
not needed. If included, the sections must be written in the order shown.
ΓöîΓöÇΓöÇΓöÇ DATA DIVISION - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
ΓöîΓöÇΓöÇΓöÇ FILE DESCRIPTION ENTRY - FORMAT 1B - DISK ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
In a run unit, there is only one representation of an external file; an
external file can be referenced by any program in the run unit that describes
the file.
In the File Section, the EXTERNAL clause can be specified only in file
description entries. The records appearing in the file description entry need
not have the same name in corresponding external file description entries. In
addition, the number of such records need not be the same in corresponding file
description entries. However, the maximum record length for corresponding
external file description entries must be the same.
For EXTERNAL files, the value of all BLOCK CONTAINS clauses of corresponding
EXTERNAL files must match within the run unit. This conformance is in terms of
character positions only - not upon whether the value was specified as
CHARACTERS or as RECORDS.
All file description entries in the run unit that are associated with an
external file connector must have:
A LINAGE clause, if any file description entry has a LINAGE clause.
The same corresponding values for integer-8, integer-9, integer-10, and
integer-11, if specified.
The same corresponding external data items referenced by data-name-3,
data-name-4, data-name-5, and data-name-6.
Use of the EXTERNAL clause does not imply that the associated file-name is a
global name.
ΓòÉΓòÉΓòÉ 10.8.1. Considerations for External Files ΓòÉΓòÉΓòÉ
In general, all definitions of an external file should be identical. If there
is a mismatch, the program will fail at start up when the definitions are
compared. The following attributes of external files are compared:
If any of the definitions corresponding to the file are externally described
(for example, by using Format 2 of the COPY statement), all other
definitions must also be externally described. The level check information
associated with all definitions must match.
The name specified on the ASSIGN TO clause must be the same for all
definitions. This includes the device type.
The ORGANIZATION and ACCESS modes must be the same for all definitions of
the file.
The OPTIONAL phrase, if specified, must be specified for all definitions of
the file.
The external data item specified for the RELATIVE KEY phrase must be in the
same physical location and occupy the same number of bytes for all
definitions of the file.
The location of the record key within the associated record must be the same
for all definitions of the file.
The blocking information associated with the file must be the same for all
file definitions. This includes whether blocking is to be performed and the
size of the block.
The values for the maximum or minimum number of characters on the RECORD
clause must be the same for all definitions of the file.
The character set specified on the CODE-SET clause must be the same for all
definitions of the file.
The value specified for the DUPLICATES phrase must be the same for all
definitions of the file.
All of the values specified for the LINAGE clause must be the same for each
definition of the file.
The specification of the attribute for the ASSIGN clause (separate
indicators) must be the same for all definitions of the file.
The specification for the COMMITMENT CONTROL clause must be the same for all
definitions of the file.
The specification for the *DUPKEYCHK or the *INZDLT compile-time option must
be the same for all modules containing definitions of the file.
ΓòÉΓòÉΓòÉ 10.9. GLOBAL Clause ΓòÉΓòÉΓòÉ
The GLOBAL clause specifies that the file connector named by a file-name is a
global name.
ΓöîΓöÇΓöÇΓöÇ GLOBAL CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
This clause can be omitted when each physical record contains only one complete
logical record.
This clause is syntax checked for FORMATFILE and printer files. To activate
this clause for other types of files, use OPTION parameter value *BLK, or
PROCESS option BLK.
ΓòÉΓòÉΓòÉ 10.10.1. CHARACTERS ΓòÉΓòÉΓòÉ
Specifies the number of character positions required to store the physical
record, no matter what USAGE the characters have within the data record.
If only integer-2 is specified, it specifies the exact character size of the
physical record. When integer-1 and integer-2 are both specified, they
represent, respectively, the minimum and maximum character sizes of the
physical record.
Integer-1 and integer-2 must include any control bytes and padding contained in
the physical record. (Logical records do not include padding.)
For non-tape files, only integer-2 controls the blocking factor. If integer-2
is zero, the system default blocking factor applies.
The CHARACTERS phrase is the default. CHARACTERS must be specified when the
physical record contains padding.
In general, the length of a variable length record on a RELEASE, REWRITE, or
WRITE statement is determined by data-name-1, if specified. If data-name-1 is
not specified and the record description does not contain a table, the length
is the number of characters in the record description. If data-name-1 is not
specified and the record contains a table, the length is the sum of the fixed
part of the record and the current length of the table.
When variable length records are used for disk files, the BLOCK CONTAINS clause
specifies the size of the block. The size of the actual record is contained in
data-name-1 after a READ operation. To WRITE a variable length record,
data-name-1 must be set to the length of the record.
For tape files, each variable record contains a four-byte header and each block
contains a four-byte header when the data is transferred to tape. However,
these four-byte headers are provided by the system and are of no concern to the
COBOL user except that the maximum size of a variable record is restricted to
32 764.
When variable records are used for tape files, the BLOCK CONTAINS clause
specifies the maximum physical record length, while the logical record length
for each record is inferred by the compiler from the record name used in a
WRITE statement. If an explicit length is required after a READ statement, the
user can obtain it through the I-O-FEEDBACK mnemonic-name.
ΓòÉΓòÉΓòÉ 10.10.2. RECORDS ΓòÉΓòÉΓòÉ
Specifies the number of logical records contained in each physical record.
Maximum record size is 32 767; maximum block size is 32 767. These maximums
include any control bytes required for variable blocked records; thus, the
maximum size data record for a variable-blocked record is 32 759.
ΓòÉΓòÉΓòÉ 10.11. RECORD Clause ΓòÉΓòÉΓòÉ
The RECORD clause specifies the number of character positions for fixed-length
or variable-length records.
The RECORD clause has three formats:
Format 1 - for fixed-length records
Format 2 - for variable-length records
Format 3 - for fixed-length records or variable-length records
Related Information:
General considerations for all three formats.
ΓòÉΓòÉΓòÉ 10.11.1. RECORD clause - Format 1 ΓòÉΓòÉΓòÉ
Format 1 specifies the number of character positions for fixed length records.
ΓöîΓöÇΓöÇΓöÇ RECORD CLAUSE - FORMAT 1 ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
When the maximum record length determined from the record description entries
does not match the length specified in the RECORD clause, the maximum will be
used.
ΓòÉΓòÉΓòÉ 10.11.2. RECORD clause - Format 2 ΓòÉΓòÉΓòÉ
Format 2 is the recommended format when dealing with variable records.
ΓöîΓöÇΓöÇΓöÇ RECORD CLAUSE - FORMAT 2 ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
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, the minimum and maximum number of table elements
described in the record are used in the summation above, to determine the
minimum and maximum number of character positions associated with the record
description.
If the number of character positions in the logical record to be written is
less than integer-4 or greater than integer-5, the output statement is
unsuccessful and, except during execution of a RELEASE statement, the
associated I-O status key is set to a value indicating the cause of the
condition.
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 data-name-1 is specified, by the content of the data item referenced by
data-name-1.
If data-name-1 is not specified and the record does not contain a variable
occurrence data item, by the number of character positions in the record.
If data-name-1 is not specified and the record contains a variable
occurrence data item, by the sum of the fixed portion and that portion of
the table described by the number of occurrences at the time of execution of
the output statement.
During the execution of a READ ... INTO or RETURN ... INTO 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:
If data-name-1 is specified, by the content of the data item referenced by
data-name-1.
If data-name-1 is not specified, by the value that would have been moved
into the data item referenced by data-name-1 had data-name-1 been specified.
ΓòÉΓòÉΓòÉ 10.11.3. RECORD clause - Format 3 ΓòÉΓòÉΓòÉ
Format 3 specifies the number of character positions for either fixed or
variable length records. (The latter is only applicable to tape files.)
ΓöîΓöÇΓöÇΓöÇ RECORD CLAUSE - FORMAT 3 ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
Note: The maximum record length for a file is 32 767.
ΓòÉΓòÉΓòÉ 10.11.4. General Considerations for all Formats ΓòÉΓòÉΓòÉ
When the RECORD clause is used, the record size must be specified as the number
of character positions needed to store the record internally. That is, it must
specify the number of bytes occupied internally by the characters of the
record, not the number of characters used to represent the data item within the
record. The size of a record is determined according to the rules for obtaining
the size of a group item.
When the RECORD clause is omitted, the compiler determines the record lengths
from the record descriptions. When one of the entries within a record
description contains an OCCURS DEPENDING ON clause, the compiler uses the
maximum value of the variable-length item to calculate the number of character
positions needed to store the record internally.
If the associated file connector is an external file connector, all file
description entries in the run unit that are associated with that file
connector must specify the same maximum number of character positions.
ΓòÉΓòÉΓòÉ 10.12. LABEL RECORDS Clause ΓòÉΓòÉΓòÉ
The LABEL RECORDS clause indicates the presence or absence of labels.
FD -Format 3 (TAPEFILE) is the only format in which this clause is not syntax
checked. For all other FD formats, this clause is syntax checked only, then
treated as documentation.
ΓöîΓöÇΓöÇΓöÇ LABEL RECORDS CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
If it is not specified for a file, label records for that file must conform to
the system label specifications.
ΓòÉΓòÉΓòÉ 10.13. VALUE OF Clause ΓòÉΓòÉΓòÉ
The VALUE OF clause describes an item in the label records associated with this
file. The clause is syntax checked, then treated as documentation.
ΓöîΓöÇΓöÇΓöÇ VALUE OF CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
The DATA RECORDS clause is syntax checked and it serves only as documentation
for the names of data records associated with this file.
ΓöîΓöÇΓöÇΓöÇ DATA RECORDS CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
Γöé WITH FOOTING integerΓöÇ9 ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
When the CODE-SET clause is specified, an alphabet-name identifies the
character code convention used to represent data on the input-output device.
The CODE-SET clause also specifies the algorithm for converting the character
codes on the input-output medium from/to the internal EBCDIC character set.
Alphabet-name-1 must be defined in the SPECIAL-NAMES paragraph as STANDARD-1
(for ASCII-encoded files), STANDARD-2 (for ISO 7-bit encoded files), NATIVE
(for EBCDIC-encoded files), or EBCDIC (for EBCDIC-encoded files). When NATIVE
is specified, the CODE-SET clause is syntax checked, but it has no effect on
the execution of the program.
When the CODE-SET clause is specified for a file, all data in this file must
have USAGE DISPLAY, and, if signed numeric data is present, it must be
described with the SIGN IS SEPARATE clause.
When the CODE-SET clause is omitted, the EBCDIC character set is assumed.
Note: The AS/400 system only supports ASCII and ISO for tape and diskette
files. Therefore, if the CODE-SET clause specifies a character code set
of STANDARD-1 (ASCII), or STANDARD-2 (ISO) for a file that is not a
tape or diskette file, a warning message is issued and the EBCDIC
character set will be used.
-----IBM Extension-----
If the CODE-SET clause is omitted, the CODE parameter of the Create Diskette
File (CRTDKTF) or the Create Tape File (CRTTAPF) CL command is used.
The CODE-SET clause can be changed at execution time by specifying the CODE
parameter on the Override with Diskette File (OVRDKTF) or the Override with
Tape File (OVRTAPF) CL command.
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 11. Data Division-Data Description Entry ΓòÉΓòÉΓòÉ
A data description entry specifies the characteristics of a data item. Data
items have attributes, which may be either implicit (default values), or
explicit.
This section describes the coding of data description entries and record
description entries (which are sets of data description entries). The single
term data description entry is used in this section to refer to data and record
description entries.
Data description entries that define independent data items do not make up a
record. These are known as data item description entries.
The data description entry has four general formats.
Format 1 is used for data description entries in all Data Division sections.
Format 2 regroups previously defined items.
Format 3 describes condition names.
-----IBM Extension-----
Format 4 describes boolean data items.
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 11.1. Format 1 ΓòÉΓòÉΓòÉ
Format 1 is used for data description entries in all Data Division sections.
Level-number in this format can be any number from 01-49, as well as 77.
ΓöîΓöÇΓöÇΓöÇ DATA DESCRIPTION ENTRY - GENERAL FORMAT 1 ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
The clauses may be written in any order with two exceptions:
If data-name or FILLER is specified, it must immediately follow the
level-number.
When specified, the REDEFINES clause must be the first entry following
data-name-1 or FILLER. If data-name-1 or FILLER is not specified, the
REDEFINES clause must be the first entry following the level-number. The
data item being described is treated as though FILLER has been specified.
Not all clauses are compatible with each other. For details, see the
descriptions of the individual clauses.
Clauses must be separated by a space, a separator comma, or a separator
semicolon.
ΓòÉΓòÉΓòÉ 11.2. Format 2 ΓòÉΓòÉΓòÉ
Format 2 regroups previously defined items.
ΓöîΓöÇΓöÇΓöÇ DATA DESCRIPTION ENTRY - GENERAL FORMAT 2 ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
A level-66 entry cannot rename another level-66 entry, nor can it rename a
level-01, level-77, or level-88 entry.
All level-66 entries associated with one record must immediately follow the
last data description entry in that record.
Details are contained in RENAMES Clause.
ΓòÉΓòÉΓòÉ 11.3. Format 3 ΓòÉΓòÉΓòÉ
Format 3 describes condition-names.
ΓöîΓöÇΓöÇΓöÇ DATA DESCRIPTION ENTRY - GENERAL FORMAT 3 ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
The length of the data item cannot be changed using this clause.
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 11.6. OCCURS Clause ΓòÉΓòÉΓòÉ
-----IBM Extension-----
When the OCCURS clause and the INDICATOR clause are both specified at an
elementary level, a table of Boolean data items is defined with each element in
the table corresponding to an external indicator. The first element in the
table corresponds to the indicator number specified in the INDICATOR clause;
the second element corresponds to the indicator that sequentially follows the
indicator specified by the INDICATOR clause.
For example, if the following is coded:
07 SWITCHES PIC 1
OCCURS 10 TIMES
INDICATOR 16.
then SWITCHES (1) corresponds to indicator 16, SWITCHES (2) corresponds to
indicator 17,..., and SWITCHES (10) corresponds to indicator 25.
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 11.7. INDICATOR Clause ΓòÉΓòÉΓòÉ
-----IBM Extension-----
If indicator fields are in a separate indicator area, the INDICATOR clause
associates an indicator defined in DDS with a Boolean data item. If indicator
fields are in the record area, the INDICATOR clause is syntax checked, but is
treated as documentation.
Integer-3 must be a value of 1 through 99.
The INDICATOR clause must be specified at an elementary level only.
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 11.8. VALUE Clause ΓòÉΓòÉΓòÉ
-----IBM Extension-----
The VALUE clause specifies the initial content of a Boolean data item. The
allowable values for Boolean literals are B"0", B"1", and ZERO.
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 11.9. level-number ΓòÉΓòÉΓòÉ
Level-numbers must be followed either by a separator period; or by a space
followed by its associated data-name-1, FILLER, or appropriate data description
clause. Level number 01 and 77 must begin in Area A. Level-number 77 must be
followed by a space followed by its associated data-name-1. Level numbers 02
through 49, 66, and 88 may begin in Area A or B.
Single-digit level-numbers 1 through 9 may be substituted for level-numbers 01
through 09.
Successive data description entries may start in the same column as the first
or they may be indented according to the level-number. Indentation does not
affect the magnitude of a level-number.
When level-numbers are indented, each new level-number may begin any number of
spaces to the right of Area A. The extent of indentation to the right is
limited only by the width of Area B.
For more information, see Levels of Data and Standard Data Format.
-----IBM Extension-----
Elementary items or group items that are immediately subordinate to one group
item can have unequal level-numbers.
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 11.10. data-name ΓòÉΓòÉΓòÉ
Explicitly identifies the data being described.
If specified, data-name-1 identifies a data item used in the program. The data
item must be the first word following the level-number.
The data item can be changed during program execution.
Data-name-1 must be specified for
Level-66, level-77, and level-88 items
Entries containing a GLOBAL or EXTERNAL clause
Record description entries associated with file description entries having
GLOBAL or EXTERNAL clauses.
ΓòÉΓòÉΓòÉ 11.11. FILLER ΓòÉΓòÉΓòÉ
Is a data item that is not explicitly referred to in a program. The keyword
FILLER is optional. If specified, FILLER must be the first word following the
level-number.
The keyword FILLER may be used with a conditional variable, if explicit
reference is never made to the conditional variable but only to values it may
assume. FILLER may not be used with a condition-name.
In a MOVE CORRESPONDING statement, or in an ADD CORRESPONDING or SUBTRACT
CORRESPONDING statement, FILLER items are ignored. In an INITIALIZE statement,
elementary FILLER items are ignored.
If data-name-1 or FILLER clause is omitted, the data item being described is
treated as though FILLER had been specified.
ΓòÉΓòÉΓòÉ 11.12. BLANK WHEN ZERO Clause ΓòÉΓòÉΓòÉ
The BLANK WHEN ZERO clause specifies that an item contains nothing but spaces
when its value is zero.
ΓöîΓöÇΓöÇΓöÇ BLANK WHEN ZERO CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
An external data item can be referenced by any program in the run unit that
describes the data item. References to an external data item from different
programs using separate descriptions of the data item are always to the same
data item. In a run unit, there is only one representation of an external data
item.
The EXTERNAL clause can be specified in either 01 level entries in the
Working-Storage Section or in file description entries. If there are two data
description entries with the same data name in the same Data Division, only one
entry can contain the EXTERNAL clause. Index-names and condition-names in an
external data record do not possess the EXTERNAL attribute.
The data contained in the record named by the data-name clause is external and
can be accessed and processed by any program in the run unit that describes
and, optionally, redefines it. This data is subject to the following rules:
If two or more programs within a run unit describe the same external data
record, each record-name of the associated record description entries must
be the same and the records must define the same number of standard data
format characters. However, a program that describes an external record can
contain a data description entry including the REDEFINES clause that
redefines the complete external record, and this complete redefinition need
not occur identically in other programs in the run unit.
Use of the EXTERNAL clause does not imply that the associated data-name is a
global name.
The VALUE clause must not be used in any data description entry which
includes, or is subordinate to an entry which includes, the EXTERNAL clause.
The VALUE clause can be specified for condition-name entries associated with
such data description entries.
ΓòÉΓòÉΓòÉ 11.14. GLOBAL Clause ΓòÉΓòÉΓòÉ
The GLOBAL clause specifies that a data-name is available to the program that
declares it and to every program contained within the program that declares it,
as long as the contained program does not itself have a declaration for that
name. All data-names subordinate to, or condition-names or index-names
associated with a global name, are global names.
ΓöîΓöÇΓöÇΓöÇ GLOBAL CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
The JUSTIFIED clause may be specified only at the elementary level. RIGHT is an
optional word that is syntax checked only and has no effect on the execution of
the program.
The JUSTIFIED clause cannot be specified for numeric, numeric-edited, or
alphanumeric-edited items.
The JUSTIFIED clause is not allowed for items described with:
Level-66 (RENAMES) entries
Level-88 (condition-name) entries
The USAGE IS INDEX clause
-----IBM Extension-----
The USAGE IS POINTER clause
The USAGE IS PROCEDURE-POINTER clause
The JUSTIFIED clause can be specified for an alphanumeric edited item.
---End of IBM Extension---
When the JUSTIFIED clause is omitted, the rules for standard alignment are
followed (see Alignment Rules).
When the JUSTIFIED clause is specified for a receiving item, the data is
aligned at the rightmost character position in the receiving item. Also:
If the sending item is larger than the receiving item, the leftmost
characters are truncated.
If the sending item is smaller than the receiving item, the unused character
positions at the left are filled with spaces.
The JUSTIFIED clause does not affect initial values, as determined by the
VALUE clause.
ΓòÉΓòÉΓòÉ 11.16. LIKE Clause ΓòÉΓòÉΓòÉ
-----IBM Extension-----
The LIKE clause allows you to define the PICTURE, USAGE, and SIGN
characteristics of a data item by copying them from a previously defined data
item. It also allows you to make the length of the data item you define
different from the length of the original item.
ΓöîΓöÇΓöÇΓöÇ LIKE CLAUSE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
A data item defined with the PROCEDURE-POINTER phrase is a procedure-pointer
data item. It is a 16-byte elementary item containing the address of an entry
point to an ILE procedure or program object (*PGM), such as:
The entry point of the outermost ILE COBOL/400 program (an ILE procedure) in
the compilation unit defined by the PROGRAM-ID statement
An entry point of a non-COBOL program, such as an ILE C/400 function (an ILE
procedure)
An entry point of a program (*PGM).
A procedure-pointer data item may only be used in:
The SET statement
A relation condition
The USING phrase of a CALL statement, or the Procedure Division header
Expressions involving ADDRESS OF and LENGTH OF
The CALL statement as a target
Like pointer data items, procedure-pointer data items must be in alignment.
---End of IBM Extension---
Related Information:
PROCEDURE-POINTER Usage Rules
ΓòÉΓòÉΓòÉ 11.23.5.1. Usage Rules ΓòÉΓòÉΓòÉ
-----IBM Extension-----
The USAGE IS PROCEDURE-POINTER clause cannot be written at level-88
In a group item described with the USAGE IS PROCEDURE-POINTER clause, the
elementary items within the group are procedure-pointer data items (the
group itself is not a procedure-pointer)
The USAGE clause of an elementary item cannot contradict the USAGE clause of
a group to which the item belongs
Procedure-pointer data items can be part of a group that is referred to in a
MOVE statement, or an input/output statement. However, there is no
conversion of values when the statement is executed
A procedure-pointer data item can be written to a file, but if you later
read the same record containing the procedure-pointer, the item will no
longer represent a valid address.
GLOBAL, EXTERNAL, OCCURS, SYNCHRONIZED, and LIKE clauses may be used with
USAGE IS PROCEDURE-POINTER
A procedure-pointer may be the subject or object of a REDEFINES clause
A VALUE clause for a procedure-pointer data item can contain only NULL or
NULLS
JUSTIFIED, PICTURE, and BLANK WHEN ZERO clauses cannot describe group or
elementary items defined with the USAGE IS PROCEDURE-POINTER clause
A procedure-pointer data item cannot be a conditional variable, does not
belong to any class or category, and is ignored in CORRESPONDING operations.
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 11.24. VALUE Clause ΓòÉΓòÉΓòÉ
The VALUE clause specifies the initial contents of a data item or the value(s)
associated with a condition-name.
The VALUE clause has three formats:
Format 1 - Literal Value
Format 2 - Condition-Name Value
-----IBM Extension-----
Format 3 - NULL Value
---End of IBM Extension---
The use of the VALUE clause differs depending on the Data Division section in
which it is specified.
-----IBM Extension-----
In the Linkage section, a VALUE clause used in entries other than
condition-names is treated as a comment.
---End of IBM Extension---
In the File and Linkage sections, the VALUE clause must be used only in
condition-name entries. In the Working-Storage Section, the VALUE clause may
be used in condition-name entries, or in specifying the initial value of any
data item. The data item assumes the specified value at the beginning of
program execution. If the initial value is not explicitly specified, it is
unpredictable.
ΓòÉΓòÉΓòÉ 11.24.1. VALUE Clause - Format 1 - Literal Value ΓòÉΓòÉΓòÉ
ΓöîΓöÇΓöÇΓöÇ VALUE CLAUSE - FORMAT 1 - LITERAL VALUE ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
This format associates a value, values, and/or range(s) of values with a
condition-name. Each such condition-name requires a separate level-88 entry.
Level-number 88 and condition-name are not part of the Format 2 VALUE clause
itself. They are included in the format only for clarity.
Related Information:
Rules for Condition-Name Values
ΓòÉΓòÉΓòÉ 11.24.4. Rules for Condition-Name Values: ΓòÉΓòÉΓòÉ
The VALUE clause is required in a condition-name entry, and must be the only
clause in the entry. Each condition-name entry is associated with a
preceding conditional variable. Thus, every level-88 entry must always be
preceded either by the entry for the conditional variable, or by another
level-88 entry when several condition-names apply to one conditional
variable. Each such level-88 entry implicitly has the PICTURE
characteristics of the conditional variable.
The condition-name entries associated with a particular conditional variable
must immediately follow the conditional variable entry. The conditional
variable can be any data description entry except:
- A level-66 item (RENAMES clause)
- A data item whose USAGE IS INDEX
- An item whose USAGE IS POINTER or PROCEDURE-POINTER.
A condition-name can be associated with a group item data description entry.
In this case:
- The condition-name value must be specified as a nonnumeric literal or
figurative constant.
- The size of the condition-name value must not exceed the sum of the sizes
of all the elementary items within the group.
- No element within the group may contain a JUSTIFIED or SYNCHRONIZED
clause.
- No USAGE other than DISPLAY may be specified within the group.
Condition-names can be specified both at the group level and at subordinate
levels within the group.
The relation test implied by the definition of a condition-name at the group
level is performed in accordance with the rules for comparison of nonnumeric
operands, regardless of the nature of elementary items within the group.
A space, a separator comma, or a separator semicolon, must separate
successive operands.
Each entry must end with a separator period.
The type of literal in a condition-name entry must be consistent with the
data type of its conditional variable.
ΓòÉΓòÉΓòÉ 11.24.5. VALUE Clause - Format 3 - NULL Value ΓòÉΓòÉΓòÉ
-----IBM Extension-----
ΓöîΓöÇΓöÇΓöÇ VALUE CLAUSE - FORMAT 3 - NULL VALUE ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
A conditional expression causes the object program to select alternative paths
of control, depending on the truth value of a test. Conditional expressions are
specified in EVALUATE, IF, PERFORM, and SEARCH statements.
A conditional expression can be specified in either
simple conditions
complex conditions
Both simple and complex conditions can be enclosed within any number of paired
parentheses; the parentheses do not change whether the condition is simple or
complex.
ΓòÉΓòÉΓòÉ 12.6.1. Simple Conditions ΓòÉΓòÉΓòÉ
There are five simple conditions:
Class condition
Condition-name condition
Relation condition
Sign condition
Switch-status condition
A simple condition has a truth value of either true or false.
ΓòÉΓòÉΓòÉ 12.6.1.1. Class Condition ΓòÉΓòÉΓòÉ
The class condition determines whether the content of a data item is
alphabetic, alphabetic-lower, alphabetic-upper, numeric, or contains only the
characters in the set of characters specified by the CLASS clause as defined in
the SPECIAL-NAMES paragraph of the Environment Division.
ΓöîΓöÇΓöÇΓöÇ CLASS CONDITION - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
In Format 3, elementary data items within identifier-4 are added to and stored
in the corresponding elementary items within identifier-5.
If the composite of operands is 18 digits or less, enough places are carried so
that no significant digits are lost during execution.
In Format 3, the composite of operands is determined separately for each pair
of corresponding data items.
-----IBM Extension-----
The composite of all operands in an arithmetic statement can have a maximum
length of 30 digits.
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 12.12. ALTER Statement ΓòÉΓòÉΓòÉ
The ALTER statement changes the transfer point specified in a GO TO statement.
Note: The ALTER statement encourages the use of unstructured programming
practices. The EVALUATE statement provides the same function as the ALTER
statement and helps to ensure that your program will be well-structured.
ΓöîΓöÇΓöÇΓöÇ ALTER STATEMENT - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
If the LINKAGE TYPE phrase is not specified on the CANCEL statement, the type
of program canceled can be changed by specifying one of: the LINKAGE TYPE
clause of the SPECIAL-NAMES paragraph, or the LINKLIT parameter of the
CRTCBLMOD or CRTBNDCBL command.
After a CANCEL statement for a called subprogram has been executed, that
subprogram no longer has a logical connection to the program. The contents of
data items in external data records described by the subprogram are not changed
when a subprogram is canceled. If a CALL statement is executed later by any
program in the run unit naming the same subprogram, that subprogram will be
entered in its initial state.
A CANCEL statement closes all open INTERNAL files.
You can cancel a called subprogram in any of the following ways:
By referencing it as the operand of a CANCEL statement
By terminating the run unit of which the subprogram is a member (This can be
done by a STOP RUN in the same run unit or by a GOBACK from the main program
of the run unit.)
By executing an EXIT PROGRAM statement in the called subprogram if that
subprogram possesses the INITIAL attribute
-----IBM Extension-----
By executing the GOBACK statement in the called subprogram if that
subprogram possesses the INITIAL attribute.
---End of IBM Extension---
A CANCEL statement operates only on the program specified, and not on any
program that may have been called by the canceled program.
Called subprograms may contain CANCEL statements. A called subprogram must not
contain a CANCEL statement that directly or indirectly cancels its calling
program or any other program higher than itself in the calling hierarchy. If a
called subprogram attempts to cancel its calling program, the CANCEL statement
in the subprogram is ignored.
A program named in a CANCEL statement must not refer to any program that has
been called and has not yet returned control to the calling program. For
example:
A calls B and B calls C (When A receives control,
it can cancel C.)
A calls B and A calls C (When C receives control,
it can cancel B.)
No action is taken when a CANCEL statement is executed naming a program that
has not been called in the run unit, or that names a program that was called
and subsequently canceled. In both cases, control passes to the next
statement.
ΓòÉΓòÉΓòÉ 12.15. CLOSE Statement ΓòÉΓòÉΓòÉ
The CLOSE statement terminates the processing of volumes and files, with
optional rewind and/or lock or removal, where applicable.
The CLOSE statement has three formats:
Format 1
Format 2 - Tape Files
Related Information:
CLOSE Statement Considerations
Special Considerations for Device Type TAPEFILE Only
ΓòÉΓòÉΓòÉ 12.15.1. CLOSE Statement - Format 1 ΓòÉΓòÉΓòÉ
ΓöîΓöÇΓöÇΓöÇ CLOSE STATEMENT - FORMAT 1 ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
ΓòÉΓòÉΓòÉ 12.15.2. CLOSE Statement - Format 2 - Tape Files ΓòÉΓòÉΓòÉ
ΓöîΓöÇΓöÇΓöÇ CLOSE STATEMENT - FORMAT 2 - TAPE FILES ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
In Format 5, the value of identifier-1 or literal-1 is divided by identifier-2
or literal-2. This quotient is stored in identifier-3, and the value of the
remainder is stored in identifier-4.
ΓòÉΓòÉΓòÉ 12.22. DROP Statement ΓòÉΓòÉΓòÉ
-----IBM Extension-----
The DROP statement releases a program device that has been acquired by a
TRANSACTION file.
ΓöîΓöÇΓöÇΓöÇ DROP STATEMENT - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
Program devices specified in a DROP statement must have been acquired by the
TRANSACTION file, either through an explicit ACQUIRE or through an implicit
ACQUIRE at OPEN time.
After successful execution of the DROP statement, the program device is no
longer available for input or output operations through the TRANSACTION file.
The device may be reacquired if necessary. The contents of the record area
associated with a released program device are no longer available, even if the
device is reacquired.
If the DROP statement is unsuccessful, any applicable USE AFTER EXCEPTION/ERROR
procedures are executed.
The DROP statement can also be used as an aid in recovering from I-O errors.
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 12.23. ENTER Statement ΓòÉΓòÉΓòÉ
The ENTER statement allows the use of more than one source language in the same
source program. It is syntax checked only.
ΓöîΓöÇΓöÇΓöÇ ENTER STATEMENT - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
The EXIT statement assigns a name to a given point in a program. The EXIT
statement has no other effect on the compilation or execution of the program.
The EXIT statement must be preceded by a paragraph-name and must appear in a
sentence by itself. This sentence must be the only sentence in the paragraph.
The EXIT statement is useful for documenting the end point in a series of
paragraphs. If an EXIT paragraph is written as the last paragraph in a
declarative procedure or a series of performed procedures, it identifies the
point to which control is transferred:
When control reaches an EXIT paragraph that is the end of a range of
procedures governed by an active PERFORM or USE statement, control is
transferred in accordance with the rules for that PERFORM or USE statement.
When control reaches an EXIT paragraph that is not the end of a range of
procedures governed by an active PERFORM or USE statement, control passes
through the EXIT statement to the first statement of the next paragraph.
Without an EXIT statement, the end of the sequence is difficult to determine,
unless you know the logic of the program.
ΓòÉΓòÉΓòÉ 12.26. EXIT PROGRAM Statement ΓòÉΓòÉΓòÉ
The EXIT PROGRAM statement specifies the end of a called program and returns
control to the calling program. It must not be used in the range of a global
declarative unless it is in a different program called by the statement in the
range of the global declarative.
ΓöîΓöÇΓöÇΓöÇ EXIT PROGRAM STATEMENT - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
A GOBACK statement should appear as the only statement, or as the last of a
series of imperative statements, in a sentence because statements following the
GOBACK statement are not executed.
If control reaches a GOBACK statement while a CALL statement is active, control
returns to the point in the calling program immediately following the CALL
statement, as in the EXIT PROGRAM statement.
The RETURN-CODE special register can be used to pass return code information
before executing a GOBACK statement. See RETURN-CODE Special Register.
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 12.28. GO TO Statement ΓòÉΓòÉΓòÉ
The GO TO statement transfers control from one part of the Procedure Division
to another.
The GOTO statement has three formats:
Format 1 - Unconditional
Format 2 - Conditional
Format 3 - Altered
If procedure-name or procedure-name-1 are within a declarative procedure,
neither can reference another declarative procedure or any nondeclarative
procedure. In the nondeclarative portion of the program, there must be no
reference to procedure-names that appear in an EXCEPTION/ERROR declarative
procedure, except that PERFORM statements may refer to an EXCEPTION/ERROR
procedure or procedures associated with it.
ΓòÉΓòÉΓòÉ 12.28.1. Unconditional GO TO ΓòÉΓòÉΓòÉ
An unconditional GO TO statement transfers control to the first statement in
the paragraph or section named in procedure-name, unless the GO TO statement
has been modified by an ALTER statement. (See ALTER Statement.)
ΓöîΓöÇΓöÇΓöÇ GO TO STATEMENT - FORMAT 1 - UNCONDITIONAL ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
An unconditional GO TO statement, when it appears in a sequence of imperative
statements, must be the last statement in the sequence.
When a paragraph is referred to by an ALTER statement, the paragraph must
consist of a paragraph-name followed by an unconditional or altered GO TO
statement.
ΓòÉΓòÉΓòÉ 12.28.2. Conditional GO TO ΓòÉΓòÉΓòÉ
The conditional GO TO statement transfers control to one of a series of
procedures, depending on the value of the data item referenced by the
identifier.
ΓöîΓöÇΓöÇΓöÇ GO TO STATEMENT - FORMAT 2 - CONDITIONAL ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
The altered GO TO statement transfers control to the first statement of the
paragraph named in the ALTER statement.
An ALTER statement referring to the paragraph containing this GO TO statement
must have been executed before this GO TO statement is executed.
ΓöîΓöÇΓöÇΓöÇ GO TO STATEMENT - FORMAT 3 - ALTERED ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
When an ALTER statement refers to a paragraph, the paragraph may consist only
of the paragraph-name followed by an unconditional or altered GO TO statement.
ΓòÉΓòÉΓòÉ 12.29. IF Statement ΓòÉΓòÉΓòÉ
The IF statement evaluates a condition and provides for alternative actions in
the object program, depending on the evaluation.
ΓöîΓöÇΓöÇΓöÇ IF STATEMENT - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
The composite of operands must not contain more than 18 digits.
-----IBM Extension-----
The composite of all operands in an arithmetic statement can have a maximum
length of 30 digits.
---End of IBM Extension---
Note: Intermediate results generated during the execution of a MULTIPLY
statement are system-specific and can affect program portability.
ΓòÉΓòÉΓòÉ 12.35. OPEN Statement ΓòÉΓòÉΓòÉ
The OPEN statement initiates the processing of files and checks or writes
labels.
The OPEN statement varies depending on the type of file.
The OPEN statement has three formats:
Format 1 - Sequential Files
Format 2 - Indexed and Relative Files
-----IBM Extension-----
Format 3 - TRANSACTION Files
---End of IBM Extension---
Related Information:
OPEN Statement Considerations
OPEN Statement Programming Notes
ΓòÉΓòÉΓòÉ 12.35.1. OPEN Statement - Format 1 - Sequential ΓòÉΓòÉΓòÉ
ΓöîΓöÇΓöÇΓöÇ OPEN STATEMENT - FORMAT 1 - SEQUENTIAL ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
For relative files only, the OPEN statement is not allowed for logical file
members:
That are based on more than one physical file
That contain select or omit logic
ΓòÉΓòÉΓòÉ 12.35.3. OPEN Statement - Format 3 - TRANSACTION ΓòÉΓòÉΓòÉ
-----IBM Extension-----
ΓöîΓöÇΓöÇΓöÇ OPEN STATEMENT - FORMAT 3 - TRANSACTION ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
OPEN INPUT SALES-DATA INVENTORY-DATA OUTPUT PRINTED-REPORT.
MOVE HIGH-VALUES TO PRODUCT-TABLE.
PERFORM READ-INVENTORY-DATA.
LOAD-TABLE-ROUTINE.
PERFORM LOAD-IT VARYING SUB1 FROM 1 BY 1 UNTIL SUB1 > 50
OR EOF-SW2 = "Y".
PERFORM 110-READ-IT.
200-MAIN-ROUTINE.
PERFORM PROCESS-DATA UNTIL EOF-SW = "Y".
MOVE TOTAL-COSTS TO TOTAL-COSTS-0.
PERFORM WRITE-REPORT THRU WRITE-REPORT-EXIT.
DISPLAY "RECORDS NOT FOUND - " RECORDS-NOT-FOUND
UPON MYTUBE.
STOP RUN.
PROCESS-DATA.
SEARCH ALL INVENTORY-NUMBERS
AT END PERFORM KEY-NOT-FOUND THRU NOT-FOUND-EXIT
WHEN ITEM-NUMBER (INDEX-1) = INVENTORY-NUMBER
MOVE ITEM-NUMBER (INDEX-1) TO OUTPUT-ITEM-NUMBER
MOVE ITEM-COST (INDEX-1) TO TOTAL-COSTS-0
ADD ITEM-COST (INDEX-1) TO TOTAL-COSTS
PERFORM WRITE-REPORT THRU WRITE-REPORT-EXIT.
PERFORM 110-READ-IT.
KEY-NOT-FOUND.
ADD 1 TO RECORDS-NOT-FOUND.
NOT-FOUND-EXIT.
EXIT.
LOAD-IT.
MOVE INVENTORY-RECORD TO INVENTORY-NUMBERS (SUB1).
PERFORM READ-INVENTORY-DATA.
WRITE-REPORT.
WRITE PRINTER-OUTPUT FROM PRINTER-SPECS.
WRITE-REPORT-EXIT.
EXIT.
READ-INVENTORY-DATA.
READ INVENTORY-DATA
AT END MOVE "Y" TO EOF-SW2.
110-READ-IT.
READ SALES-DATA INTO HOLD-INPUT-DATA
AT END MOVE "Y" TO EOF-SW.
ΓòÉΓòÉΓòÉ 12.43. SET Statement ΓòÉΓòÉΓòÉ
The SET statement can be used to:
Initialize the values of index-names or identifiers used to reference table
elements
Increment or decrement an index-name
Set the status of an external switch to ON or OFF
Move data to make conditional variable conditions true
-----IBM Extension-----
Set pointer and procedure-pointer data items and the ADDRESS OF special
register
---End of IBM Extension---
When the sending and receiving fields in a SET statement share part of their
storage (that is, the operands overlap), the result of the execution of such a
SET statement is undefined.
The SET statement has six formats:
Format 1 - TO Phrase
Format 2 - UP BY/DOWN BY Phrase
Format 3 - ON/OFF Phrase
Format 4 - TRUE Phrase
-----IBM Extension-----
Format 5 - Pointer Data Item
Format 6 - Procedure-pointer Data Item
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 12.43.1. Format 1 - Initializing Index-names, Identifiers ΓòÉΓòÉΓòÉ
When Format 1 of the SET statement is executed, the current value of the
receiving field is replaced by the value of the sending field (with
conversion).
ΓöîΓöÇΓöÇΓöÇ SET STATEMENT - FORMAT 1 ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
Γöé SENDING FIELD Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
Γöé Γöé INDEX-NAME Γöé INDEX DATA Γöé INTEGER DATA Γöé
Receiving fields are acted upon in the left-to-right order in which they are
specified. Any subscripting or indexing associated with an identifier's
receiving field is evaluated immediately before the field is acted upon.
The value used for the sending field is the value at the beginning of SET
statement execution.
The value for an index-name after execution of a SEARCH or PERFORM statement
may be undefined; therefore, a Format 1 SET statement should reinitialize such
index-names before other table-handling operations are attempted.
ΓòÉΓòÉΓòÉ 12.43.2. Format 2 - Adjusting Index Values ΓòÉΓòÉΓòÉ
When Format 2 of the SET statement is executed, the value of the receiving
field is increased (UP BY) or decreased (DOWN BY) by a value that corresponds
to the value in the sending field.
ΓöîΓöÇΓöÇΓöÇ SET STATEMENT - FORMAT 2 ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
When Format 2 of the SET statement is executed, the contents of the receiving
field are increased (UP BY) or decreased (DOWN BY) by a value that corresponds
to the number of occurrences represented by the value of identifier-3 or
integer-2. Receiving fields are acted upon in the left-to-right order in which
they are specified. The value of the incrementing or decrementing field at the
beginning of SET statement execution is used for all receiving fields.
ΓòÉΓòÉΓòÉ 12.43.3. Format 3 - Setting External Switches ΓòÉΓòÉΓòÉ
When Format 3 of the SET statement is executed, the status of each external
switch associated with the specified mnemonic-name is turned ON or OFF.
ΓöîΓöÇΓöÇΓöÇ SET STATEMENT - FORMAT 3 ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
ΓòÉΓòÉΓòÉ 12.43.4. Format 4 - Condition-names ΓòÉΓòÉΓòÉ
When Format 4 of the SET statement is executed, the value associated with a
condition-name is placed in its conditional variable.
ΓöîΓöÇΓöÇΓöÇ SET STATEMENT - FORMAT 4 ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
If more than one literal is specified in the VALUE clause of condition-name-1,
its associated conditional variable is set to the first literal.
If multiple condition-names are specified, the results are the same as if a
separate SET statement had been written for each condition-name in the same
order in which the condition-names are specified.
ΓòÉΓòÉΓòÉ 12.43.5. Format 5 - Pointer Data Item ΓòÉΓòÉΓòÉ
-----IBM Extension-----
When Format 5 of the SET statement is executed, the current value of the
receiving field is replaced by the address value contained in the sending
field.
ΓöîΓöÇΓöÇΓöÇ SET STATEMENT - FORMAT 5 ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
ΓòÉΓòÉΓòÉ 12.43.6. Format 6 - Procedure-Pointer Data Item ΓòÉΓòÉΓòÉ
-----IBM Extension-----
When Format 6 of the SET statement is executed, the current value of the
receiving field is replaced by the address value contained in the sending
field.
ΓöîΓöÇΓöÇΓöÇ SET STATEMENT - FORMAT 6 ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
Γöé ΓööΓöÇKEYΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓö¼ΓöÇEQUALΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöñ data Γö£ΓöÇΓöÿ Γöé
at execution ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
With the *CONTROL (or *CBL) statement, you can selectively display or suppress
the listing of source code throughout the source program.
ΓöîΓöÇΓöÇΓöÇ CONTROL (*CBL) STATEMENT - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
SKIP1, SKIP2, or SKIP3 causes one occurrence of double, triple, or quadruple
spacing.
SKIP1, SKIP2, or SKIP3 may be written anywhere in either Area A or Area B, and
may be terminated with a separator period. It must be the only statement on
the line.
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 12.56. TITLE Statement ΓòÉΓòÉΓòÉ
-----IBM Extension-----
The TITLE statement specifies a title to be printed at the top of each page of
the source listing produced during compilation. The title line is printed below
the line containing the identification of the compiler and the current release
level. The title is left-justified on the title line.
ΓöîΓöÇΓöÇΓöÇ TITLE STATEMENT - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
A title line is produced for each page in the listing produced by the LIST
option. This title line uses the last TITLE statement found in the source
statements or the default.
The word TITLE may begin in either Area A or Area B.
The TITLE statement may not be continued on another line.
The TITLE statement may appear anywhere in any of the divisions.
No other statement may appear on the same line as the TITLE statement.
---End of IBM Extension---
ΓòÉΓòÉΓòÉ 12.57. USE Statement ΓòÉΓòÉΓòÉ
The USE statement specifies procedures for input/output exception or error
handling that are to be executed in addition to the system-defined procedures.
Although the USE statement is a compiler-directing statement, it can appear
only in the Procedure Division, and it can begin only in Area B. (See
Precedence Rules for Nested Programs for information on using the GLOBAL
phrase.)
The USE statement has two formats:
Format 1 - USE AFTER EXCEPTION/ERROR
Format 2 - USE FOR DEBUGGING
ΓòÉΓòÉΓòÉ 12.57.1. USE Statement - Format 1 - EXCEPTION/ERROR ΓòÉΓòÉΓòÉ
The words EXCEPTION and ERROR are synonymous and may be used interchangeably.
ΓöîΓöÇΓöÇΓöÇ USE STATEMENT - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
Either after completing the system-defined input/output error routine, or
Upon recognition of an INVALID KEY or AT END condition when an INVALID KEY
or AT END phrase has not been specified in the input/output statement, or
Upon recognition of an IBM-defined condition that causes status key 1 to be
set to 9. (See Status Key.)
The EXCEPTION/ERROR procedures are activated when an input/output error occurs
during execution of a ACQUIRE, DROP, READ, WRITE, REWRITE, START, OPEN, CLOSE,
or DELETE statement. To determine what conditions are errors, see Common
Processing Facilities.
After execution of the EXCEPTION/ERROR Declarative procedure, control is
returned to the statement immediately following the input/output statement
which caused the error.
Within a declarative procedure, there must be no reference to any
nondeclarative procedures. In the nondeclarative portion of the program, there
must be no reference to procedure-names that appear in an EXCEPTION/ERROR
declarative procedure, except that PERFORM statements may refer to an
EXCEPTION/ERROR procedure or to procedures associated with it.
Within an EXCEPTION/ERROR declarative procedure, no statement should be
included that would cause execution of a USE procedure that had been
previously invoked and had not yet returned control to the invoking routine.
Related Information:
USE Statement Programming Notes
ΓòÉΓòÉΓòÉ 12.57.2. USE Statement Programming Notes ΓòÉΓòÉΓòÉ
EXCEPTION/ERROR Declarative procedures can be used to check the status key
values whenever an input/output error occurs. Additional information about the
file causing the error can be obtained by using data from the mnemonic-names
OPEN-FEEDBACK and I-O-FEEDBACK.
Care should be used in specifying EXCEPTION/ERROR Declarative procedures for
any file. Prior to successful completion of an initial OPEN for any file, the
current Declarative has not yet been established by the object program.
Therefore, if any other I-O statement is executed for a file that has never
been opened, no Declarative can receive control. However, if this file has
been previously opened, the last previously established Declarative procedure
receives control.
For example, an OPEN OUTPUT statement establishes a Declarative procedure for
this file, and the file is then closed without error. During later processing,
if a logic error occurs, control will go to the Declarative procedure
established when the file was opened OUTPUT.
Error Handling: If there is an applicable file status clause (but not an
applicable USE procedure) when an I-O error occurs, the file status is updated,
and control returns to the program. In the absence of a file status clause, USE
procedure (implicit or explicit), AT END phrase, or INVALID KEY phrase to
handle the error, a run-time message is issued, giving you the option to end or
return to the program.
ΓòÉΓòÉΓòÉ 12.57.3. Precedence Rules for Nested Programs ΓòÉΓòÉΓòÉ
Special precedence rules are followed when programs are contained within other
programs. In applying these rules, only the first qualifying declarative will
be selected for execution. The declarative that is selected must satisfy the
rules for execution of that declarative. The order of precedence for selecting
a declarative is:
1. A file-specific declarative (one of the form USE AFTER ERROR ON
file-name-1) within the program that contains the statement that caused
the qualifying condition
2. A mode-specific declarative (one of the form USE AFTER ERROR ON INPUT)
within the program that contains the statement that caused the qualifying
condition
3. A file-specific declarative that specifies the GLOBAL phrase, and is
within the program directly containing the program that was last examined
for a qualifying condition
4. A mode-specific declarative that specifies the GLOBAL phrase, and is
within the program directly containing the program that was last examined
for a qualifying condition.
5. Rules 3 and 4 apply recursively back through the parents in the nest of
programs.
Note: Each declarative procedure runs as a separate invocation from that of
other declarative procedures and the nondeclarative part of the same ILE
COBOL/400 program.
ΓòÉΓòÉΓòÉ 12.57.4. USE FOR DEBUGGING ΓòÉΓòÉΓòÉ
The USE FOR DEBUGGING declarative identifies the items in the source program
that are to be monitored by the associated debugging procedure. It establishes
a procedure to run when certain errors occur, or when certain items or files
change.
The USE FOR DEBUGGING declarative is syntax checked and treated as
documentation.
ΓöîΓöÇΓöÇΓöÇ USE FOR DEBUGGING DECLARATIVE - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
This statement is compiled only when you are in debugging mode.
The compiler treats all statements that follow this one as comments until the
next valid USE AFTER EXCEPTION/ERROR statement or END DECLARATIVES delimiter is
reached.
ΓòÉΓòÉΓòÉ 12.58. PROCESS Statement ΓòÉΓòÉΓòÉ
The PROCESS statement is an optional part of the COBOL source program. It lets
you specify options that you would normally specify at compilation time.
Options specified in the PROCESS statement override the corresponding options
specified in the CRTCBLMOD or CRTBNDCBL CL command.
The format of the PROCESS statement is as follows:
ΓöîΓöÇΓöÇΓöÇ PROCESS STATEMENT - FORMAT ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ