Compilation Groups

A compilation group is the entire source file that is submitted to the compiler.

ANS85 A compilation group may contain zero, one, or more source units. A compilation group consists of a series of source units. A source unit may contain other source units and these contained source units may reference some of the resources of the source units within which they are contained.

A source unit begins with an Identification Division.

ANS85 A source unit includes any contained source units.

With the exception of source text manipulation statements

ANS85 and end markers

ISO2002MF and compiler directives

, the statements, entries, paragraphs, and sections of a source unit are grouped into four divisions that are sequenced in the following order:

  1. Identification Division
  2. Environment Division
  3. Data Division
  4. Procedure Division

The beginning of a division in a source unit is indicated by the appropriate division header.

ISO2002MF The beginning of the Identification Division may also be indicated by one of the paragraph headers permitted in the Identification Division.

The end of a division in a source unit is indicated by one of the following:

  1. The beginning of a succeeding division in that source unit
  2. ANS85 The end marker for that source unit
  3. That physical position after which no more source lines occur.

The end of a source unit is indicated by the absence of additional source lines in the compilation group.

ANS85 The end of a source unit can also be indicated by an end marker.

ANS85 When a source unit, B, is contained in another source unit, A, it may be directly or indirectly contained. Source unit B is directly contained in source unit A if there is no source unit contained in A that also contains B. Source unit B is indirectly contained in source unit A if there exists a source unit contained in A that also contains B.

A source unit that is directly or indirectly contained within another source unit is considered in these specifications as a separate source unit that may additionally reference certain resources defined in the containing source unit.

The object code resulting from compiling a source unit contained within another source unit is considered in these specifications to be inseparable from the object code resulting from compiling the containing source unit.

ANS85 A compilation unit is a source unit that is not contained within another source unit. It may be preceded or followed by other compilation units in a compilation group.

A source element is a source unit excluding any nested source units.

A runtime element is the result of compiling a source element.

A runtime module is the result of compiling a compilation unit.

ANS85 A compilation group may contain zero, one, or more source units. A compilation group consists of a series of source units. A source unit may contain other source units and these contained source units may reference some of the resources of the source units within which they are contained.

A source unit begins with an Identification Division.

ANS85 A source unit includes any contained source units.

With the exception of source text manipulation statements

ANS85 and end markers

ISO2002MF and compiler directives

, the statements, entries, paragraphs, and sections of a source unit are grouped into four divisions that are sequenced in the following order:

  1. Identification Division
  2. Environment Division
  3. Data Division
  4. Procedure Division

The beginning of a division in a source unit is indicated by the appropriate division header.

ISO2002MF The beginning of the Identification Division may also be indicated by one of the paragraph headers permitted in the Identification Division.

The end of a division in a source unit is indicated by one of the following:

  1. The beginning of a succeeding division in that source unit
  2. ANS85 The end marker for that source unit
  3. That physical position after which no more source lines occur.

The end of a source unit is indicated by the absence of additional source lines in the compilation group.

ANS85 The end of a source unit can also be indicated by an end marker.

ANS85 When a source unit, B, is contained in another source unit, A, it may be directly or indirectly contained. Source unit B is directly contained in source unit A if there is no source unit contained in A that also contains B. Source unit B is indirectly contained in source unit A if there exists a source unit contained in A that also contains B.

A source unit that is directly or indirectly contained within another source unit is considered in these specifications as a separate source unit that may additionally reference certain resources defined in the containing source unit.

The object code resulting from compiling a source unit contained within another source unit is considered in these specifications to be inseparable from the object code resulting from compiling the containing source unit.

ANS85 A compilation unit is a source unit that is not contained within another source unit. It may be preceded or followed by other compilation units in a compilation group.

A source element is a source unit excluding any nested source units.

A runtime element is the result of compiling a source element.

A runtime module is the result of compiling a compilation unit.

General Format


*

*

*

*

*

*

*

*

Syntax Rules

  1. Within a compilation group,

    MF call-prototypes and

    ISO2002MF function-prototypes and program-prototypes

    must precede all other types of source units.

  2. ISO2002MF If a compilation group contains both a function definition and a function prototype definition with the same externalized name, the signatures of these two compilation units must be the same.
  3. ISO2002MF The Data Division of a method in an interface definition can contain only a Linkage Section.
  4. ISO2002MF The Procedure Division of a method in an interface definition must contain only a PROCEDURE DIVISION header.
  5. MF In a call prototype, the PROCEDURE DIVISION header must conform to the rules for a format 2 PROCEDURE DIVISION header and any ENTRY statements must conform to the rules for a format 2 ENTRY statement.

General Rules:

  1. MF In a call prototype, all sections of the Data Division are ignored except for the Linkage Section, and the Procedure Division is ignored except for the PROCEDURE DIVISION header and ENTRY statements.
  2. ISO2002MF In a function prototype and a program prototype, all sections of the Data Division are ignored except for the Linkage Section, and the Procedure Division is ignored except for thePROCEDURE DIVISION header.