COBOL - COmmon Business Oriented Language is a structured Programming Language which works on these 3 principles Sequence, Selection and Iteration.
A structured Programming Language had the following advantage,
Like JCL, COBOL also has a coding format to follow with the 80 byte coding sheet.
|Sequence field||for line numbers|
|Indicator field||‘/’ or ‘*’ or ‘-’|
|Margin A & Margin B||Program Statements|
|Identification field||Source listing|
A COBOL program is divided in to a structure and each structure will contain another structure within it. To explain it better, check this picture
COBOL program has several DIVISIONS. With in each division there will be several SECTIONS and with in each sections, there will be several PARAGRAPHS. With in each paragraphs, there will be COBOL statements which are comprised of COBOL verbs.
Things to note in COBOL program structure:
COBOL words have some reserved keywords and most are user-defined.
A COBOL word must be formed of the following characters
0 – 9 or A – Z or hyphen
The character set in COBOL are
COBOL character set has 52 characters
|0 – 9||Numerals|
|A – Z||English Letters, Space or Blank|
|+ - * / = $ or £ , ; : . " ( ) < >||Special characters|
COBOL identifiers are same as variables which provides reference to the storage space in the memory.
The identifier naming rules are:
Examples of valid datanames or identifiers or variables
EMP-NUM EMP123 123EMP
Examples of Invalid datanames or identifiers or variables