Skip to content
Tutorials Center
My learning

Topics

Lesson 24 of 38 ยท Divisions and Data Description

Identification and Environment Divisions

Learn PROGRAM-ID, optional identification paragraphs, the CONFIGURATION SECTION, SPECIAL-NAMES (DECIMAL-POINT IS COMMA, CLASS) and FILE-CONTROL basics.

The first two divisions are short, but they do two important jobs. The identification division gives the program a name that the rest of the system can use. The environment division describes the machine and the outside world: special characters, currency symbols, and which real files the program's file names refer to. Once these are written you rarely touch them again.

The identification division

COBOL
       IDENTIFICATION DIVISION.
       PROGRAM-ID. PAYROLL.
       AUTHOR. A. DEVELOPER.
       INSTALLATION. HEAD OFFICE.
       DATE-WRITTEN. 2026-01-15.
       DATE-COMPILED.
  • PROGRAM-ID. is the only required paragraph. It names the program and is the name other programs use in a CALL. In fixed format it is usually up to 8 characters on mainframes (a load-module name).
  • AUTHOR, INSTALLATION, DATE-WRITTEN, DATE-COMPILED and SECURITY are obsolete since COBOL-2002 but compilers still accept them as documentation. Comments (* in column 7) are the modern way.
  • IDENTIFICATION DIVISION may be abbreviated to ID DIVISION.

A program can mark itself as PROGRAM-ID. PAYROLL IS INITIAL. (state resets on every call), IS COMMON (visible to sibling nested programs) or IS RECURSIVE (may call itself). Those matter for subprograms.

The environment division

COBOL
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SOURCE-COMPUTER. IBM-ZSERIES.
       OBJECT-COMPUTER. IBM-ZSERIES.
       SPECIAL-NAMES.
           DECIMAL-POINT IS COMMA
           CURRENCY SIGN IS "E"
           CLASS VALID-GRADE IS "A" THRU "F".
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT CUSTOMER-FILE ASSIGN TO "customers.dat"
               ORGANIZATION IS LINE SEQUENTIAL.

It has two sections.

CONFIGURATION SECTION

SOURCE-COMPUTER and OBJECT-COMPUTER are documentation only on modern compilers. The useful paragraph is SPECIAL-NAMES, which customises the language:

  • DECIMAL-POINT IS COMMA swaps the roles of . and , in numeric literals and edited pictures, as used in much of Europe. PIC 9(3),99 then means "three digits, a decimal comma, two digits".
  • CURRENCY SIGN IS "E" changes the symbol used in edited pictures from $ to another character.
  • CLASS name IS "A" THRU "F" defines your own class condition. After this, IF GRADE IS VALID-GRADE is true when the field only contains the characters A to F.
  • SYMBOLIC CHARACTERS, ALPHABET and device names such as CONSOLE IS CRT also appear here.

INPUT-OUTPUT SECTION

FILE-CONTROL contains one SELECT entry per file. A SELECT links the internal file name used in the program (CUSTOMER-FILE) to an external file (ASSIGN TO), and says how the file is organised. On the mainframe the ASSIGN name is a DD name defined in the job (JCL); in GnuCOBOL it is a file path or an environment variable. File handling gets a full chapter, File Handling; for now just recognise the pattern.

COBOL
           SELECT ORDER-FILE ASSIGN TO "orders.idx"
               ORGANIZATION IS INDEXED
               ACCESS MODE IS DYNAMIC
               RECORD KEY IS ORDER-ID
               FILE STATUS IS ORDER-STATUS.

A program that does no file or special-name work needs no environment division at all; omit it.

Decimal comma, in practice (Python stand-in)

The runnable blocks on this page are Python stand-ins, not COBOL. DECIMAL-POINT IS COMMA affects how numbers are written and edited. The next block models a numeric edited field (PIC ZZ.ZZ9,99 with that clause on) by formatting a number the European way.

Python DECIMAL-POINT IS COMMA

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A user-defined class (Python stand-in)

CLASS VALID-GRADE IS "A" THRU "F" lets you write IF GRADE IS VALID-GRADE. The class is just a set of characters.

Python CLASS condition

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Common mistakes

  • Forgetting the period after PROGRAM-ID. NAME, which makes the next line a syntax error.
  • Using a hyphenated or long program name where the target system requires 8 characters.
  • Putting SPECIAL-NAMES before CONFIGURATION SECTION (the order is fixed).
  • Declaring DECIMAL-POINT IS COMMA and then writing 19.99 in a literal: the literal must now be 19,99.
  • Assuming ASSIGN TO always means a literal file name. On z/OS it is a DD name, and on GnuCOBOL a plain name may be looked up as an environment variable (DD_NAME) first.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which identification division paragraph is required?

    PROGRAM-ID names the program. The others are obsolete documentation paragraphs.
  2. 2. What does DECIMAL-POINT IS COMMA do?

    The clause in SPECIAL-NAMES swaps decimal point and thousands separator in source code and edited pictures.
  3. 3. What does a SELECT entry in FILE-CONTROL do?

    SELECT only describes the file; OPEN and READ are procedure division statements.
  4. 4. Which sections can appear in the environment division?

    The environment division has the CONFIGURATION SECTION and the INPUT-OUTPUT SECTION.

Summary

  • PROGRAM-ID names the program; the other identification paragraphs are obsolete documentation.
  • The environment division has a configuration section (SPECIAL-NAMES customises the language) and an input-output section (FILE-CONTROL with SELECT).
  • DECIMAL-POINT IS COMMA, CURRENCY SIGN and CLASS are the most useful special names.
  • Programs without files or special names can omit the environment division.

Next: Data Division and Level Numbers