DISPLAY / DIVISIONs
Try it yourself →Writes to the screen; the program is divided into DIVISIONs.
Syntax
DISPLAY value.
Description
Every COBOL program is divided into divisions (DIVISION): IDENTIFICATION (name), DATA (data), PROCEDURE (commands). DISPLAY writes to the screen. Every statement ends with a period (.). STOP RUN ends the program.
Example
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.
PROCEDURE DIVISION.
DISPLAY "Hello World".
STOP RUN.Expected output
Hello World
When to use?
Output, message.
Common mistakes
- ⚠️ Fixed format: DIVISION lines 7 spaces, statements further indented (~11 spaces).