HP 3000 Manuals

Source Format [ COBOL/HP-UX Language Reference for the Series 700 and 800 ] MPE/iX 5.0 Documentation


COBOL/HP-UX Language Reference for the Series 700 and 800

Source Format 

The COBOL source format divides each COBOL 
source record into 72 columns.  These columns are used in the following
way: 

Columns 1 - 6   Sequence number
Column 7        Indicator area
Column 8 - 11   Area A
Columns 12 -    Area B
72

Sequence Number 

A sequence number of six digits can be used to identify each source
program line.
________________________________________________________________________
|(MF)                                                                  |
|If the first character position of the sequence number field contains |
|an asterisk, or any nonprinting control                               |
|character (less than the character SPACE in the ASCII collating       |
|sequence), then the line is treated as comments and is not output to  |
|the listing file or device.  This facility allows an output listing   |
|file to be used as a source file to a subsequent compile.             |
|                                                                      |
|This support is sensitive to the MFCOMMENT compiler directive.  See   |
|your COBOL System Reference for details.                              |
________________________________________________________________________

            
________________________________________________________________________
|(ANS85)                                                               |
|The sequence number can contain any character in the computer's       |
|character set.                                                        |
________________________________________________________________________

            

Indicator Area 

An asterisk (*) in this area marks the line as documentary comment only.
Such a comment line 
can appear anywhere in the program after the IDENTIFICATION DIVISION
header.  Any characters from the ASCII character set can be included in
area A and area B of the line.
________________________________________________________________________
|(OSVS) (VSC2) (MF)                                                    |
|A comment line can appear before the IDENTIFICATION DIVISION          |
|header.                                                               |
________________________________________________________________________

            

A slash (/) in the indicator area acts as a comment 
line above but causes the page to eject before printing the comment.

A "D" or "d" (MF) (VSC2) in the indicator area represents a debugging 
line.  Areas A and B can contain any valid COBOL sentence.

A "-" in the indicator area represents a continuation 
of the previous line without spaces or the continuation of a non-numeric
literal (see the chapter COBOL Concepts).

Areas A and B 

Section names and paragraph names begin in area 
A and are followed by a period and a space.  Level indicators FD, SD, CD
and 01, 66, 77, 78 (MF) and 88 begin in area A and are followed in area B 
or area A (ANS85) by the appropriate file and record description.
________________________________________________________________________
|(MF)                                                                  |
|No rules regarding area A and area B are enforced except in relation  |
|to comment-entries in the Identification Division.                    |
________________________________________________________________________

            

More than one sentence is permitted in each source record.

Figure 1-1  shows the source format of a typical program. 

     000010 IDENTIFICATION DIVISION.
     000020 PROGRAM-ID. STOCK-FILE-SET-UP.
     000030 AUTHOR. MICRO FOCUS LTD.
     000040 ENVIRONMENT DIVISION.
     000050 CONFIGURATION SECTION.
     000060 SOURCE-COMPUTER. MDS-800.
     000070 OBJECT-COMPUTER. MDS-800.
     000075 SPECIAL-NAMES. CONSOLE IS CRT.
     000080 INPUT-OUTPUT SECTION.
     000090 FILE-CONTROL.
     000100    SELECT STOCK-FILE ASSIGN "STOCK.IT"
     000110    ORGANIZATION INDEXED
     000120    ACCESS DYNAMIC
     000130    RECORD KEY STOCK-CODE.
     000140 DATA DIVISION.
     000150 FILE SECTION.
     000160 FD      STOCK-FILE; RECORD 32.
     000170 01      STOCK-ITEM.
     000180    02   STOCK-CODE PIC X(4).
     000190    02   PRODUCT-DESC PIC X(24).

          Figure 1-1.  Sample Program Listing Showing Source Format (Cont'd Overleaf) 

[]
Figure 1-1. (Cont'd) Sample Program Listing Showing Source Format


MPE/iX 5.0 Documentation