program-id. a03-tvorba-a-cteni-souboru. *> jméno souboru musí být zadáno v CMD-line environment division. input-output section. file-control. select SOUBOR assign JMENO-SB line sequential. data division. file section. fd SOUBOR. 1 RADEK pic x(80). working-storage section. 77 JMENO-SB pic x(20). 77 POCET pic 999. 77 R pic 9. 88 CTENI value 0. 88 KONEC value 1. procedure division. perform PRECTI-C perform ZAPIS-DATA perform PRECTI-DATA stop run. PRECTI-C. accept JMENO-SB from command-line display "----- C = " JMENO-SB . ZAPIS-DATA. open output SOUBOR perform RADKY-DAT close SOUBOR display "----- data:" . PRECTI-DATA. set CTENI to true move 0 to POCET open input SOUBOR perform until KONEC read SOUBOR end set KONEC to true not end add 1 to POCET display POCET " " RADEK end-read end-perform close SOUBOR display "----- KONEC" . RADKY-DAT. write RADEK from "1. řádek" write RADEK from "2. řádek" write RADEK from "..." write RADEK from space write RADEK from "další řádky dle potřeby" .