Structure [ Micro Focus COBOL Language Reference ] MPE/iX 5.0 Documentation
Micro Focus COBOL Language Reference
Structure
For OSVS and VSC2 only: The General Format of the paragraphs in the
Identification Division is given below. Paragraphs can appear in any
order.
General Format
Syntax Rules
1. For OSVS and VSC2 only: The paragraphs can appear in any order.
2. For OSVS and VSC2 only: The periods following the paragraph-names
in the Identification Division are optional as is the period
following the program-name.
3. The comment-entrycan be any combination of the characters from the
computer's character set. The continuation of the comment-entry
by the use of a hyphen in the continuation area is not permitted.
If the system directive SOURCEFORMTAT is specified as or defaulted
to FIXED, the comment-entry can be contained on one or more lines
but is restricted to area B of those lines; the next line
commencing in area A will begin the next non-comment entry.
For MF only: If the system directive SOURCEFORMAT is specified
as FREE, the comment-entry cannot be continued; the next line will
beginthe next non-comment entry.
For VSC2 only: The comment-entry can contain the SKIP1, SKIP2,
SKIP3, EJECT or TITLE statements anywhere on the line. These
statements will be actioned if they are alone on a line in the
comment-entry, and will not terminate the comment-entry.
For OSVS only: The comment-entry can contain the SKIP1, SKIP2,
SKIP3, or EJECT statements anywhere in the B margin. These
statements will be actioned if they are alone on a line in the
comment-entry, and will not terminate the comment-entry.
For OSVS only: The comment-entry can be contained in either
area A or area B of the comment-entry lines. However, the next
occurrence in area A of any one of the following COBOL words or
phrases will terminate the comment-entry and begin the next
paragraph or division:
PROGRAM-ID
AUTHOR
INSTALLATION
DATE-WRITTEN
DATE-COMPILED
SECURITY
ENVIRONMENT
DATA
PROCEDURE
4. For MF only: The EXTERNAL clause establishes that a program is
intended as a call prototype and not as executable object code.
When the EXTERNAL clause is specified in the PROGRAM-NAME
paragraph, then no other IDENTIFICATION DIVISION paragraphs should
be specified, no ENVIRONMENT DIVISION should be specified, only
the LINKAGE SECTION should be specified in the DATA DIVISION, and
only the PROCEDURE DIVISION header and ENTRY statements should
appear in the PROCEDURE DIVISION.
The PROGRAM-ID Paragraph and Nested Source Programs (ANS85)
Function.
The PROGRAM-ID paragraph gives the name by which a program is identified,
and assigns selected program attributes to that program.
General Formats.
Format 1.
PROGRAM-ID program-name [ comment-entry ] (MF)
For ANS85 only: Format 2.
PROGRAM-ID program-name [IS [COMMON] [INITIAL] PROGRAM].
Directives.
1. In addition to system directives which provide flagging and modify
the reserved word list, the following directives may impact either
the syntax or semantics described in this section. See your COBOL
System Reference for details.
* CASE - determines whether upper-case and lower-case letters
are considered equivalent.
* DEFAULT-BYTE - sets the value for data items defined in
Working-Storage Section without a VALUE clause.
* MAPNAME - impacts the handling of non-alphabetic characters
in the program-name.
* PROGID-COMMENT - allows comments after the program-name.
Syntax Rules.
1. The program-namemust conform to the rules for formation of a
user-defined word.
2. For VSC2 and OSVS only: The first eight characters of
program-name of the outermost program should be unique in the
system. The first character must be alphabetic. If the first
character is not alphabetic, it is converted as follows:
1 through 9 are changed to A through I respectively.
Anything else is changed to J.
If a hyphen is used in characters 2 through 8 of the
program-name of the outermost program, it is changed to
zero (0).
For VSC2 only: For programs that are contained in another
program, program-name can be any valid user-defined COBOL
word, up to 30 characters long. The first eight characters
need not be unique, and they will not be converted as
described above. Lowercase letters are valid, but such
program-names will be handled in a case-insensitive manner.
3. For VSC2 and OSVS only: The program-name can be a nonnumeric
literal. The content of the literal must follow the rules for
formation of program-names.
4. For OSVS only: The program-name can be the same as another
user-defined word.
The program-name cannot be the same as another user-defined word.
5. For ANS85 only: The program-name of a nested program must be
unique within the separately compiled program containing it.
6. For ANS85 only: The optional COMMON clause can be used only if
the program is contained within another program.
7. For ANS85 only: If the IS PROGRAM phrase is present, either
COMMON, INITIAL or both must be specified. When both are
specified, the order is irrelevant.
General Rules.
1. The program-name is associated with the object code file
pertaining to this COBOL program.
2. The COMMONclause specifies that the program is common. A common
program is contained within another program but can be called from
programs other than that containing it. (ANS85)
3. The INITIALclause specifies that the program is initial. When an
initial program is called, it and any programs contained within it
are placed in their initial state. See the section Initial State
Of A Program earlier in this chapter. (ANS85)
For ANS85 only: Common Programs and Initial Programs
A common program is one which, despite being directly contained in
another program, can be called by any program directly or indirectly
contained in that other progam. The common attribute is attained by
specifying the COMMON clause in a program's Identification Division. The
COMMON clause facilitates the writing of subprograms which are to be used
by all the programs contained in a program.
An initial program is one whose program state is initialized when the
program is called. Thus, whenever an initial program is called, its
program state is the same as when the program was first called in that
run unit. During the process of initializing an initial program, that
program's internal Working-Storage data is initialized; thus an item of
the program's internal data whose description contains a VALUE clause is
initialized to that defined value,
For MF only: but an item whose description does not contain a
VALUE clause is initialized to a value depending on the
DEFAULTBYTEdirective(see your COBOL System Reference).
Files with internal file connectors associated with the program are not
in the open mode. The control mechanisms for all PERFORM statements
contained in the program are set to their initial state. A GOTO
statement referred to by an ALTER statement contained in the same program
is set to its intial state. The initial attribute is attained by
specifying the INITIAL clause in the program's Identification Division.
Sharing Data.
Two programs in a run unit can reference common data in the following
circumstances:
* The data content of an external data record can be referenced from
any program provided that program has described that data record.
* If a program is contained in another program, both programs can
refer to data possessing the global attribute either in the
containing program or in any program which directly or indirectly
contains the containing program.
* The mechanism whereby a parameter value is passed by reference
from a calling program to a called program establishes a common
data item; the called program, which can use a different
identifier, can refer to a data item in the calling program.
For ANS85 only: Sharing File Connectors.
Two programs in a run unit can reference common file connectors in the
following circumstances:
* An external file connector can be referenced from any program
which describes that file connector.
* If a program is contained in another program, both programs can
refer to a common file connector by referring to an associated
global file-name either in the containing program or in any
program which directly or indirectly contains the containing
program.
The DATE-COMPILED Paragraph
Function.
The DATE-COMPILED paragraph provides the date the intermediate code was
produced in the Identification Division source program listing.
General Format.
DATE-COMPILED [comment-entry] ...
Directives.
1. In addition to system directives which provide flagging and modify
the reserved word list, the following directives may impact either
the syntax or semantics described in this section. See your COBOL
System Reference for details.
* DATE - impacts the format in which the date is printed in
this paragraph.
Syntax Rule.
The comment-entry can be any combination of the characters from the
computer's character set. The continuation of the comment entry by use
of the hyphen is not permitted; however, the comment entry can be
contained on one or more lines. The comment-entry lines must be
contained in area B. The next line commencing in area A will begin the
next non-comment paragraph.
General Rule.
The paragraph-name DATE-COMPILED causes your COBOL system to insert a
date comment-entry as the executable code is created. If a DATE-COMPILED
paragraph is present (with or without a comment-entry), the paragraph is
replaced in the program listing with one of the form:
DATE-COMPILED. current-date-and-time .
where the date and time format is ''DD-MMM-YY hh:mm''.
For MF only: See your COBOL System Reference for details of the
DATEdirectivewhich can impact the comment-entry replacement string for
your COBOL implementation.
For ANS85 only: The value inserted in the DATE-COMPILED paragraph will
also be the value used in the When-Compiled intrinsic function. However,
the format can differ.
For OSVS only: The REMARKS Paragraph
The REMARKS paragraph allows a comment-entry to be specified. (See
Syntax Rule 3 under the section Identification Division earlier in this
chapter.)
MPE/iX 5.0 Documentation