Contributed by: remy Thursday, 04 July 2013, 11:05 @ CEST
Melody: Modern Major General, by Gilbert and Sullivan
Lyrics by Carolyn Jorgensen, who wrote this in order to pass exam at Cobol 101.
This is a simple model of the standard COBOL structure form.
Four separate parts to understand which all procedures must conform.
IDENTIFY, ENVIRONMENT, some DATA and PROCEDURE too,
each has their tricky ins and outs especially to confuse you.
I-DEN-TI-FI-CA-TION is the first and likewise is the easiest,
with ID name and author for perusal by a nosy guest,
Date written and compiled is also information to be keyed,
and some remarks to toss right in for those who really like to read.
ENVIRONMENT DIVISION has the SOURCE and OBJECT com-put-ers,
next INPUT / OUTPUT sections with SELECT / ASSIGN part-ti-u-lars.
There's one SELECT created just for every file's special name,
Then ASSIGN to which output or drive with path and file name.
DATA has two major parts: FILE SECTION and the WORKING STORE,
with one FD for every file SELECT / ASSIGN had named before.
Each FD has a BLOCK, RECORD, a LABEL, and the DATA too,
DATA's broken down to fields with LEVEL names and PICTURES too.
WORKING STORAGE is the place where all the extra parts are kept,
like HEADINGS, FILLERS, COUNTERS, SWITCHES, and the like it will accept.
At placing them through the report you really should be most adept,
They'll dress up all those boring files and you won't look so quite inept.
PROCEDURE is the final phase within the COBOL symphony,
where everything defined before now sings together perfectly.
The paragraphs are numbered to outline the movements of the score,
Now DATA takes the center stage and WORKING STORAGE is the corps.
INITIALIZE with OPEN files, MOVE zeros to the counters too,
Then start the LOOPs with READ and IFs, while counters keep close track for you.
MOVE each FIELD-NAME to RECORD-LINE so you can print it carefully,
Then print the HEADERS, CLOSE the files, and STOP RUN ends it perfectly