


"prog2.cbl"
identification division.
program-id. prog2.
environment division.
input-output section.
file-control.
select customer-file
assign to "custfile"
organization is line sequential
file status is customer-status.
data division.
file section.
fd customer-file.
01 customer-record.
05 customer-id pic 9(3).
05 customer-name pic x(20).
05 customer-age pic xx.
working-storage section.
01 customer-status pic xx.
88 eof-customer-file value "10".
linkage section.
01 customer-info.
05 requested-age.
10 low-age pic x(2).
10 high-age pic x(2).
05 age-group-count pic 9(3).
procedure division using customer-info.
main-logic.
perform count-customers.
goback.
count-customers.
move zero to age-group-count.
open input customer-file.
perform until eof-customer-file
read customer-file next record
at end
continue
not at end
if customer-age >= low-age and
customer-age <= high-age
add 1 to age-group-count
end-if
end-read
end-perform.
close customer-file.