HP 3000 Manuals

Ch 2. COBOL Concepts [ COBOL/HP-UX Language Reference for the Series 700 and 800 ] MPE/iX 5.0 Documentation


COBOL/HP-UX Language Reference for the Series 700 and 800

Chapter 2  COBOL Concepts 

Language Concepts 

Character Set 

The most basic and indivisible unit of the language is the character.
The set of characters used to form COBOL character-strings and separators
includes the letters of the alphabet, digits and special characters.  The
character set consists of the characters defined below:

Character             Meaning                                                                                                        

0 to 9                Digits

A to Z                Uppercase letters

a to z                Lowercase letters (ANS85)

Space

+                     Plus sign

-                     Minus sign or hyphen

*                     Asterisk

/                     Oblique Stroke/Slash

=                     Equal sign

$                     Dollar sign

.                     Period (full stop) or decimal point

,                     Comma or decimal point

;                     Semicolon

"                     Quotation mark

'                     Apostrophe (OSVS) (VSC2) (MF)

(                     Left Parenthesis

)                     Right Parenthesis

>                     Greater Than symbol

<                     Less Than symbol

:                     Colon (ANS85)

&                     Ampersand (MF)
________________________________________________________________________
|(ANS85)                                                               |
|[REV BEG] Lowercase letters can be used in character strings and text |
|words; except when used in nonnumeric literals, each lowercase        |
|letter is equivalent to the corresponding uppercase letter.[REV       |
|END]                                                                  |
________________________________________________________________________

            

This COBOL implementation is restricted to the above character set, but
the content of nonnumeric literals, comment lines, comment entries and
data can include any of the characters from the ASCII character set.
(See the appendix Character Sets and Collating Sequences.)

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
only be concatenated 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.  Anywhere 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, parentheses can appear only in
       balanced pairs of left and right parentheses delimiting
       subscripts, a list of function arguments, reference modifiers, 
       (ANS85) 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.  These separators immediately preceding and immediately
       following the quotation mark are not a part of the separator
       quotation mark.

   6.
________________________________________________________________________
|(OSVS) (VSC2) (MF)                                                    |
|The punctuation character apostrophe is a separator which can         |
|be used throughout a program in place of the quotation mark           |
|character.                                                            |
________________________________________________________________________

            
________________________________________________________________________
|(MF)                                                                  |
|Both the quotation mark and the apostrophe can appear within the same |
|program.  If they do so, 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.
________________________________________________________________________
|(MF)                                                                  |
|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 Chapter 6  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 this chapter).

          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 separator space 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 Chapter 3  The Nucleus) or numeric
literal is not considered as a punctuation character, but rather as a
symbol used in the specification of that PICTURE character-string or
numeric literal.  PICTURE character-strings are delimited only by the
separators space, comma, semicolon, or period.

The rules established for the formation of separators do not apply to the
characters which comprise the contents of nonnumeric literals,
comment-entries, or comment lines.

Character-strings.   

A character-string is a character or a sequence of contiguous characters
which forms a COBOL word, a literal, a PICTURE character-string, or a
comment-entry.  A character-string is delimited by separators.

COBOL Words 
________________________________________________________________________
|(ANS85)                                                               |
|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.                                   |
|                                                                      |
|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.  Function-names, system-names, and user-defined words    |
|              form intersecting sets.  The same COBOL word may be used|
|              as a function-name, as a system-name, and as a          |
|              user-defined word.  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.  The     |
|              COBOL words LENGTH, RANDOM, and SUM may not be used as a|
|              system-name or as a user-defined word regardless of     |
|              context.                                                |
________________________________________________________________________

            

User-Defined Words:  A user-defined word is 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",
________________________________________________________________________
|(ANS85)                                                               |
|"a", "b", "c", ...  "z" are interpreted as equivalent to uppercase,   |
|"0",..."9" , and "-", except that the "-" can not appear as the first |
|or last character.                                                    |
________________________________________________________________________

            

User-defined word types 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
     routine-name
     screen name (MF)
     section-name
     segment-number
     split-key-name (MF)
     text-name

Within a given source program, 16 of these 20 types of user-defined words
are grouped into 13 disjoint sets.  The disjoint sets are:

     alphabet-names
     cd-names
     class-name (MF)
     condition-names, constant-names, (MF) data-names,
     record-names, split-key-names (MF)
     file-names
     index-names
     library-names
     mnemonic-names
     paragraph-names
     program-names
     routine-names
     screen-name (MF)
     section-names
     text-names

All user-defined words, except segment-numbers and level-numbers, can
belong to one and only one of these disjoint sets.  Further, 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 words must contain at least one
alphabetic character or one occurrence of the hyphen character.  (MF)

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 name which 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 the ON STATUS or OFF STATUS, or both, of
                     the run-time switches.  A condition-name is used
                     only in the RERUN clause or in conditions as an
                     abbreviation for the relation condition; this
                     relation condition sets the associated conditional
                     variable to be equal to one of the set of values to
                     which that condition-name is assigned.
________________________________________________________________________
|(MF)                                                                  |
|                                                                      |
|                                                                      |
|                                                                      |
|Constant-Name:       A constant-name is a name which is assigned as   |
|                     the name of a fixed value.                       |
|                                                                      |
________________________________________________________________________

            

Mnemonic-Name:       A mnemonic-name assigns 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 The 
                     Nucleus.)

Paragraph-Name:      A paragraph-name is a word which 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 digits and/or
                     characters.

Section-Name:        A section-name is a word which 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 digits and/or
                     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 which is used to
                     communicate with the operating environment.  Each
                     character used in the formation of a system-name
                     must be selected from the set of characters "A",
                     "B", "C", ..."Z", "a", "b",..."z", (ANS85) "0" ...
                     "9" and "-" , except that the `-' may not appear as
                     the first or last character.

                     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-name is a word that is one of a     |
|                     specified 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 word or a         |
|                     system-name.  (See the section Definitions of    |
|                     Functions.)                                      |
|                                                                      |
________________________________________________________________________

            

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 words or system-names.
                     Reserved words can only be used 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 the word 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 Chapter 5  
                     File Input and Output) and DEBUG-ITEM (see the
                     chapter Debug and Interactive Debugging).  They are
                     specified in the section Special Registers later in
                     this chapter.

Figurative           Certain reserved words are used to name and
Constants:           reference specific constant values.  These reserved
                     words are specified in the section Figurative 
                     Constant Values in this chapter.

Special Character    The arithmetic operators and relation characters are
Words:               reserved words.
________________________________________________________________________
|(ANS85)                                                               |
|Scope of Names                                                        |
|                                                                      |
|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 which 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:                                                          |
|                                                                      |
|1.  cd-name                                                           |
|2.  paragraph-name                                                    |
|3.  section-name                                                      |
|                                                                      |
|The following types of user-defined words can be referenced by any    |
|COBOL program:                                                        |
|                                                                      |
|1.  library-name                                                      |
|2.  text-name                                                         |
|                                                                      |
|The following types of user-defined words, when they are declared in a|
|Communication Section, can be referenced only by statements and       |
|entries in that program which contains that section:                  |
|                                                                      |
|1.  condition-name                                                    |
|2.  data-name                                                         |
|3.  record-name                                                       |
|                                                                      |
|The following types of names, when they are declared within a         |
|Configuration Section, can be referenced only by statements and       |
|entries either in that program which contains a Configuration Section |
|or in any program contained within that program:                      |
|                                                                      |
|1.  alphabet-name                                                     |
|2.  class-name                                                        |
|3.  condition-name                                                    |
|4.  mnemonic-name                                                     |
|5.  symbolic-character                                                |
________________________________________________________________________

            
________________________________________________________________________
|(ANS85)                                                               |
|Specific conventions, for declarations and references, apply to the   |
|following types of user-defined words when the conditions listed above|
|do not apply:                                                         |
|                                                                      |
|1.  condition-name                                                    |
|2.  data-name                                                         |
|3.  file-name                                                         |
|4.  index-name                                                        |
|5.  program-name                                                      |
|6.  record-name                                                       |
|7.  report-name                                                       |
|                                                                      |
|Conventions for Program-names                                         |
|                                                                      |
|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) the  |
|CANCEL statement, and the end program header.  The program-names      |
|allocated to programs constituting a run unit are not necessarily     |
|unique but, when two programs in a run unit are identically named, at |
|least one of those two programs must be directly or indirectly        |
|contained within another 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 programs possessing       |
|       the common attributes and any programs contained within        |
|       it.                                                            |
|                                                                      |
|   3.  If the program-name is that of a program which is separately   |
|       compiled, that program-name can be referenced by statements    |
|       included in any other program in the run unit, except programs |
|       it directly or indirectly contains.                            |
________________________________________________________________________

            
________________________________________________________________________
|(ANS85)                                                               |
|Conventions for Condition-names, Data-names, File-names, Record-names |
|and Report Names                                                      |
|                                                                      |
|When condition-names, data-names, file-names, record-names and        |
|report-names are declared in a source program, these names can be     |
|referenced only by that program except when 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.                                                   |
|                                                                      |
|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 which are defined in program B and|
|       all global names which 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 objects 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:                      |
|                                                                      |
|                                                                      |
|                 1.  The object in program A if the name is declared  |
|                     in program A.                                    |
|                                                                      |
|                 2.  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.                                           |
________________________________________________________________________

            
________________________________________________________________________
|(ANS85)                                                               |
|Conventions for Index-names                                           |
|                                                                      |
|If a data item possessing the global attribute includes 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.                                      |
|                                                                      |
|Index-names can be qualified.  (OSVS)                                 |
________________________________________________________________________

            

Literals 

A literal is either:

   *   a character-string whose value is implied by the ordered set of
       characters of which it is composed, or:

   *   a reserved word which references a figurative constant, or:
________________________________________________________________________
|                                                                      |
|   *   a user-defined word which references a constant value.         |
|       (MF)                                                           |
________________________________________________________________________

            

Every literal belongs to one of two types:  nonnumeric or numeric.

Nonnumeric Literals 

A nonnumeric literal is a character-string delimited at both ends by
quotation marks or apostrophes (OSVS) (VSC2) (MF) 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) (MF) are used as delimiters, the presence of
that delimiter within a non-numeric 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:

   1.  The delimiting quotation marks are excluded, and

   2.  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 PICTURE Clause in the chapter The Nucleus.)
________________________________________________________________________
|(MF) [REV BEG] (VSC2) [REV END]                                       |
|In addition, hexadecimal binary values can be attributed to           |
|non-numeric literals by expressing literals as:  X"nn", where 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 literal is a character-string whose characters are selected
from the digits "0" through "9" , the plus sign, the minus sign, and/or
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:

   1.  A literal must contain at least one digit.

   2.  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.

   3.  A literal must not contain more than one decimal point.  The
       decimal pointis 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.

   4.  The value of a numeric literal is the algebraic quality
       represented by the characters in the numeric literal.  Every
       numeric literal is category numeric.  (See "The PICTURE Clause"
        in the chapter The Nucleus.)

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 it 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.
________________________________________________________________________
|(MF)                                                                  |
|In addition, hexadecimal binary values can be attributed to numeric   |
|literals by expressing literals as:  H"nn", where 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.                                |
________________________________________________________________________

            
________________________________________________________________________
|(OSVS) (VSC2) (MF)                                                    |
|Numeric literals can be either fixed-point or floating-point          |
|numbers.                                                              |
|                                                                      |
|A floating point literal is written in the form:                      |
|                                                                      |
|     [+]           [+]                                                |
|     [ ] mantissa E[ ] exponent                                       |
|     [-]           [-]                                                |
|                                                                      |
|The sign is optional before the mantissa and the exponent:  if you    |
|omit the sign, the compiler assumes a positive number.                |
|                                                                      |
|The mantissa can contain between 1 and 16 digits.  A decimal point    |
|must be included in the mantissa.                                     |
|                                                                      |
|The exponent is represented by an E followed by an optional sign and  |
|one or two digits.                                                    |
|[REV BEG]                                                             |
|                                                                      |
|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.  Note that you must not use a floating-point literal    |
|when an integer literal is required.[REV END]                         |
________________________________________________________________________

            

Figurative Constant Values 

Figurative constant values are 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                  | Represents the value "0",, or one or more   |
| ZEROS                 | of the character "0" depending on the       |
| ZEROES                | context.                                    |
|                       |                                             |
-----------------------------------------------------------------------
|                       |                                             |
| SPACE                 | Represents one or more of the character     |
| SPACES                | space from the computer's character set.    |
|                       |                                             |
-----------------------------------------------------------------------
|                       |                                             |
| HIGH-VALUE            | Represents one or more of the character     |
| HIGH-VALUES           | 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 character     |
| LOW-VALUES            | that has the lowest ordinal position in the |
|                       | program collating sequence.  (X"00" for the |
|                       | ASCII character set.)                       |
|                       |                                             |
-----------------------------------------------------------------------
|                       |                                             |
| QUOTE                 | Represents one or more of the character ""  |
| QUOTES                | ".  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                  | (VSC2) (MF)                                 |
| NULLS                 | Represents one or more unset pointer        |
|                       | values. A pointer variable with the NULL    |
|                       | value is guaranteed not to point to any     |
|                       | data item.                                  |
|                       |                                             |
-----------------------------------------------------------------------

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 constant is specified in a VALUE clause, or when
       a figurative constant is associated with another data item, (e.g.,
       when the figurative constant is moved to or compared with another
       data item), the string of characters specified by the figurative
       constant 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.
________________________________________________________________________
|(MF)                                                                  |
|DISPLAY SPACE in Format 2 of the DISPLAY statement is an exception.   |
________________________________________________________________________

            

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 
OBJECT-COMPUTER Paragraph and The SPECIAL-NAMES Paragraph in the chapter
The Nucleus.)

Each reserved word which 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.
________________________________________________________________________
|(MF) (OSVS) (VSC2)                                                    |
|The value associated with the QUOTE/QUOTES figurative constant is     |
|sensitive to the APOST and QUOTE directives.  See your COBOL System   |
|Reference for details.                                                |
________________________________________________________________________

            
________________________________________________________________________
|(ANS85)                                                               |
|The figurative constant ALL Literal, when associated with a numeric or|
|numeric edited item and when the length of the literal 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.                                                             |
________________________________________________________________________

            
________________________________________________________________________
|(MF)                                                                  |
|All dialects within this COBOL implementation fully support this      |
|syntax.  Refer to your COBOL System Reference for details on          |
|using the FLAGSTD directive to detect all occurrences of this         |
|syntax.                                                               |
________________________________________________________________________

            
________________________________________________________________________
|(XOPEN)                                                               |
|Although it 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.                                                              |
________________________________________________________________________

            
________________________________________________________________________
|(OSVS) (VSC2) (MF)                                                    |
|Note that you must not use a floating-point literal when an integer   |
|literal is required.                                                  |
________________________________________________________________________

            
________________________________________________________________________
|(MF)                                                                  |
|Constant-Names                                                        |
|                                                                      |
|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 assigned in its data description is 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.                       |
________________________________________________________________________

            
________________________________________________________________________
|(MF)                                                                  |
|Concatenation Expressions                                             |
|                                                                      |
|Definition of the Concatenation Operator                              |
|                                                                      |
|     The concatenation operator is used in concatenation expressions. |
|     It is represented by the character "&dquote;, 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 value 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.                     |
________________________________________________________________________

            
________________________________________________________________________
|(OSVS) (VSC2) (MF)                                                    |
|Special Registers                                                     |
|                                                                      |
|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 (continued overleaf) 
----------------------------------------------------------------------------------
|                   |                   |                                        |
| Special Register  |   Implicit Data   | Usage                                  |
|                   |    Description    |                                        |
|                   |      Picture      |                                        |
|                   |                   |                                        |
----------------------------------------------------------------------------------
|                   |                   |                                        |
|    ADDRESS OF     | USAGE IS POINTER  | (VSC2) (MF)                            |
|                   |                   | An ADDRESS special 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-DATE    |       X(8)        | The CURRENT-DATE special register      |
|                   |                   | contains the value of the current date |
|                   |                   | (as supplied by the COBOL program      |
|                   |                   | execution environment), in the form:   |
|                   |                   |                                        |
|                   |                   |      MM/DD/YY                          |
|                   |                   |                                        |
|                   |                   | where MM 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.                        |
|                   |                   |                                        |
|                   |                   | (MF)                                   |
|                   |                   | The format of the contents of this     |
|                   |                   | special register are sensitive to the  |
|                   |                   | CURRENT-DATE  compiler directive.      |
|                   |                   | Refer to  your COBOL System Reference  |
|                   |                   | for details.                           |
|                   |                   |                                        |
----------------------------------------------------------------------------------
|                   |                   |                                        |
|     LENGTH OF     |       9(9)        | (VSC2) (MF)                            |
|                   |                   | The LENGTH OF special register         |
|                   |                   | contains the 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 overleaf) 

----------------------------------------------------------------------------------
|                   |                   |                                        |
| Special Register  |   Implicit Data   | Usage                                  |
|                   |    Description    |                                        |
|                   |      Picture      |                                        |
|                   |                   |                                        |
----------------------------------------------------------------------------------
|                   |                   |                                        |
|    RETURN-CODE    |    S9(4) COMP     | The RETURN-CODE special register can:  |
|                   |                   |                                        |
|                   |   (XOPEN) S9(8)   |                                        |
|                   |       COMP        |    1.  (OSVS) (VSC2) (MF)              |
|                   |                   |        Be set by a program, prior to   |
|                   | (MF) (This can be |        the execution of a STOP RUN,    |
|                   |  changed by the   |        EXIT PROGRAM or GOBACK          |
|                   |   RTNCODE-SIZE    |        statement, to pass a value to   |
|                   | directive. Refer  |        the invoking program (or the    |
|                   |   to your COBOL   |        execution environment).         |
|                   | System Reference  |                                        |
|                   |   for details)    |    2.  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      |       X(1)        | Used to switch the 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 character           |
|                   |                   | representation from single byte        |
|                   |                   | characters (SBCS) to double byte       |
|                   |                   | characters (DBCS) in environments      |
|                   |                   | where this is applicable.              |
|                   |                   |                                        |
----------------------------------------------------------------------------------

          Table 2-2.  Special Registers (continued overleaf) 

---------------------------------------------------------------------------------------
|                        |                   |                                        |
| Special Register       |   Implicit Data   | Usage                                  |
|                        |    Description    |                                        |
|                        |      Picture      |                                        |
|                        |                   |                                        |
---------------------------------------------------------------------------------------
|                        |                   |                                        |
| SORT-CONTROL           | X(8)              | (OSVS) (VSC2)                          |
| SORT-CORE-SIZE         | S9(8) COMP        | These items can be referenced in the   |
| SORT-FILE-SIZE         | S9(8) COMP        | Procedure Division but will contain    |
| SORT-MESSAGE           | X(8)              | either zeros (for numeric registers)   |
| SORT-MODE-SIZE         |    S9(5) COMP     | or spaces (for alpha-numeric           |
|                        |                   | registers).                            |
|                        |                   |                                        |
---------------------------------------------------------------------------------------
|                        |                   |                                        |
| SORT-RETURN            |    S9(4) COMP     | (OSVS) (VSC2) (MF)                     |
|                        |                   | 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.                     |
|                        |                   |                                        |
---------------------------------------------------------------------------------------
|                        |                   |                                        |
| TALLY                  |     9(5) COMP     | (OSVS) (VSC2)                          |
|                        |                   | 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.                            |
|                        |                   |                                        |
---------------------------------------------------------------------------------------
|                        |                   |                                        |
| TIME-OF DAY            |   9(6) DISPLAY    | (OSVS)                                 |
|                        |                   | 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.                             |
|                        |                   |                                        |
---------------------------------------------------------------------------------------

          Table 2-2.  Special Registers (continued overleaf) 

----------------------------------------------------------------------------------
|                   |                   |                                        |
| Special Register  |   Implicit Data   | Usage                                  |
|                   |    Description    |                                        |
|                   |      Picture      |                                        |
|                   |                   |                                        |
----------------------------------------------------------------------------------
|                   |                   |                                        |
| (OSVS)            |       X(20)       | (OSVS)                                 |
|   WHEN-COMPILED   |                   | 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.                         |
|                   |                   |                                        |
|                   |                   | WHEN-COMPILED is only valid as the     |
|                   |                   | sending area of a MOVE statement.      |
|                   |                   |                                        |
----------------------------------------------------------------------------------
|                   |                   |                                        |
|  WHEN- COMPILED   |       X(20)       | (VSC2)                                 |
|                   |                   | 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.                                  |
|                   |                   |                                        |
|                   |                   | WHEN-COMPILED is only valid as the     |
|                   |                   | sending area of a MOVE statement.      |
|                   |                   |                                        |
----------------------------------------------------------------------------------

PICTURE Character-Strings 

A PICTURE character-string consists of certain combinations of characters
in the COBOL character set used as symbols.  See "The PICTURE Clause"  
in the chapter The Nucleus for the PICTURE character-string and for the
rules that govern its use.

Any punctuation character which appears as part of the specification of a
PICTURE character-string is not considered as a punctuation character,
but rather as a symbol used in the specification of that PICTURE
character-string.

Comment-Entries 

A comment-entry is an entry in the Identification Division that can be
any combination of characters from the computer's character set.



MPE/iX 5.0 Documentation