Example 1

This is a very simple program we give a number from the keyboard between 0,99 and the program prompt it to the screen.

IDENTIFICATION DIVISION.
PROGRAM-ID. EXAMPLE1.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 NUMB1 PIC 99.

*numb1 is the main variable

77 PAUS PIC X.
*paus it is used to stop the run of the program so we can see the data on the screen

PROCEDURE DIVISION.
PROCEDURE1.
DISPLAY " " ERASE.
*clear screen

DISPLAY "GIVE A NUMBER BETWEEN 0 - 99: ".
ACCEPT NUMB1.
*this instruction wait until we press something

DISPLAY "THE NUMBER YOU GIVE IS: " NUMB1.
*this instruction prompt the message in the quotes and the number we press

ACCEPT PAUS.
*this instruction waits

STOP RUN.

Tsamantero , [email protected], Cobol Examples
Time to go home?
Back to main page