IDENTIFICATION DIVISION .
PROGRAM-ID . sample01 .
PROCEDURE DIVISION .
DISPLAY " Hello COBOL 1" .
Without identification division
PROCEDURE DIVISION .
DISPLAY " Hello COBOL 2" .
01 username PIC X (30 ) VALUE " Mainframe" .
…
DISPLAY " Your name is " FUNCTION trim (username).
With variables, IBM dialect
01 ws-table.
02 rowcount PIC 9 VALUE 2 .
02 ws-row VALUE " GnuIBM" .
03 row-content PIC X (3 ) OCCURS 99 DEPENDING ON rowcount.
…
DISPLAY row-content( 2 ).
01 negative-number PIC S9 (6 )V9 (2 ) VALUE -12345.67 .
…
DISPLAY negative-number.
Basic test with fixed format
000100 IDENTIFICATION DIVISION .
000110 PROGRAM-ID . sample02 .
000120 *
000122 * Sample program in fixed format
000124 *
000130 PROCEDURE DIVISION .
000140 DISPLAY " Hello COBOL 1b" .
Fixed format without identification division
000120 * We are in fixed format
000130 PROCEDURE DIVISION .
000140 DISPLAY " Hello COBOL 2b" .
Fixed format without any divisions
000120 * We are in fixed format
000140 DISPLAY " Hello COBOL 3b" .
Fixed format with variables
000100 01 username PIC X (30 ) VALUE " Mainframe B" .
…
000200 DISPLAY " Your name is " FUNCTION trim (username).