Technical data
4.2 Explicit and Implicit Scope Terminators
Scope terminators delimit the scope of some Procedure Division statements.
Explicit scope terminators for database programs are as follows:
END-COMMIT END-FIND END-READY
END-CONNECT END-FREE END-RECONNECT
END-DISCONNECT END-GET END-ROLLBACK
END-ERASE END-KEEP END-STORE
END-FETCH END-MODIFY
Implicit scope terminators are as follows:
• At the end of a sentence: the separator period. It terminates the scope of all
previously unterminated statements.
• In a statement containing another statement: the next phrase of the
containing statement after the contained statement terminates the scope of
all unterminated contained statements. Examples are ELSE and WHEN.
4.3 Scope of Names
A contained COBOL program can refer to a user-defined word in its containing
program if the user-defined word has the global attribute. (See the section on
User-Defined Words.) Some user-defined words always have the global attribute,
some never have the attribute (that is, they are local), and some may or may not,
depending on the use of the GLOBAL clause. The following rules explain how to
use different kinds of user-defined words and what kinds of local and global name
scoping to expect.
User-defined words in the Subschema Section are always global. The program
defining this section and in any program it contains can reference these
user-defined words:
• Data-name
• Keeplist-name
• Realm-name
• Record-name
• Set-name
4.4 Database Key Identifiers
Database key identifiers are indicated by the reserved words CURRENT,
OFFSET, FIRST, and LAST as shown in the two formats below. FETCH
and FIND may use database key identifiers to access database data records.
Conditional clauses may also use them.
General Formats
Format 1—Currency Indicator Access
CURRENT WITHIN
record-name
set-name
realm-name
4–4 Procedure Division