COBOL program format

xiaoxiao2021-03-06  13

The format of the COBOL source program is as follows:

Each line is starting with 6 characters. You can enter 000010, 000020, etc., or may not be lost.

The serial number zone is an indicator area of ​​a character (5th), as shown in the first line. You can use * and / to comment, _ means continuation, D represent debugging.

The indicator area is behind 4 characters (8 ~ 11) A zone. You can put in the department, section, section title, segment name, layer indicator and layers 01 and 77,

Keywords Declaratives and End Declaratives, the program ends the title.

The A zone is behind (after 12 digits) is a statement, called a zone. The statement of the process department must start from the B zone. The B region is usually 72 or 80 characters.

This example is 70 characters.

Each area of ​​the blank line is space

The identification department (2 ~ 4 line), the Program-ID section contains the program name, which must be every program. Other sections such as Author can be available.

The Ministry of Environment (5 ~ 15 lines) provides items related to the outside of the program, specifically, is the file used by the program. If you don't need to be omitted.

The environment has a configuration festival (6 ~ 10 rows) and input output fees (11 to 15 rows).

Chain 7 represents the computer of the compiler. If you specify with debugging mode, you will be compiled.

Chapter 8 represents the computer running.

The 9th, 10 lines contain a set of specified output styles. Here is the standard output and can be customized.

The input and output section is only used for files.

Sections 13 to 15 indicate that this segment contains an item for each file if the program uses the file.

The format of the file control project depends on the type of document.

Data units (16-22 rows), providing the storage location of the program variable, divided into different data types: file section,

Static Data (Linkage Section), communication (Communication Section),

Report section.

Document Festival (18 ~ 21 line), each file description contains the definition of files included in the file, data in the file section or from the file session,

Or generated by the program of write files.

Chapter 22 represents the work storage festival, which contains the temporary results required for the program and the data initialized static data.

Linkage Section contains data transferred by the call (called parameters in other languages).

Communication Section, process messages between COBOL programs and communication devices.

Report Section, the Report section implements the data required by the COBOL report writing tool system.

The PIC of the 20th, 21 line is the abbreviation of the Picture, indicating the defined data format.

X (12) represents a string of 12 characters, 9 (09) represents 9-bit integers.

The basic items can be formed into hierarchies, called group data items or groups.

The definition of the data item in the COBOL program starts from the layers, and the 01 layer is the highest layer, and the 49 layer is the lowest layer.

The 77-layer project is used for a group of data items, such as temporary variables in the program.

66 floors are reserved for special descriptor projects, which can be renamed existing data items or groups, or in a manner that is not allowed.

88 floors is preserved for special data project conditions

Such as:

03 State Pic XX.

88 New-England Values ​​Are "1", "2", "3", "4", "5" .IF new-england ... the do something

The process department (23 ~ 30 rows) contains a procedure statement that makes up the program.

Process part of Declaratives. Some programs use special USE statements to indicate the process to be executed when they encounter special conditions,

If an I / O error occurs.

The USE statement is combined, placed at the beginning of the process, and is limited by keyword declaratives and end declaratives.

Chapter 24 is equivalent to defining a function of a name called ACAB030100-PROC ().

The 25th, 29 lines define the logo, you can use the Go TO statement to jump to this place, perform the following statement.

The second line is printed on the screen, equivalent to Printf ("ACAB030100-START");

Chapter 27 is to call the ACAB030100-PROC () function.

The requirements of the COBOL program: must be in English. At the end of the title, the section title, segment name, items, and statements.

When the journal is a decimal point, there are numbers on both sides.

转载请注明原文地址:https://www.9cbs.com/read-49559.html

New Post(0)