The Data Monster Under my bed : Migrating Cobol to the cloud – Part 2: Basics

Due to it essence and origin, initially COBOL was widely used in punch card systems, that presented some limitations, that stay the same to this day.

This limitation was to be adopted widely afterwards as there was a need for clear nomenclature and identification structure for clear differentiation of the statements.

This limitation was to be adopted widely afterwards as there was a need for clear nomenclature and identification structure for clear differentiation of the statements.

Structure

  • A given coding area always contain 80 columns/characters (sounds familiar :)) per line.
  • Characters 1-6 – reserved for sequence numbers, where
    • Characters 1-3 are reserved for a page number
    • Characters 4-6 are reserved for a line number
    • Both are increased automatically with the lines of code of the program.
  • Character 7 – reserved for special characteristics, like:
    • * – used for comment lines
    • ‘-‘ – used for continuation of the previous line
    • ‘/’ – printer stopper
    • ‘D’ – debugging indicator
  • Characters 8-72 – body of the program, devided in two segments
    • Characters 8-11 known as Area A – where all the DIVISIONS, SECTIONS, PARAGRAPHS and 01-77 level numbers definitions should be started
    • Characters 12-72 known as Area B – programming logic, statements should be defined
  • Characters 73-80 – Identification purpose segmented characters, not considered as part of the program, but considered as part of the display area (as a line consists of 80 characters)

Code sniped (taken from https://github.com/jiuweigui/cobol )

      * Prints a simple string
	IDENTIFICATION DIVISION.
	PROGRAM-ID. HelloWorld.
	AUTHOR. jiuweigui.
	PROCEDURE DIVISION.
	DISPLAY "Hello World!".
	STOP RUN.

TO BE CONTINUED …