COBOL400-1

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

description

1st doc of cobol400

Transcript of COBOL400-1

EntriesAn entry is a series of clauses ending with a separator period. Entries are constructedin the Identification, Environment, and Data Divisions.ClausesA clause is an ordered set of consecutive COBOL character-strings that specifiesan attribute of an entry. Clauses are constructed in the Identification, Environment,and Data Divisions.SentencesA sentence is a sequence of one or more statements, ending with a separatorperiod. Sentences are constructed in the Procedure Division.StatementsA statement is a valid combination of a COBOL verb and its operands. It specifiesan action to be taken by the object program. Statements are constructed in theProcedure 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.PhrasesEach clause or statement in the program can be subdivided into smaller unitscalled phrases.The following areas are described below in terms of an 80-character line:Sequence Number AreaColumns 1 through 6Indicator AreaColumn 7Area AColumns 8 through 11Area BColumns 12 through 72Comment AreaColumns 73 through 80 are available for your own use; for example, to identifyyour program.Division HeaderA division header is a combination of words, followed by a separator period, thatindicates 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 Divisionheader) must be immediately followed by a separator period. Except for theUSING phrase, no text may appear on the same line.Section HeaderIn the Environment and Procedure Divisions, a section header indicates the beginningof a series of paragraphs; for example:FILE-CONTROL.DECLARATIVES.In the Data Division, a section header indicates the beginning of an entry; forexample:FILE SECTION.A section header must be immediately followed by a period except when ProcedureDivision segment numbers are specified.Paragraph Header or Paragraph NameA paragraph header or paragraph name indicates the beginning of a paragraph.In the Environment Division, a paragraph consists of a paragraph header followedby one or more entries. For example:OBJECT-COMPUTER. computer-nameIn the Procedure Division, a paragraph consists of a paragraph-name followed byone 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 followedby 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 of01 or 77. For more information, see Level-Numbers on page 110.DECLARATIVES and END DECLARATIVESDECLARATIVES and END DECLARATIVES are key words that begin and end thedeclaratives part of the source program.In the Procedure Division, each of the key words DECLARATIVES and ENDDECLARATIVES must begin in Area A and be followed immediately by a separatorperiod; no other text may appear on the same line. After the key words ENDDECLARATIVES, 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, ClausesThe first entry, sentence, statement, or clause begins on either the same line as theheader or paragraph-name it follows, or in Area B of the next nonblank line that isnot a comment line. Successive sentences or entries either begin in Area B of thesame line as the preceding sentence or entry or in Area B of the next nonblank linethat 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 ifthe input statements are indented. Indentation does not affect the meaning of theprogram. The programmer can choose the amount of indentation, subject only tothe restrictions on the width of Area B. See also Sections and Paragraphs onpage 14.Continuation LinesAny sentence, entry, clause, or phrase that requires more than one line can becontinued 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 continuationlines. 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 interchangedin 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 Clause55333DECIMAL-POINT33-3333-33COMMA3333333333333333333333333333333333335%,3IS32Figure 19. FormatExchanges the functions of the period and the comma in PICTURE characterstrings and in numeric literals.

Database FilesDatabase files allow information to be permanently stored on the system. Multipleprograms 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. Thismakes physical files similar to disk files on other systems. A physical file cancontain 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 ormore physical files can be accessed. The format and organization of this data isdifferent from that of the data in the physical file(s). Each logical file can define adifferent access path (index) for the data in the physical file(s). Each logical filecan exclude and reorder the fields defined in the physical file(s).Device FilesA device file reads from or writes to a device or remote system. A device file controlsthe transfer of data between the physical device or remote system and theprogram.DDM FilesDistributed Data Management (DDM) allows you to access data that reside onremote 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 onanother system.When you compile a source program that is on a remote system, the COBOL/400compiler expects a source type of CBL. If the source type is not CBL, the compilerissues a message indicating that it encountered an unexpected source membertype. To resolve this discrepancy, you should recompile the program in the environmentindicated by the source member type, or change the source member type,or use the correct compiler indicated by the source member type.Save FilesA save file is a file that is used to prepare data in a format that is correct forbackup and recovery purposes or for transportation to another system. A save filecan be used to contain the output that is produced from the Save Library (SAVLIB)or Save Object (SAVOBJ) CL commands.