HP 3000 Manuals

Paragraphs [ HP COBOL II/XL Reference Manual ] MPE/iX 5.0 Documentation


HP COBOL II/XL Reference Manual

Paragraphs 

A paragraph is the third level construct in a COBOL program.  Paragraphs
allow you to break your program into even more elementary units.  One
paragraph (the PROGRAM-ID paragraph) is required in the IDENTIFICATION
DIVISION. Paragraphs are optional in the ENVIRONMENT and PROCEDURE
DIVISIONs.  They are not used in the DATA DIVISION.

Paragraph Format 

In the IDENTIFICATION and ENVIRONMENT DIVISIONs, each paragraph begins
with a header entry, optionally followed by one or more words or clauses
that comprise the paragraph body.  In the PROCEDURE DIVISION, a paragraph
begins with a paragraph name, optionally followed by one or more
sentences comprising the paragraph body.  In any division, a paragraph is
terminated by one of the following:

   *   The next paragraph header or name.

   *   The next section or division header.

   *   The physical end of the program in the PROCEDURE DIVISION.

   *   The words END DECLARATIVES in the PROCEDURE DIVISION.

   *    The words END PROGRAM in the PROCEDURE DIVISION. 

Paragraph Header and Name Format 

The paragraph header, used in the IDENTIFICATION and ENVIRONMENT
DIVISIONs, consists of a COBOL reserved word identifying the paragraph,
followed by a period and a space.  In the IDENTIFICATION DIVISION, only
the following headers are permitted:

       PROGRAM-ID.

       AUTHOR.

       INSTALLATION.

       DATE-WRITTEN.

       DATE-COMPILED.

       SECURITY.

       REMARKS. (This is an HP extension to the ANSI COBOL standard.)

In the ENVIRONMENT DIVISION, only these headers are allowed:

       SOURCE-COMPUTER.

       OBJECT-COMPUTER.

       SPECIAL-NAMES.

       FILE-CONTROL.

       I-O-CONTROL.

The paragraph name, used in the PROCEDURE DIVISION, is a user-defined
word that identifies the paragraph and is always terminated by a period
and a space.  It must be unique within a section or in a program if no
sections are defined.  If sections are used, however, the same paragraph
name may appear in different sections.  When referencing such a
paragraph, you can use the section name to qualify the paragraph name,
and you must do so if you are referencing it from within a section other
than the section in which it is defined.

The paragraph header or name must be the first item on a coding line, but
may be followed by other items on the same line.

In Figure 2-2 , the IDENTIFICATION DIVISION contains paragraphs
identified by the headers PROGRAM-ID (item 6) and AUTHOR (item 7).  The
PROCEDURE DIVISION includes one paragraph (item 8) identified by the
user-defined name ENTER-ROUTINE (item 9).



MPE/iX 5.0 Documentation