Read an Input File with COBOL

Offered By
Coursera Project Network
In this Guided Project, you will:

Describe the function of File section in the Data Division in a COBOL program.

Write the COBOL code that reads an input file and writes an output file.

Demonstrate the process of compiling and running a COBOL program in OpenCobolIDE.

Clock1.5 hours
BeginnerBeginner
CloudNo download needed
VideoSplit-screen video
Comment DotsEnglish
LaptopDesktop only

In this project you will use COBOL code to read the data records from a sequential file. You will code, compile, and run programs using the PC-based COBOL IDE called OpenCobolIDE. Since COBOL is often used with large amounts of data, the ability to process files—to read the records in them as input and write the records as output—is a critical skill for any COBOL programmer.

Skills you will develop

  • OpenCobolIDE
  • Common Business Oriented Language (COBOL)
  • COBOL FD
  • File Processing
  • COBOL Programming

Learn step-by-step

In a video that plays in a split-screen with your work area, your instructor will walk you through these steps:

  1. Examine a sample sequential file as you observe how it is used to organize data and learn the associated terminology.

  2. Code the COBOL FD statement in the File section of the Data Division to describe the fields that make up a record within a sequential file used as input.

  3. Add, compile, and run the code in a COBOL program’s Procedure Division to read through the records in a sequential input file and then display the fields from each record on the screen.

  4. Define the layout of an output file in a COBOL program Data Division’s File section by describing the fields and data types that make up each record.

  5. Add, compile, and run COBOL code that moves data from the input record to the output record and generates a sequential file as output.

How Guided Projects work

Your workspace is a cloud desktop right in your browser, no download required

In a split-screen video, your instructor guides you step-by-step

Frequently asked questions

Frequently Asked Questions

More questions? Visit the Learner Help Center.