These pages contain the COBOL programming lectures and tutorials for CS4312 - Software Engineering 2.
The COBOL programming lectures are delivered using Microsoft PowerPoint slides. Each topic includes links to view the slides in your browser and download the .pptx file.
Module Contents
General Introduction
- What is a program?
- What is an Algorithm?
- Iteration, Selection and Sequence.
- Variables.
Introduction to COBOL
- COBOL design goals.
- COBOL Metalanguage.
- Structure of COBOL programs.
- The four divisions.
- IDENTIFICATION DIVISION, DATA DIVISION, PROCEDURE DIVISION.
- Sections, paragraphs, sentences and statements.
- Example COBOL programs.
COBOL Basics 1
- The COBOL coding rules.
- Name construction.
- Describing Data.
- Data names/variables.
- Cobol Data Types and data description.
- The PICTURE clause.
- The VALUE clause.
- Literals and Figurative Constants.
- Editing, compiling, linking and running COBOL programs
COBOL Basics 2
- Level Numbers.
- Group and elementary data items.
- Group item PICTURE clauses.
- The MOVE. MOVEing numeric items.
- DISPLAY and ACCEPT.
Introduction to Sequential Files
- Files, records, fields.
- The record buffer concept.
- The SELECT and ASSIGN clause.
- OPEN, CLOSE, READ and WRITE verbs.
Processing Sequential Files
- File organization and access methods.
- Ordered and unordered Sequential Files.
- Processing unordered files.
- Processing ordered files.
Simple iteration with the PERFORM verb
- Non-Iteration PERFORM.
- GO TO and PERFORM....THRU.
- In line and out of line PERFORM.
- PERFORM n TIMES.
- PERFORM .... UNTIL.
- Using the PERFORM...UNTIL in processing files.
Arithmetic and Edited Pictures
- ROUNDED option.
- ON SIZE ERROR option.
- ADD, SUBTRACT, MULTIPLY, DIVIDE and COMPUTE.
- Edited PICTURE clauses.
-
- Simple Insertion.
- Special Insertion.
- Fixed Insertion.
- Floating Insertion.
- Suppression and Replacement.
Conditions
- IF..THEN...ELSE.
- Relation conditions.
- Class conditions.
- Sign conditions.
- Complex conditions.
- Implied Subjects.
- Nested IFs and the END-IF.
- Condition names and level 88's.
- The SET verb.
Designing Programs
- Why we use COBOL.
- The problem of program maintenance.
- How Cobol programs should be written.
- Efficiency vs Clarity.
- Producing a good design.
- Introduction to design notations.
- Guidelines for writing Cobol programs.
Introduction to Diagrammatic Stepwise Refinement
- Steps in the DSR approach
- Stepwise Refinement
- Program Structure Diagrams
- Sequence
- Selection
- Iteration
- Payroll Proof Totals program
SORT and MERGE
- Simple SORTing.
- The SD entry.
- SORTing with Input and Output procedures.
- RETURN and RELEASE.
- The MERGE.
Tables and the PERFORM ... VARYING
- Introduction to tables.
- Declaring tables.
- Processing tables using the PERFORM..VARYING.
Advanced Tables
- Defining and processing multi-dimension tables.
- The REDEFINES clause.
- Creating pre-filled tables.
- Multi-dimension pre-filled tables.
- Cobol 85 table changes.
- Defining variable length tables.
Searching Tables
- The SEARCH
- The SEARCH ALL. verbs.
Advanced Sequential Files
- Multiple record type files.
- Variable length records.
Introduction to Direct Access Files
- Introduction to Relative Files.
- Introduction to Indexed files.
- Advantages and disadvantages of Sequential, Relative and Indexed files.
Relative Files
- Creating and reading a Relative file.
- SELECT and ASSIGN entries for Relative Files.
- OPEN, CLOSE, READ, WRITE, REWRITE, DELETE and START verbs.
- Error handling using Declaratives.
Indexed Files
- Creating and Reading an Indexed file.
- SELECT and ASSIGN entries for Indexed files.
- Primary and alternate keys.
- OPEN, CLOSE, READ, WRITE, REWRITE, DELETE and START verbs.
Calling Subprograms
- The CALL verb.
- COBOL Subprograms.
- Parameter passing mechanisms.
- The LINKAGE SECTION.
- The IS INITIAL phrase.
- The CANCEL command.
- Contained subprograms.
- The COMMON PROGRAM phrase.
- GLOBAL and EXTERNAL Data.
The INSPECT
INSPECT ... TALLYING— counting character occurrences in a string.INSPECT ... REPLACING— replacing characters in a string.INSPECT ... CONVERTING— character-by-character substitution.- The LEADING, FIRST, BEFORE, and AFTER phrases.
The STRING
-
STRING ... DELIMITED BY— concatenating multiple strings into one destination string. - The
WITH POINTERphrase. - The
ON OVERFLOWandNOT ON OVERFLOWphrases.
The UNSTRING
UNSTRING ... DELIMITED BY— splitting a source string on a delimiter.- The
DELIMITER INandCOUNT INphrases. - The
WITH POINTERandTALLYING INphrases. - The
ALLphrase andON OVERFLOWclause.
The USAGE clause
USAGE IS DISPLAY— default character-format storage.USAGE IS COMP— binary two's complement storage.USAGE IS PACKED-DECIMAL— binary-coded-decimal (BCD) storage.- The
SYNCHRONIZEDclause and word-boundary alignment.
The COBOL Report Writer - A worked example
Unlike the other topics here, which contain only the slides from my COBOL lectures, the Report Writer units contain a full tutorials. I am rewriting all the topics to this level and would be interested in your comments on this one. Please send comments to - michael.coughlan@ul.ie
This tutorial introduces the Report Writer by means of a worked example. It starts by looking at the output produced by a fairly complex Report Writer program and then examines what code the programmer had to write to produce the report.
Please note the copyright restrictions at the end of the Report Writer tutorial.
The COBOL Report Writer - Syntax and Semantics
This tutorial provides a Report Writer reference. The syntactic elements of the Report Writer are presented and the semantics of their operation discussed.
Please note the copyright restrictions at the end of the Report Writer tutorial.
The COPY
- The COPY verb
- Why use COPY Libraries.