IDENTIFICATION DIVISION. PROGRAM-ID. Count-records. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. VAX-11. OBJECT-COMPUTER. VAX-11. INPUT-OUTPUT SECTION. FILE-CONTROL. select input-file assign to "[]noname." access is sequential . DATA DIVISION. FILE SECTION. fd input-file value of id is input-file-spec . 01 input-record. 02 filler pic x(2048). WORKING-STORAGE SECTION. 01 program-constants. 02 ws-true picture x(01) value "T". 02 ws-false picture x(01) value "F". 01 program-switches. 02 abort-sw picture x(01) value "F". 88 abort value "T". 02 end-of-file-sw picture x(01). 88 end-of-file value "T". 01 program-variables. 02 display-record-count pic zzz,zzz,zz9. 02 display-record-size pic s9(9) comp value 11. 02 input-file-spec pic x(255). 02 input-file-spec-length pic s9(9) comp. 02 record-count pic s9(9) comp value zero. 02 result-record-size pic s9(9) comp. PROCEDURE DIVISION. 0-count-records. call "lib$get_foreign" using by descriptor input-file-spec by value zero by reference input-file-spec-length by value zero if input-file-spec-length = zero then display "File to count: " with no advancing accept input-file-spec at end move ws-true to abort-sw end-accept end-if if not abort then open input input-file read input-file at end move ws-true to end-of-file-sw end-read perform varying record-count from zero by 1 until end-of-file read input-file at end move ws-true to end-of-file-sw end-read end-perform move record-count to display-record-count call "ci$compress_spaces" using by reference display-record-count by reference display-record-size by reference result-record-size display display-record-count ( 1 : result-record-size ) " records." bell close input-file else display "Program aborting." end-if stop run .