Skip to main content
Module 5 · Lesson 1 of 29/16 in the course~16 min
Module lessons (1/2)

FILE-CONTROL (SELECT) and FILE SECTION (FD)

Lesson preview5 hands-on exercises readyCourse COBOL · Module 5 — Batch Sequential Files & I/O

Associate logical names with external datasets in ENVIRONMENT DIVISION, declare buffer FD/01 in FILE SECTION, and plot FILE STATUS.

What you'll learn in this lesson

  • Link internal logical names and external files using SELECT ... ASSIGN TO inside ENVIRONMENT DIVISION → INPUT-OUTPUT SECTION → FILE-CONTROL.
  • Choose the appropriate file organization (LINE SEQUENTIAL for text lines vs SEQUENTIAL binary records) and always declare FILE STATUS.
  • Define the structure of the I/O records via entries FD (File Description) in the FILE SECTION of the DATA DIVISION.

Overview

Before relational databases, flat files were the absolute backbone of data processing: even today, millions of bank statements, SEPA traces and nightly batches flow on sequential files at very high speed.

In the COBOL world the program never hardcodes open("/var/data/file.txt") into the business logic. Instead, declare a symbolic contract inside FILE-CONTROL.:

Sections covered in this lesson

  1. 11. Logical-physical association (ENVIRONMENT DIVISION)
  2. 22. Buffer declaration (DATA DIVISION → FILE SECTION)
  3. 33. Buffer FD vs Working Copies in WORKING-STORAGE
  4. 4Try it yourself
Pro Lesson · Module 5 — Batch Sequential Files & I/O

Unlock "FILE-CONTROL (SELECT) and FILE SECTION (FD)" and the full Course COBOL curriculum

Associate logical names with external datasets in ENVIRONMENT DIVISION, declare buffer FD/01 in FILE SECTION, and plot FILE STATUS.

Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.

  • Instant access to all advanced modules in Course COBOL plus 17 more courses
  • Hands-on browser exercises with automated test suites and solutions
  • 14-day money-back guarantee processed via Paddle.com

14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.