PreviousConcepts of a Compilation Group Identification DivisionNext

Chapter 4: Introduction to Compilation Group Definition

4.1 Introduction

This part describes the base COBOL language definition.

The structure of the entire compilation group is described first. Each component of the compilation group is divided into four divisions.

Material is thus presented on the four divisions - the Identification Division, Environment Division, Data Division and Procedure Division. Within these divisions, material is presented according to COBOL sections, shown by the headers. Clauses, including intrinsic functions and COBOL verbs, are listed in alphabetical order, for ease of use.

Additional language features such as DBCS, Report Writer, Communication and SQL are supported, and are described in your companion manual, Language Reference - Additional Topics.

4.2 Compilation Group Structure

A compilation group is 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.

4.2.1 Organization

A compilation group may contain zero, one, or more source units.

A source unit begins with an identification division and includes any contained source units.

With the exception of compiler directives, source text manipulation statements, and end markers, 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. 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. 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 an end marker, if specified, or by the absence of additional source lines in the compilation group.

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.

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.

4.2.1.1 COBOL Compilation Group

General Format

Syntax Rules
  1. Within a compilation group, call-prototypes must precede all other types of source units.

  2. The data division of a method in a class definition must not contain a communication section.

  3. The data division of a method is in interface definition can contain only a linkage section.

  4. The procedure division of a method in an interface definition must contain only a procedure division header.

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

4.2.2 End markers

End markers indicate the end of a definition

General Format
Syntax Rules
  1. An end marker must be present in every source unit that contains, is contained in, or precedes another source unit.

  2. Program-name-1 must be identical to the program-name declared in a preceding PROGRAM-ID paragraph.

  3. If a PROGRAM-ID paragraph declaring a specific program-name is stated between the PROGRAM-ID paragraph and the END PROGRAM marker for program-name-1, then an END PROGRAM marker referencing program-name must precede the END PROGRAM marker referencing program-name-1.

  4. Class-name-1 must be identical to the class-name declared in the corresponding CLASS-ID paragraph.

  5. Method-name-1 must be identical to the method-name declared in the corresponding METHOD-ID paragraph. If the PROPERTY phrase is specified in the METHOD-ID paragraph, method-name-1 shall be omitted.

  6. Interface-name-1 must be identical to the interface-name declared in the corresponding INTERFACE-ID paragraph.

  7. If the source unit terminated by the end marker is contained within another source unit, the next statement must be either the first statement of a source unit or another end marker that terminates the containing source unit.

  8. If the source unit terminated by an end marker is not contained within another source unit, the next statement must be the first statement of a compilation unit.

General Rules
  1. An end marker indicates the end of the specified source unit.


Copyright © 1998 Micro Focus Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.
PreviousConcepts of a Compilation Group Identification DivisionNext