This tutorial on how to read
a COBOL layout was written specifically for our customers who have had a conversion
performed at Disc Interchange and have received a COBOL layout with the data.
It is intended to give you enough information to read most
simple layouts. It does not cover all topics or everything you would
find in a complex layout, and it is intended to explain COBOL layouts only
so you can use your converted data, not so you can write COBOL programs.
This article begins here: Reading COBOL Layouts where you will also find a topic index.
That's our business!
But it's those very features that can make it difficult to convert COBOL files to PC files. Most PC applications do not understand any of these concepts, and trying to deal with a complex COBOL file on a PC can be a nightmare. Disc Interchange deals with these situations every day, and we can offer you several options to cope with these issues when converting a mainframe COBOL file to a PC database. We often try to simplify the file, split it into multiple PC files, one for each record type, and convert the OCCURS-DEPENDING-ON to multiple PC records. Or if necessary, we can convert the OCCURS-DEPENDING-ON to a fixed number of occurrences. And of course we always convert comp, comp-3, and Signed fields to leading-sign ASCII numeric fields for the PC.
Although this article presented most common COBOL file features, there are a number of variations that we haven't covered in this tutorial. But if you understand all the basic examples above, you can manage to read most simple layouts by combining these rules. Be aware, however, that some data types are dependent upon the COBOL compiler and CPU it runs on (see part 4, Numeric Fields, and our article COBOL Computational Fields).
If you combine all the concepts above and expand the size to several hundred fields, you will get a typical COBOL file such as a medical or financial file. We've seen layouts of 100 pages that contained thousands of fields in a dozen record types. Often there's a mix of binary and character fields redefining each other, within multiple OCCURS. Devising a way to get such data into a PC database can be challenging, but it is possible.
COBOL layouts are one of the best known and understood methods of specifying a record layout. If you process data from a mainframe, you will certainly encounter COBOL layouts. Investing a little time to understand how to read the layouts, and becoming aware of pitfalls like redefined fields and records, could save you significant grief later. With a little practice you should find COBOL layouts easy to read, efficient, and concise.
Questions about COBOL: While DISC remains committed to providing personalized help to our conversion customers, regrettably I am no longer able to respond to general questions about how to write COBOL programs. The volume of questions is overwhelming for the time I have available, and it was never my intent to teach COBOL programming. There are other web sites and many good books written to address COBOL programming. I sincerely hope this article has been of help to you.
Back to the beginning of the article: Reading COBOL Layouts
For more articles on data conversion, see our TechTalk Index.
Our COBOL Conversion Services
Disc Interchange Service
Media Conversion Specialists
15 Stony Brook Road
Westford, MA 01886