ANSI Format

The ANSI source format divides an input line into several fields. These are determined by character position. Each input line must be 80 characters. Input lines that are shorter than 80 characters are padded with spaces to make 80 characters, while lines longer than 80 characters are truncated on the right. Tab characters are converted into spaces such that the tab stops are eight characters apart.

The ANSI format has five fields. These are:

Field Description
Sequence Number Area (columns 1 – 6) This area is ignored by the compiler and may contain any characters. It is traditionally used for sequence numbers to re-order a scrambled card deck.
Indicator Area (column 7) This column must contain one of the following characters:
  • Space -- Default. The compiler processes the line normally.
  • Hyphen -- Continuation. The compiler processes the line as a continuation of the previous line.
  • Asterisk -- Comment. The compiler ignores the contents of the line.
  • Dollar sign -- Comment. The compiler ignores the contents of the line.
  • Slash -- New page. Same as asterisk, except that in the source listing created by the compiler this line starts on a new page.
  • "D" -- Conditional debugging line. The Compiler treats this line as a comment line unless the compiler is run with the option to include debugging lines, in which case the line is treated normally.
Area A (columns 8 – 11) Area A contains division headers, section headers, paragraph names, and some level indicators
Area B (columns 12 – 72) Area B contains all other COBOL text.
Identification Area (columns 73 – 80) Any desired text may be placed here. However, the compiler can conditionally compile lines based on patterns found in this area. For details, see Source Code Control.