COBOL (COmmon Business Oriented Language) is a business-oriented language it is very suitable for data processing with high performance and precision, it is offered by IBM.
You can be sure that any purchases or withdrawals you make with your credit card start a COBOL program. Every day COBOL processes millions of transactions. From my point of view learning COBOL is a very interesting set of knowledge.
I have worked with this language for more than 10 years and I share here some notes that will probably allow you to get your hands on it.
The mainframe is modernizing with the ability to program with the latest tools such as the free code editor VsCode and zowe extension as well as Z Open editor, run in the cloud in environments such as Open Shift and integrate devops principles with tools such as Github, Jenkins, Wazi.
The SYNtax of COBOL is quite simple and is similar to the natural language in English.
The code is standardized according to columns that can describe 5 key areas.
Area sequence: specifies a sequence number of the line of code sometimes, sometimes blank
Indicator Area: May contain an indicator for example – to indicate that the line is a comment, D to indicate that the line runs only in debugging mode.
A AREA: Contains divisions, sections, paragraphs and Lift
B AREA: Sentences and statements of the program cobol for example COMPUTE something…
Area Identification: space to ignore and leave blank.
There are also words reserved in COBOL you will find on the link the list of words reserved in COBOL. https://www.ibm.com/support/knowledgecenter/SSZJPZ_9.1.0/com.ibm.swg.im.iis.ds.mfjob.dev.doc/topics/r_dmnjbref_COBOL_Reserved_Words.html
The code is structured by divisions that contain Paragraph-composed Sections themselves made up of Sentences and Statements.
Example of sentences:
ADD 45 TO PRICE.
Note that the point corresponds to an implied scope terminator.
There are 4 Divisions in a COBOL program:
– DATA DIVISION: allows you to set up the data management that will be processed by the program.
– DIVISION IDENTIFICATION: Program name and programmer, program date, program purpose.
– QUARTER ENVIRONEMENT: Type of computer uses and mapping between files used in the program and dataset on the system (link between program and system)
– PROCEDURE DIVISION: This is where the business code composed of the different paragraphs to be executed is contained.
The variables in Cobol:
As in other languages, letters can be used to represent values stored in memory.
The name of a variable is a maximum of 30 characters.
A Picture clause allows you to determine the type of variable.
PIC 9: Digital length is in brackets.
PIC 9(5): digital variable of 5 digits the maximum length for a digital is 18.
PIC A for a character
PIC X(11): an alphanumeric with a maximum length of 255
It is possible to have types edited using symbols:
PIC 9(6)V99 for a 6 digits and 2 decimals separated by comma.
PIC $9,999V99 to represent an amount
Note that COBOL provides constant liters such as ZEROES, SPACE, SPACES, LOW-VALUE …
More information on this link:
If you are new to IBM COBOL and want to do a serious and not too expensive apprenticeship, I recommend you read this book:
This book covers a lot of topics related to machine language, IBM Cobol training, Open Cobol IDE, DB2 to become a true Cobol programmers.
See also my articles: