Menu
CoddyTech

FILLER

Part of the Data and Numbers section of Coddy's COBOL Programming journey. Lesson 3 of 23.

Some bytes of a record are never used by name, like the text and spaces between the items of an output line. FILLER declares them without a name:

01 OUT-LINE.
    05 FILLER PIC X(6) VALUE "Name: ".
    05 OUT-NAME PIC X(8).
    05 FILLER PIC X(7) VALUE " Score:".
    05 OUT-SCORE PIC 9(3).

The program fills the named items and displays the whole line. The FILLER text stays as its VALUE set it:

MOVE "Mia" TO OUT-NAME.
MOVE 120 TO OUT-SCORE.
DISPLAY OUT-LINE.
*> Name: Mia      Score:120

In an input record, FILLER skips characters the program does not need, such as the separators in 2026-11-23:

01 DATE-IN.
    05 IN-YEAR PIC 9(4).
    05 FILLER PIC X.
    05 IN-MONTH PIC 99.
    05 FILLER PIC X.
    05 IN-DAY PIC 99.

A record can have many FILLER items, since no statement refers to them. The word can also be left out: 05 PIC X VALUE "-". declares the same unnamed byte.

challenge icon

Challenge

Easy

Add two FILLER items to SCORE-LINE so it prints Player: Mia      Score: 120: one with "Player: " before OUT-NAME, and one with " Score: " between OUT-NAME and OUT-SCORE.

Example input, one line per ACCEPT: Mia, 120.

Try it yourself

       IDENTIFICATION DIVISION.
       PROGRAM-ID. SCORES.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 SCORE-LINE.
           *> A FILLER with "Player: " here
           05 OUT-NAME PIC X(8).
           *> A FILLER with " Score: " here
           05 OUT-SCORE PIC 9(3).
       PROCEDURE DIVISION.
           ACCEPT OUT-NAME.
           ACCEPT OUT-SCORE.
           DISPLAY SCORE-LINE.
           STOP RUN.

All lessons in Data and Numbers