COBOL – Basic Syntax | Coding Sheet

If you are interested to learn about the Program structure

Every programming language requires an environment or platform to write codes before compilation and execution. For example, in Java programming language, notepad is used to write programs before compile and run them.

Character Set

‘Characters’ are lowest in the hierarchy and they cannot be divided further. The COBOL Character Set includes 78 characters which are shown below −

Sr.No.Character & Description
1A-ZAlphabets(Upper Case)
2a-zAlphabets (Lower Case)
4 Space
5+Plus Sign
6Minus Sign or Hyphen
8/Forward Slash
9$Currency Sign
12.Decimal Point or Period
13Quotation Marks
14(Left Parenthesis
15)Right Parenthesis
16>Greater than
17<Less than
20=Equal Sign

Coding Sheet

The source program of COBOL must be written in a format acceptable to the compilers. COBOL programs are written on COBOL coding sheets. There are 80 character positions on each line of a coding sheet. In COBOL program structure, the COBOL code statements are self-explanatory that are easy to understand. COBOL is a high-level business-oriented programming language. It is mainly used for business, finance, and administrative systems for companies and governments

Character positions are grouped into the following five fields −

1-6Column NumbersReserved for line numbers.
7IndicatorIt can have Asterisk (*) indicating comments, Hyphen (-) indicating continuation and Slash ( / ) indicating form feed.
8-11Area AAll COBOL divisions, sections, paragraphs and some special entries must begin in Area A.
12-72Area BAll COBOL statements must begin in area B.
73-80Identification AreaIt can be used as needed by the programmer.


The following example shows a COBOL coding sheet −

000100 IDENTIFICATION DIVISION.                                         000100
000200 PROGRAM-ID. HELLO.                                               000101
000250* THIS IS A COMMENT LINE                                          000102
000300 PROCEDURE DIVISION.                                              000103
000350 A000-FIRST-PARA.                                                 000104
000400     DISPLAY “Coding Sheet”.                                      000105
000500 STOP RUN.                                                        000106

JCL to execute the above COBOL program −


When you compile and execute the above program, it produces the following result −

Coding Sheet

Character Strings

Character strings are formed by combining individual characters. A character string can be a

  • Comment,
  • Literal, or
  • COBOL word.

All character strings must be ended with separators. A separator is used to separate character strings. Frequently used separators − Space, Comma, Period, Apostrophe, Left/Right Parenthesis, and Quotation mark.


A comment is a character string that does not affect the execution of a program. It can be any combination of characters. A comment is a written statement which is used to specify the programmers’ remark in the source code. The content written as the comment is ignored by the compiler.

There are two types of comments −

Comment Line

A comment line can be written in any column. The compiler does not check a comment line for syntax and treats it for documentation. If the comment line starts with an asterisk (*), then the comment is not compiled to produce object code. It is completely ignored by the compiler. On the other hand, if the comment line starts with a character slash (/), then that particular comment line gets printed and the page is ejected

Comment Entry

Comment entries are those that are included in the optional paragraphs of an Identification Division. They are written in Area B and programmers use it for reference.

The text highlighted in Bold are the commented entries in the following example −

000100 IDENTIFICATION DIVISION.                                         000100
000150 PROGRAM-ID. HELLO.                                               000101 
000200 AUTHOR. <strong>future fundamentals.</strong>.                                          000102
000250* THIS IS A COMMENT LINE                                          000103
000300 PROCEDURE DIVISION.                                              000104
000350 A000-FIRST-PARA.                                                 000105  
000360/ First Para Begins - Documentation Purpose                       000106
000400     DISPLAY “Comment line”.                                      000107
000500 STOP RUN.                                                        000108

JCL to execute above COBOL program −


When you compile and execute the above program, it produces the following result −

Comment Line


Literal is a constant that is directly hard-coded in a program. In the following example, “Hello World” is a literal.

DISPLAY 'Hello World'.

There are two types of literals as discussed below −

Alphanumeric Literal

Alphanumeric Literals are enclosed in quotes or apostrophe. Length can be up to 160 characters. An apostrophe or a quote can be a part of a literal only if it is paired. Starting and ending of the literal should be same, either apostrophe or quote.


The following example shows valid and invalid Alphanumeric Literals −

   ‘This is valid’
   "This is valid"
   ‘This isn’’t invalid’

   ‘This is invalid”
   ‘This isn’t valid’

Numeric Literal

A Numeric Literal is a combination of digits from 0 to 9, +, –, or decimal point. Length can be up to 18 characters. Sign cannot be the rightmost character. Decimal point should not appear at the end.


The following example shows valid and invalid Numeric Literals −




COBOL Word is a character string that can be a reserved word or a user-defined word. Length can be up to 30 characters.


User-defined words are used for naming files, data, records, paragraph names, and sections. Alphabets, digits, and hyphens are allowed while forming userdefined words. You cannot use COBOL reserved words.

Reserved Words

Reserved words are predefined words in COBOL. Different types of reserved words that we use frequently are as follows −

  • Keywords like ADD, ACCEPT, MOVE, etc.
  • Special characters words like +, -, *, <, <=, etc
  • Figurative constants are constant values like ZERO, SPACES, etc. All the constant values of figurative constants are mentioned in the following table.

Figurative Constants

Sr.No.Figurative Constants & Description
1HIGH-VALUESOne or more characters which will be at the highest position in descending order.
2LOW-VALUESOne or more characters have zeros in binary representation.
3ZERO/ZEROESOne or more zero depending on the size of the variable.
4SPACESOne or more spaces.
5QUOTESSingle or double quotes.
6ALL literalFills the data-item with Literal.

COBOL – Basic Syntax | Coding Sheet
Show Buttons
Hide Buttons