The COBOL-85 Tutorial, Table of content.
The COBOL-85 Tutorial, Table of content.
Copyright © 1998-2017 Kim Kjærsulf.
A word about this text.
This is an online COBOL tutorial. The intended use of this text, is as a self study material.
To have the full use of this material, you need to have access to a COBOL compiler. You cannot learn a
programming language without writing programs. (think of your next trip by an air plane : would you feel
comfortable if you knew the pilot had never flown before, but only had read a book about flying?).
To learn all the details, you will have to consult the different manuals for you compiler.
You might find that your compiler cannot compile some of the samples or model answers in this material.
Please consult the reference manuals for your compiler, as some COBOL instructions are not implemented
in all compilers, just as there might be differences in how they are implemented.
The samples and the model answers have been compiled using compilers from Micro Focus ®and
the PERCobol-compiler® from Synkronix®.
The material is organised in an incremental fashion: It is strongly recommended that you work your
way through the chapters, the way they are numbered. The exercises is based on the knowledge
that is presented in the current and the preceding chapters.
There are no guide in this material as how to enter, compile or run the programs. This text is only
concerned with the COBOL programming language and not any specific compiler environment.
About the author.
Mr Kim Kjærsulf have been involved professionally in developing software, have worked as an assistant professor and a freelance consultant for more than 25 years. You will find an updated
CV on the Internet.
Disclaimer.
Neither the author nor any distributor of this material shall, under any circumstances, be liable to
any damage or loss you may have as a result of using, directly or indirectly, this material.
The material is supplied "as is", and any use of it is your own responsibility.
Copyright notice.
All files in this material is protected by copyright. You may copy or distribute any part of this material, but in doing so you have to include a reference to Kim Kjærsulf and the URL www.kjaersulf.dk.
History and purposes.
Strengths and weaknesses of COBOL.
An introduction to COBOL's syntax.
Format of source lines.
Basic structure of a COBOL source program.
CBL notation.
Detailed structure of a COBOL source program.
A description of programmer-defined sections and paragraphs.
COBOL and screens.
Exercises.
Variable names.
An introduction to level numbers.
An introduction to data types.
Symbolic constant name.
A more complete example.
REDEFINES.
Exercises.
Copying between fields.
Editing output.
Calculations.
ADD.
SUBTRACT.
MULTIPLY.
DIVIDE.
COMPUTE.
Intrinsic Functions.
Handling text strings.
Exercises.
Control structures.
IF.
Conditions.
Condition names defined by the programmer (level 88).
Class names.
PERFORM.
PERFORM - simple case.
PERFORM - thru.
PERFORM - repeat.
PERFORM - repeat (inline).
PERFORM - for loop.
GO TO.
EVALUATE.
Paragraph and section.
Records.
Qualifying a name.
Edited data fields.
Print lines.
MOVE ... CORR ...
Sequential file.
Declaring a sequential file.
Commands.
OPEN.
CLOSE.
READ.
WRITE.
Error routines.
An example of how to handle sequential files.
Exercises
Small is exquisite
Local versus external subprograms.
Declaration.
CALL and types of parameter.
CALL and CANCEL of external subprograms.
Example.
Exercises.
Tables / arrays in COBOL
Table declaration.
The use of tables with subscripts.
Initializing tables.
Complete example.
Use of tables with indexes.
indexexample
Search.
Binary search.
Sequential search
Search example.
An example of a multi-dimensional table.
An example of how to initialize a complex table.
Exercises
Index sequential file.
Declaring an index sequential file.
Commands.
OPEN.
CLOSE.
READ.
READ ... KEY.
READ ... NEXT.
READ ... PREVIOUS.
START.
WRITE.
REWRITE.
DELETE.
DELETE FILE.
UNLOCK.
COMMIT.
Error routines.
Locking files in connection with multi-user software.
Exclusive.
Shareable.
Single record lock.
Multi-record lock.
An example of how to handle index-sequential files.
Exercises
report writer control system.
Report Descriptor.
Vertical positioning.
Data manipulation.
SOURCE.
SUM.
VALUE.
Report sub-divisions.
RWCS in a procedure division.
INITIATE.
GENERATE.
TERMINATE.
SUPPRESS.
USE BEFORE REPORTING.
PAGE-COUNTER.
LINE-COUNTER.
Example.
Exercises
Relationship between module diagrams and COBOL.
Relationship between objects and COBOL.
COBOL and relational databases.
E-SQL.
ISAM files as a "database".
Exercises
Copyright © 1998-2017 Kim Kjærsulf
Last Updated January 29, 2017
For more information contact: Kim Kjærsulf