1960

JDoodle - Online COBOL Compiler IDE ...
(Ctrl+C, open link in new panel, Ctrl+V, Submit)

identification division.
program-id. TYPEWRITER.   *> from STDIN to screen directly
    *> with GO statements - NON Interactive mode ***

data division.
working-storage section.
1   TW-MEMORY.
 2   INP-LINE pic x(80) occurs 5.
77  I pic 9 value 1.

procedure division.
MAIN-PROC.
    move space to TW-MEMORY
    perform INP-PROC thru WORK-PROC.
END-PROC.
    display "   the work is finished ***"  
    stop run. 
   
INP-PROC.
    if I > 5
        display "   limit 5 exceeded"   
        go END-PROC.
WORK-PROC.
    accept INP-LINE(I)
    if INP-LINE(I) = "e" 
        go END-PROC
    else 
        display I ". " INP-LINE(I)
        add 1 to I
        go INP-PROC.

I = STDIN:

aaaaaaa
bbbbbbb
ccccccc
e

O = screen:

1. aaaaaaa                                                                         
2. bbbbbb                                                                          
3. ccccccc                                                                         
   work is terminated ***