Language Structure [ Micro Focus COBOL Language Reference ] MPE/iX 5.0 Documentation
Micro Focus COBOL Language Reference
Language Structure
The individual characters of the language are concatenated to form
character-strings and separators. A separator can be concatenated with
another separator or with a character-string. A character-string can
be concatenated only with a separator. The concatenation of
character-strings and separators forms the text of a source program.
Separators
A separator is a string of one or more punctuation characters. The rules
for formation of separators are:
1. The punctuation character space is a separator. Wherever a space
is used as a separator or as part of a separator, more than one
space can be used. All spaces immediately following the
separators comma, semicolon, or period are considered part of that
separator and are not considered to be the separator space.
2. Except when the comma is used in a PICTURE character-string, the
punctuation characters comma and semicolon, immediately followed
by a space, are separators that can be used anywhere the separator
space is used.
3. The punctuation character period, when followed by a space, is a
separator. It must be used only to indicate the end of a
sentence, or as shown in formats.
4. The punctuation characters right and left parenthesis are
separators. Except in pseudo-text, parenthesescan appear only in
balanced pairs of left and right parentheses delimiting
subscripts, a list of function arguments, reference modifiers
(ANS85 only), arithmetic expressions, or conditions.
5. The punctuation character quotation mark is a separator. An
opening quotation mark must be immediately preceded by a space,
left parenthesis or opening pseudo-text delimiter. A closing
quotation mark, when paired with an opening quotation mark, must
be immediately followed by one of the separators space, comma,
semicolon, period, right parenthesis, or closing pseudo-text
delimiter. If either of these separators immediately precedes or
follows the quotation mark, it is not a part of the separator.
6. For OSVS, VSC2, and MF only: The punctuation character apostrophe
is a separator which can be used throughout a program in place of
the quotation mark character
For MF only: Both the quotation mark and the apostrophe can
appear within the same program. If they do, they must be in
balanced pairs.
7. Pseudo-text delimiters are separators. An opening pseudo-text
delimiter must be immediately preceded by a space; a closing
pseudo-text delimiter must be immediately followed by one of the
separators space, comma, semicolon, or period.
For MF only: The space immediately preceding the opening
pseudo-text delimiter can be omitted.
Pseudo-text delimiters can appear only in balanced pairs
delimiting pseudo-text. (See the chapter Compiler-Directing
Statements.)
8. The separator space can immediately precede all separators except
the following:
a. As specified by reference format (see the section Reference
Format in the chapter Concepts of a COBOL Program).
b. The separator closing quotation mark. In this case, a
preceding space is considered as part of the nonnumeric
literal and not as a separator.
c. The opening pseudo-text delimiter, where the preceding
space is required.
9. The separatorspace can optionally immediately follow any separator
except the opening quotation mark. In this case, a following
space is considered as part of the nonnumeric literal and not as a
separator.
Any punctuation character which appears as part of the specification of a
PICTURE character-string (see the chapter Program Definition) or numeric
literal is not considered to be a punctuation character, but rather a
symbol. PICTURE character-strings are delimited only by the separators
space, comma, semicolon, or period.
The rules established for the formation of separatorsdo not apply to the
characters which comprise the contents of nonnumeric literals,
comment-entries, or comment lines.
Character-strings
A character-stringis a character or a sequence of contiguous characters
forming a COBOL word, a literal, a PICTURE character-string, or a
comment-entry. A character-string is delimited by separators.
COBOL Words
For ANS85 only: A COBOL word is a character-string of not more than 30
characters which forms a user-defined word, a system-name, a reserved
word, or a function-name. Each character of a COBOL word that is not a
special character word is selected from the set of letters, digits, and
the hyphen; the hyphen may not appear as the first or last character in
such words. Each lowercase letter is considered to be equivalent to its
corresponding uppercase letter.
For ANS85 only: Within a source program the following apply
1. For all COBOL words excluding the words LENGTH, RANDOM, and SUM:
a. Reserved words form disjoint sets with user-defined words,
system-names and function-names.
b. User-defined words, system-names and function-names form
intersecting sets. The same COBOL word may be used as a
user-defined word, a system-name and a function-name. The
classification of a specific occurrence of such COBOL words
is determined by the context of the clause or phrase in
which it occurs.
2. For the COBOL words LENGTH, RANDOM, and SUM:
a. The reserved words LENGTH, RANDOM and SUM form an identical
set with the function-names LENGTH, RANDOM and SUM. The
same COBOL word LENGTH, RANDOM, or SUM may be used as a
function-name and as a reserved word. The classification
of a specific occurrence of such COBOL words is determined
by the context in which it occurs.
b. The COBOL words LENGTH, RANDOM, and SUM form disjoint sets
with user-defined words and system-names. They may not be
used as a system-name or user-defined word regardless of
context.
User-Defined Words: A user-defined wordis a COBOL word that must be
supplied by the user to satisfy the format of a clause or statement.
Each character of a user-defined word is selected from the set of
characters "A", "B", "C",..."Z",
For ANS85 only: "a", "b", "c",..."z" which are interpreted as equivalent
to uppercase,
"0",..."9", and "-", except that the "-" can not appear as the first or
last character.
User-defined wordtypes which are implemented are as follows:
alphabet-name
cd-name
class-name (ANS85)
condition-name
constant-name (MF)
data-name
file-name
index-name
level-number
library-name
mnemonic-name
paragraph-name
program-name
record-name
report-name
routine-name (MF only)
screen-name (MF and XOPEN only)
section-name
segment-number
split-key-name (MF only)
symbolic-character (ANS85 only)
text-name
typedef-name (MF only).
Within a given source program, 21 of these 23 types of user-defined words
are grouped into 16 disjoint sets. The disjoint sets are:
alphabet-names
cd-names
class-names (ANS85 only)
condition-names, constant-names (MF only) data-names,
record-names, split-key-names, typedef-name (MF only)
file-names
index-names
library-names
mnemonic-names
paragraph-names
program-names
report-names
routine-names (MF only)
screen-names (MF only)
section-names
symbolic-characters
text-names.
All user-defined words, except segment-numbers and level-numbers, can
belong to one and only one of these disjoint sets. Furthermore, all
user-defined words within a given disjoint set must be unique. (See the
section Uniqueness Of Reference in this chapter.)
With the exception of paragraph-name, section-name, level-number and
segment-number, all user-defined wordsmust contain at least one
alphabetic character or one occurrence of the hyphen character (MF only)
Segment-numbers and level-numbers need not be unique; a given
specification of a segment-number or level-number can be identical to any
other segment-number or level-number and can even be identical to a
paragraph-name or section-name.
Condition-Name: A condition-name is a namewhich is assigned to a
specific value, set of values, or range of values,
within a complete set of values that a data item can
assume. The data item itself is called a
conditional variable. Condition-names can be
defined in the Data Division or in the SPECIAL-NAMES
paragraph within the Environment Division where a
condition-name must be assigned to one or both of
the ON STATUS or OFF STATUS of the run-time
switches.
A condition-name is used only as follows:
* in the RERUN clause;
* in conditions as an abbreviation for a relation
condition. This relation condition posits that the
associated conditional variable is equal to one of
the set of values to which that condition-name is
assigned.
* in a SET statement indicating that the associated
value is to be moved to the conditional variable.
Constant-Name: A constant-nameis a name which is assigned as the
name of a fixed value (MF only).
Mnemonic-Name: A mnemonic-nameassigns a user-defined word to an
implementor-name. These associations are
established in the SPECIAL-NAMES paragraph of the
Environment Division. (See the section The
SPECIAL-NAMES Paragraph in the chapter Program
Definition.)
Paragraph-Name: A paragraph-nameis a word that names a paragraph in
the Procedure Division. Paragraph-names are
equivalent if, and only if, they are composed of the
same sequence of the same number of characters.
Section-Name: A section-name is a word that names a section in the
Procedure Division. Section-names are equivalent
if, and only if, they are composed of the same
sequence of the same number of characters.
Other User-Defined See The Glossary for definitions of all other types
Words: of user-defined words.
System-Names: A system-name is a COBOL word that is used to communicate
with the operating environment. Each character of a system-name is
selected from the set of characters "A", "B", "C",..."Z", "a", "b",..."z"
(ANS85 only), "0"..."9" and "-" , except that the `-' may not appear as
the first or last character.
System-names must contain at least one alphabetic character or one
occurence of the hyphen character (MF only)
There are three types of system-names:
1. computer-name
2. implementor-name
3. language-name.
Within a given implementation these three types of system-names form
disjoint sets; a given system-name can belong to one and only one of
them.
The system-names listed above are individually defined in The Glossary.
Function-Names A function-nameis a word that is one of a specified
(ANS85 only): list of words which can be used in COBOL source
programs. The same word, with the exception of
LENGTH, RANDOM and SUM, in a different context, can
appear in a program as a user-defined wordor a
system- name. (See the section Definitions of
Functions in the chapter Program Definition.)
Reserved Words: A reserved word is a COBOL word that is one of a
specified list of words which can be used in COBOL source programs, but
which must not appear in the programs as user-defined wordsor
system-names. Reserved words can be used only as specified in the
general formats. (See the appendix Reserved Words.)
There are five types of reserved words:
1. key words
2. optional words
3. special registers
4. figurative constants
5. special-character words.
Key Words: A key word is a word whose presence is required when
the format in which it appears is used in a source
program. Within each format, such words are
uppercase and underlined.
Key words are of three types:
1. verbs such as ADD, READ, and ENTER
2. required words, which appear in statement and
entry formats
3. words which have a specific functional
meaning, such as NEGATIVE, SECTION, and so
on.
Optional Words: Within each format, uppercase words that are not
underlined are called optional words and can appear
at the user's discretion. The presence or absence
of an optional word does not alter the semantics of
the COBOL program in which it appears.
Special Registers: Certain words are used to name and reference special
registers: special registers are certain storage
areas created by your COBOL system, whose primary
use is to store information produced in conjunction
with the use of specific COBOL features. These
special registers include LINAGE-COUNTER (see the
chapter Program Definition) and DEBUG-ITEM (see the
chapter Debug Module in your Language Reference -
Additional Topics). They are specified in the
section Special Registers later in this chapter.
Figurative Certain reserved words are used to nameand reference
Constants: specific constant values. These reserved words are
specified in the section Figurative Constant Values
later in this chapter.
Special Character The arithmetic operators and relation characters are
Words: reserved words.
Scope of Names (ANS85 only).
When programs are directly or indirectly contained within other programs,
each program can use identical user-defined words to name objects
independent of the use of these user-defined words by other programs.
When identically named objects exist, a program's reference to such a
name, even when it is a different type of user-defined word, is to the
object that that program describes rather than to the object possessing
the same name, described in another program.
The following types of user-defined words can be referenced only by
statements and entries in that program in which the user-defined word is
declared:
* cd-name
* paragraph-name
* section-name.
The following types of user-defined words can be referenced by any COBOL
program:
* library-name
* text-name.
The following types of user-defined words, when declared in a
Communication Section, can be referenced only by statements and entries
in the program that contains that section:
* condition-name
* data-name
* record-name.
The following types of names, when declared in a Configuration Section,
can be referenced only by statements and entries either in a program that
contains a Configuration Section or in any program contained within that
program:
* alphabet-name
* class-name
* condition-name
* mnemonic-name
* symbolic-character.
Specific conventions, for declarations and references, apply to the
following types of user-defined words when the conditions listed above do
not apply:
* condition-name
* data-name
* file-name
* index-name
* program-name
* record-name
* report-name.
Conventions for Program-names (ANS85 only).
The program-name of a program is declared in the Program-ID paragraph of
the program`s Identification Division. A program-name can be referenced
only by the CALL statement, the CHAIN statement (MF only), the CANCEL
statement, and the END PROGRAM header. If two programs in a run unit are
identically named, at least one of those two programs must be directly or
indirectly contained within a separate program which does not contain the
other of those two programs.
The following rules regulate the scope of a program-name:
1. If the program-name is that of a program which does not possess
the common attribute and which is directly contained within
another program, that program-name can be referenced only by
statements included in that containing program.
2. If the program-name is that of a program which does possess the
common attribute and which is directly contained within another
program, that program-name can be referenced only by statements
included in that containing program and any programs directly or
indirectly contained within that containing program, except that
program possessing the common attributes and any programs
contained within it.
3. If the program-name is that of a program which is separately
compiled, it can be referenced by statements included in any other
program in the run unit, except those it directly or indirectly
contains.
Conventions for Condition-names, Data-names, File-names, Record-names
and.
Report-Names (ANS85 only)
When condition-names, data-names, file-names, record-names and
report-names are declared in a source program, they can be referenced
only by that source program unless one or more of the names is global and
the program contains other programs.
The requirements governing the uniqueness of the names allocated by a
single program to be condition-names, data-names, file-names,
record-names and report-names are explained in the section User-Defined
Words earlier in this chapter.
A program cannot reference any condition-name, data-name, file-name,
record-name or report-name declared in any program it contains.
A global name can be referenced in the program in which it is declared or
in any programs which are directly or indirectly contained within that
program.
When a program, program B, is directly contained within another program,
program A, both programs can define a condition-name, a data-name, a
file-name, a record-name or a report-name using the same user-defined
word. When such a duplicate-name is referenced in program B, the
following rules are used to determine the referenced object:
1. The set of names to be used for determination of a referenced
object consists of all names that are defined in program B and all
global names that are defined in program A and in any programs
which directly or indirectly contain program A. Using this set of
names, the normal rules for qualification and any other rules for
uniqueness of reference are applied until one or more object is
identified.
2. If only one object is identified, it is the referenced object.
3. If more than one object is identified, no more than one of them
can have a name local to program B. If zero or one of the objects
has a name local to program B, the following rules apply:
a. If the name is declared in program B, the object in program
B is the referenced object.
b. Otherwise, if program A is contained within another
program, the referenced object is:
i. The object in program A if the name is declared in
program A.
ii. The object in the containing program if the name is
not declared in program A and is declared in the
program containing program A. This rule is applied
to further containing programs until a single valid
name has been found.
Conventions for Index-names (ANS85 only).
If a data item possessing the global attribute inclues a table described
with an index-name, that index-name also possesses the global attribute.
Therefore, if a table is global, then any index-name defined in it is
also global. If a table is not global, its index-names are also not
global.
Index-names cannot be qualified.
For OSVS only: Index-names can be qualified.
Literals
A literalis either:
* a character-string whose value is implied by the ordered set of
characters of which it is composed
* a reserved word which references a figurative constant
* For MF only: a user-defined word which references a constant
value.
Every literal belongs to one of two types; nonnumeric or numeric.
Nonnumeric Literals.
A nonnumeric literalis a character-string delimited at both ends by
quotation marks or apostrophes, (OSVS, MF and VSC2 only) and consisting
of any allowable character in the computer's character set.
Nonnumeric literals may be of 1 to 160 characters in length. Whether
quotation marks or apostrophes (OSVS, VSC2 and MF only) are used as
delimiters, the presence of that delimiter within a nonnumeric literal
can be represented by two contiguous occurrences. The presence of the
character that is not serving as the delimiter is represented by a single
occurrence. The value of a nonnumeric literal in the object program is
the string of characters itself, except:
* the delimiting quotation marks are excluded, and
* each embedded pair of contiguous delimiter characters represents a
single character.
All other punctuation characters are part of the value of the nonnumeric
literal rather than separators; all nonnumeric literals are category
alphanumeric. (See the section The PICTURE Clause in the chapter Program
Definition.)
For MF and VSC2 only: In addition, hexadecimal binary values can be
attributed to nonnumeric literals by expressing literals as: X"nn",
where each n is a hexadecimal character in the set 0-9 A-F; nn can be
repeated up to 160 times, but the number of hex digits must be even.
Numeric Literals.
A numeric literalis a character-string whose characters are selected from
the digits "0" through "9" , the plus sign, the minus sign, and the
decimal point. This implementation allows for numeric literals of 1 to
18 digits in length. The rules for the formation of numeric literals are
as follows:
* A literal must contain at least one digit.
* A literal must not contain more than one sign character. If a
sign is used, it must appear as the leftmost character of the
literal. If the literal is unsigned, the literal is positive.
* A literal must not contain more than one decimal point. The
decimal point is treated as an assumed decimal point, and can
appear anywhere within the literal except as the rightmost
character. If the literal contains no decimal point, the literal
is an integer.
* The value of a numeric literal is the algebraic quanitity
represented by the characters in the numeric literal. Every
numeric literal is category numeric. (See the section The PICTURE
Clause in the chapter Program Definition.)
If a literal conforms to the rules for the formation of numeric literals,
but is enclosed in quotation marks, it is a nonnumeric literal and is
treated as such by your COBOL system.
The size of a numeric literal in standard data format characters is equal
to the number of digits specified by the user.
For MF only: In addition, hexadecimal binary values can be attributed to
numeric literals by expressing literals as: H" nn", where each n is a
hexadecimal character in the set 0-9 A-F; nn can be repeated up to 8
times, but the number of hex digits must be even.
For MF, OSVS, and VSC2 only: Numeric literalscan be either fixed-point
or floating-point numbers.
For MF, OSVS, and VSC2 only: A floating-point literalis written in the
form.
For MF, OSVS, and VSC2 only: The sign is optional before the mantissa
and the exponent: if you omit the sign, the system assumes a positive
number.
For MF, OSVS, and VSC2 only: The mantissa can contain between 1 and 16
digits. A decimal point must be included in the mantissa.
For MF, OSVS, and VSC2 only: The exponent is represented by an E
followed by an optional sign and one or two digits.
For MF, OSVS, and VSC2 only: The magnitude of a floating-point literal
value must fall between 0.54E-78 and 0.72E+76. For values outside this
range, a diagnostic will be produced and the value will be replaced by 0
or 0.72E+76 respectively. You must not use a floating-point literal when
an integer literal is required.
Figurative Constant Values
Figurative constant valuesare generated by your COBOL system and
referenced through the use of the reserved words given below. These
words must not be bounded by quotation marks when used as figurative
constants. The singular and plural forms of figurative constants are
equivalent and can be used interchangeably.
The figurative constant values and the reserved words used to reference
them are shown in Table 2-1.
Table 2-1: Figurative Constants and Their Reserved Words
-----------------------------------------------------------
| | |
| Constant | Representation |
| | |
-----------------------------------------------------------
| | |
| ZERO ZEROS | Represents the value "0",, or one or |
| ZEROES | more of the character "0" depending |
| | on the context. |
| | |
-----------------------------------------------------------
| | |
| SPACE SPACES | Represents one or more of the |
| | character space from the computer's |
| | character set. |
| | |
-----------------------------------------------------------
| | |
| HIGH-VALUE | Represents one or more of the |
| HIGH-VALUES | character that has the highest |
| | ordinal position in the program |
| | collating sequence. (x"FF" for the |
| | extended ASCII character set.) |
| | |
-----------------------------------------------------------
| | |
| LOW-VALUE | Represents one or more of the |
| LOW-VALUES | character that has the lowest ordinal |
| | position in the program collating |
| | sequence. (x"00" for the ASCII |
| | character set.) |
| | |
-----------------------------------------------------------
| | |
| QUOTE \QUOTES | Represents one or more of the |
| | character "" ".The word QUOTE or |
| | QUOTES cannot be used in place of a |
| | quotation mark in a source program to |
| | bound a nonnumeric literal. Thus |
| | QUOTE ABD QUOTE is incorrect as a way |
| | of stating "ABD". |
| | |
-----------------------------------------------------------
| | |
| ALL literal | Represents one or more characters of |
| | the string of characters comprising |
| | the literal. The literal must be |
| | either a nonnumeric literal or a |
| | figurative constant other than ALL |
| | literal. When a figurative constant |
| | is used, the word ALL is redundant |
| | and is used for readability only. |
| | |
-----------------------------------------------------------
| | |
| NULL NULLS | Represents one or more unset pointer |
| (VSC2 and MF | or procedure-pointer (MF only) |
| only) | values. A data item with USAGE |
| | POINTER or PROCEDURE-POINTER (MF |
| | only) and with a value of NULL is |
| | guaranteed not to represent the |
| | address of any data item or |
| | procedure (MF only). |
| | |
| | The NULL value varies between |
| | environments and is gererally |
| | consistent with the equivalent value |
| | used in non-COBOL languages for each |
| | evnironment. |
| | |
-----------------------------------------------------------
When a figurative constant represents a string of one or more characters,
the length of the string is determined by your COBOL system from context
according to the following rules:
1. When a figurative constantis either specified in a VALUE clause,
or associated with another data item, (for example, when the
figurative constant is moved to or compared with another data
item), the string of characters specified is repeated character by
character on the right until the size of the resultant string is
greater than or equal to the number of character positions in the
associated data item. This resultant string is then truncated
from the right until the number of character positions remaining
is equal either to 1 or to the number of character positions in
the associated data item, whichever is greater. This is done
prior to and independent of the application of any JUSTIFIED
clause that can be associated with the data item.
2. When a figurative constant, other than ALL literal, is not
associated with another data item (for example, when the
figurative constant appears in a DISPLAY, STRING, STOP or UNSTRING
statement) the length of the string is one character.
3. When the figurative constant ALL literal is not associated with
another data item, the length of the string is the length of the
literal.
For MF only: Use of figurative constants in Format 3 DISPLAY
statements has specific effects, described in the General Rules
for that statement.
A figurative constant can be used wherever a literal appears in a format,
except that whenever the literal is restricted to having only numeric
characters in it, the only figurative constant permitted is ZERO (ZEROS,
ZEROES).
When the figurative constants HIGH-VALUE(S) or LOW-VALUE(S) are used in
the source program, the actual character associated with each figurative
constant depends upon the program collating sequence specified. (See the
sections The OBJECT-COMPUTER Paragraph and The SPECIAL-NAMES Paragraph in
the chapter Program Definition.)
Each reserved word that is used to reference a figurative constant value
is a distinct character-string, with the exception of the construction
"ALL literal" which is composed of two distinct character-strings.
For MF, OSVS, and VSC2 only: The value associated with the
QUOTE/QUOTESfigurative constant is sensitive to the APOSTand
QUOTEdirectives. See your COBOL System Reference for details.
For ANS85 only: The figurative constant ALL literal, when associated
with a numeric or numeric edited item, and when its length is greater
than one, 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.
For MF only: All dialects within this COBOL implementation fully support
ALL literal syntax. Refer to your COBOL System Reference for details on
using the FLAGSTD directive to detect all occurrences of this syntax.
For XOPEN only: Although this obsolete ALL literal syntax is a part of
the standard COBOL definition, this syntax is explicity excluded from the
X/Open COBOL language definitions and should not be used in a conforming
X/Open COBOL source program
NOTE For OSVS, VSC2 and MF only: You must not use a floating-point
literal when an integer literal is required.
Constant-Names (MF only)
Constant-names are user-defined words described in the DATA DIVISION in
level-78 data description entries. A constant-name may be used wherever
a literal appears in a format. Its effect is as if the literal in the
VALUE clause of its data description as its value had been written
instead. A constant-name with an integer value can also be used wherever
a format requires an integer; for example, as a level number or segment
number, or in a PICTURE character-string.
A constant-name can only be used after it has been described; that is, it
cannot be the object of a forward reference.
Concatenation Expressions (MF and XOPEN only)
Definition of the Concatenation Operator.
The concatenation operator is used in concatenation expressions. It is
represented by the character "&", which must be immediately preceded and
followed by the separator space.
Definition of a Concatenation Expression.
A concatenation expression is a combination of any two of the following
(either of the same or separate groups): nonnumeric literals, figurative
constants, hexadecimal literals, named constants or concatenation
expressions. The two must be separated by the concatenation operator.
Concatenation Formation and Evaluation Rules.
1. The values of a concatenation expression is the concatenation of
the values of the literals and constants it comprises. The
separators that delimit the literals and the separator spaces that
precede and follow the concatenation operator are not part of the
value of the concatenation expression.
2. A concatenation expression is exactly equivalent to a nonnumeric
literal with the same value, and can be used anywhere a nonnumeric
literal can be used.
Special Registers (MF, OSVS and VSC2 only)
Special Registers are data items generated by your COBOL system and
referred through the use of their associated names (see Table 2-2).
These Special Registers are subject to special rules of reference and
have implicit data descriptions (PICTURES), as individually described.
See the section COBOL Words earlier in this chapter.
Table 2-2: Special Registers
--------------------------------------------------------------
| | | |
| Special | Implicit | Usage |
| Register | Data | |
| | Description | |
| | Picture | |
| | | |
--------------------------------------------------------------
| | | |
| ADDRESS OF (MF | USAGE IS | An ADDRESS special |
| and VSC2 only) | POINTER | register exists for each |
| | | 01 and 77 level item in |
| | | the Linkage and |
| | | Working-storage Section. |
| | | The value of the special |
| | | register is the address of |
| | | the record. |
| | | |
--------------------------------------------------------------
| | | |
| CURRENT-DATE1 | X(8) | The CURRENT-DATE special |
| (OSVS only) | | register contains the |
| | | value of the current date |
| | | (as supplied by the COBOL |
| | | program execution |
| | | environment), in the form: |
| | | MM/DD/YY |
| | | whereMM is the month |
| | | number, DD is the day of |
| | | the month, and YY is the |
| | | year number (from 1900). |
| | | CURRENT-DATE is valid only |
| | | as the sending area of a |
| | | MOVE statement. |
| | | |
--------------------------------------------------------------
| | | |
| LENGTH OF2 | 9(9) | The LENGTH OF special |
| (VSC2 and MF | | register contains the |
| only) | | number of bytes used by an |
| | | identifier. LENGTH OF |
| | | creates an implicit |
| | | special register whose |
| | | content is equal to the |
| | | current byte length of the |
| | | data item referenced by |
| | | the identifier. |
| | | |
--------------------------------------------------------------
Table 2-2: Special Registers (Continued)
--------------------------------------------------------------
| | | |
| Special | Implicit | Usage |
| Register | Data | |
| | Description | |
| | Picture | |
| | | |
--------------------------------------------------------------
| | | |
| RETURN-CODE3 | S9(4) COMP | The RETURN-CODE special |
| (OSVS, VSC2, | | register can: |
| and MF only) | S9(8) COMP | |
| | (XOPEN) | be set by a program,, |
| | | prior to the execution of |
| | | a STOP RUN, EXIT PROGRAM |
| | | or GOBACK statement, to |
| | | pass a value to the |
| | | invoking program (or the |
| | | execution environment) |
| | | |
| | | be read, subsequent to a |
| | | CALL to another COBOL |
| | | program, to obtain the |
| | | RETURN-CODE set by that |
| | | CALLed program. |
| | | |
| | | A program's RETURN-CODE is |
| | | set to zero when that |
| | | program is first entered. |
| | | The RETURN-CODE is valid |
| | | as a data-name in a |
| | | Procedure Division |
| | | statement wherever an |
| | | elementary data item can |
| | | be referenced. |
| | | |
--------------------------------------------------------------
| | | |
| SHIFT-IN (VSC2 | X(1) | Used to switch the |
| only) | | character representation |
| | | from double byte |
| | | characters (DBCS) back to |
| | | single byte characters |
| | | (SBCS) in environments |
| | | where this is applicable. |
| | | |
--------------------------------------------------------------
| | | |
| SHIFT-OUT | X(1) | Used to switch the |
| (VSC2 only) | | character representation |
| | | from single byte |
| | | characters (SBCS) to |
| | | double byte characters |
| | | (DBCS) in environments |
| | | where this is applicable. |
| | | |
--------------------------------------------------------------
Table 2-2: Special Registers (Continued)
--------------------------------------------------------------
| | | |
| Special | Implicit | Usage |
| Register | Data | |
| | Description | |
| | Picture | |
| | | |
--------------------------------------------------------------
| | | |
| SORT-CONTROL | X(8) S9(8) | These items can be |
| (VSC2 only) | COMP S9(8) | referenced in the |
| SORT-CORE-SIZE | COMP X(8) | Procedure Division but |
| SORT-FILE-SIZE | S9(5) COMP | will contain either zeros |
| SORT-MESSAGE | | (for numeric registers) or |
| SORT-MODE-SIZE | | spaces (for alphanumeric |
| | | registers) (OSVS and VSC2 |
| | | only) |
| | | |
--------------------------------------------------------------
| | | |
| SORT-RETURN | S9(4) COMP | SORT-RETURN can be used to |
| | | cause an abnormal |
| | | termination of a SORT |
| | | procedure. If a value of |
| | | 16 is moved into this |
| | | field,, the SORT operation |
| | | will be terminated after |
| | | the next RELEASE or RETURN |
| | | (MF, OSVS, and VSC2 only) |
| | | |
--------------------------------------------------------------
| | | |
| TALLY | 9(5) COMP | The TALLY special register |
| | | contains information |
| | | produced by the |
| | | EXAMINE...TALLYING |
| | | statement. It is valid as |
| | | a data-name in a Procedure |
| | | Division statement |
| | | wherever an elementary |
| | | data item can be |
| | | referenced (OSVS and VSC2 |
| | | only) |
| | | |
--------------------------------------------------------------
| | | |
| TIME-OF DAY | 9(6) DISPLAY | The TIME-OF-DAY special |
| | | register contains the |
| | | value of the current time |
| | | of day (24-hour clock) (as |
| | | supplied by the COBOL |
| | | program execution |
| | | environment), in the form: |
| | | hhmmss |
| | | where hh=hour, |
| | | mm=minutes,, and |
| | | ss=seconds. TIME-OF-DAY |
| | | is valid only as the |
| | | sending area of a MOVE |
| | | statement. (OSVS only) |
| | | |
--------------------------------------------------------------
Table 2-2: Special Registers (Continued)
--------------------------------------------------------------
| | | |
| Special | Implicit | Usage |
| Register | Data | |
| | Description | |
| | Picture | |
| | | |
--------------------------------------------------------------
| | | |
| WHEN- COMPILED | X(20) | The WHEN-COMPILED special |
| | | register contains the time |
| | | and date that the COBOL |
| | | program was submitted to |
| | | your COBOL system, in the |
| | | form: |
| | | hh.mm.ssMMM DD, YYYY |
| | | where hh=hours (24-hour |
| | | clock), mm=minutes, |
| | | ss=seconds, MMM=month name |
| | | (first 3 characters), |
| | | DD=day of month, and |
| | | YYYY=year. (OSVS only) |
| | | |
| | | WHEN-COMPILED is valid |
| | | only as the sending area |
| | | of a MOVE statement. |
| | | (OSVS only) |
| | | |
--------------------------------------------------------------
| | | |
| WHEN- COMPILED | X(20) | The WHEN-COMPILED special |
| | | register contains the time |
| | | and date that the COBOL |
| | | program was submitted to |
| | | your COBOL system, in the |
| | | form: |
| | | MM/DD/YYhh.mm.ss |
| | | where DD, hh, mm and ss |
| | | are as above. YY=year in |
| | | century and MM=month in |
| | | year (VSC2 only) |
| | | |
| | | WHEN-COMPILED is valid |
| | | only as the sending area |
| | | of a MOVE statement. |
| | | |
--------------------------------------------------------------
NOTE Certain special registers are sensitive to compiler directives and
dialects. See your COBOL System Reference for additional
information.
1. The format of the contents of the CURRENT-DATE special register is
sensitive to the CURRENT-DATE directive.
2. The LENGTH OF special register may be follwed by an alphanmeric
literal when using the Micro Focus dialect.
PICTURE Character-Strings
A PICTURE character-stringconsists of certain combinations of characters
in the COBOL character set, used as symbols. See the section The PICTURE
Clause in the chapter Program Definition for the PICTURE character-string
and for the rules that govern its use.
Any punctuation character that appears as part of the specification of a
PICTURE character-string is not considered to be a punctuation character,
but a symbol used in the specification of that PICTURE character-string.
Comment-Entries
A comment-entryis an entry in the Identification Division that can be any
combination of characters from the computer's character set.
MPE/iX 5.0 Documentation