Anda di halaman 1dari 3

Entries

An entry is a series of clauses ending with a separator period. Entries are constructed
in the Identification, Environment, and Data Divisions.
Clauses
A clause is an ordered set of consecutive COBOL character-strings that specifies
an attribute of an entry. Clauses are constructed in the Identification, Environment,
and Data Divisions.
Sentences
A sentence is a sequence of one or more statements, ending with a separator
period. Sentences are constructed in the Procedure Division.
Statements
A statement is a valid combination of a COBOL verb and its operands. It specifies
an action to be taken by the object program. Statements are constructed in the
Procedure Division. For descriptions of the different types of statements, see:
. “Imperative Statements” on page 181
. “Conditional Statements” on page 183
. “Delimited Scope Statements” on page 184
. Chapter 9, “Compiler-Directing Statements” on page 427.
Phrases
Each clause or statement in the program can be subdivided into smaller units
called phrases.

The following areas are described below in terms of an 80-character line:


Sequence Number Area
Columns 1 through 6
Indicator Area
Column 7
Area A
Columns 8 through 11

Area B
Columns 12 through 72
Comment Area
Columns 73 through 80 are available for your own use; for example, to identify
your program.

Division Header
A division header is a combination of words, followed by a separator period, that
indicates the beginning of a division:
IDENTIFICATION DIVISION.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.

A division header (except when a USING phrase is specified with a Procedure Division
header) must be immediately followed by a separator period. Except for the
USING phrase, no text may appear on the same line.

Section Header
In the Environment and Procedure Divisions, a section header indicates the beginning
of a series of paragraphs; for example:
FILE-CONTROL.
DECLARATIVES.
In the Data Division, a section header indicates the beginning of an entry; for
example:
FILE SECTION.
A section header must be immediately followed by a period except when Procedure
Division segment numbers are specified.
Paragraph Header or Paragraph Name
A paragraph header or paragraph name indicates the beginning of a paragraph.
In the Environment Division, a paragraph consists of a paragraph header followed
by one or more entries. For example:
OBJECT-COMPUTER. computer-name
In the Procedure Division, a paragraph consists of a paragraph-name followed by
one or more sentences.
Level Indicator (FD and SD) or Level-Number (01 and 77)
A level indicator can be either FD or SD. It must begin in Area A and be followed
by a space. (See “File Section” on page 97.)
A level-number that must begin in Area A is a 1- or 2-digit integer with a value of
01 or 77. For more information, see “Level-Numbers” on page 110.
DECLARATIVES and END DECLARATIVES
DECLARATIVES and END DECLARATIVES are key words that begin and end the
declaratives part of the source program.
In the Procedure Division, each of the key words DECLARATIVES and END
DECLARATIVES must begin in Area A and be followed immediately by a separator
period; no other text may appear on the same line. After the key words END
DECLARATIVES, no text may appear before the following section header.

The following items must begin in Area B:


. Entries, sentences, statements, clauses
. Continuation lines.
Entries, Sentences, Statements, Clauses
The first entry, sentence, statement, or clause begins on either the same line as the
header or paragraph-name it follows, or in Area B of the next nonblank line that is
not a comment line. Successive sentences or entries either begin in Area B of the
same line as the preceding sentence or entry or in Area B of the next nonblank line
that is not a comment line.
Within an entry or sentence, successive lines in Area B may have the same format,
or may be indented to clarify program logic. The output listing is indented only if
the input statements are indented. Indentation does not affect the meaning of the
program. The programmer can choose the amount of indentation, subject only to
the restrictions on the width of Area B. See also “Sections and Paragraphs” on
page 14.
Continuation Lines
Any sentence, entry, clause, or phrase that requires more than one line can be
continued in Area B of the next line that is neither a comment line nor a blank line.
The line being continued is a continued line; the succeeding lines are continuation
lines. Area A of a continuation line must be blank.

The SPECIAL-NAMES paragraph:


. Relates IBM-specified environment-names to user-defined mnemonic-names.
. Relates alphabet-names to character sets or collating sequences.
. Relates class names to sets of characters.
. Specifies a substitute character for the currency sign.
. Specifies that the functions of the comma and decimal point are to be interchanged
in PICTURE clauses and numeric literals.
. Specifies that ACCEPT or DISPLAY statements are treated as extended ACCEPT or DISPLAY
statements.
. Specifies additional functions associated with ACCEPT statements.

DECIMAL-POINT Clause
55333DECIMAL-POINT33-3333-33COMMA3333333333333333333333333333333333335%
,3IS32
Figure 19. Format
Exchanges the functions of the period and the comma in PICTURE character
strings and in numeric literals.

Database Files
Database files allow information to be permanently stored on the system. Multiple
programs can access this information in different ways.
A database file is subdivided into groups of records called members.
There are two types of database files: physical files and logical files.
Physical Files: A physical file is a file that actually contains data records. This
makes physical files similar to disk files on other systems. A physical file can
contain only fixed-length records, all of which have the same format.
Logical Files: A logical file is a database file through which data from one or
more physical files can be accessed. The format and organization of this data is
different from that of the data in the physical file(s). Each logical file can define a
different access path (index) for the data in the physical file(s). Each logical file
can exclude and reorder the fields defined in the physical file(s).
Device Files
A device file reads from or writes to a device or remote system. A device file controls
the transfer of data between the physical device or remote system and the
program.
DDM Files
Distributed Data Management (DDM) allows you to access data that reside on
remote systems that support DDM. DDM files are supported by the COBOL compiler.
You can retrieve, add, update, or delete data records in a file that resides on
another system.
When you compile a source program that is on a remote system, the COBOL/400
compiler expects a source type of CBL. If the source type is not CBL, the compiler
issues a message indicating that it encountered an unexpected source member
type. To resolve this discrepancy, you should recompile the program in the environment
indicated by the source member type, or change the source member type,
or use the correct compiler indicated by the source member type.

Save Files
A save file is a file that is used to prepare data in a format that is correct for
backup and recovery purposes or for transportation to another system. A save file
can be used to contain the output that is produced from the Save Library (SAVLIB)
or Save Object (SAVOBJ) CL commands.

Anda mungkin juga menyukai