Seznam článků

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

program-id. READ-STDIN.
environment division.
input-output section.
file-control.
    select FIL assign "LS-FILE" line sequential.
data division.
file section.
fd  FIL.
1   REC-F pic x(80).
working-storage section.
77  NUM-S pic 999.
77  REC-S pic x(80).
 88  INP-S value space.
 88  END-S value "*end".
procedure division.
    initialize NUM-S REC-S.
    open output FIL
    perform until END-S
        accept REC-S
        if not END-S
            write REC-F from REC-S 
            add 1 to NUM-S
        end-if end-perform
    close FIL
*>    display "NUM-S=" NUM-S
    exit program.
end program READ-STDIN.