OCCURS CLAUSE - PROGRAM:
We have to write a program to demonstrate the occurs clause. Get names of the students and show them on the screen.
identification division.
program- id.
environment division.
data division.
working-storage section.
01 n pic 9(2) value 0.
01 i pic 9(2) value 0.
01 name-in.
02 name pic x(20) occurs 20 times.
01 key- in pic x value space.
procedure division.
p-1.
display(1 1) erase.
display(3 5) "Enter How many times".
accept n.
display(1 1) erase.
perform get-para n times.
display(1 1) erase.
move 0 to i.
perform disp-para n times.
stop run.
get-para.
accept name(i).
add 1 to i.
disp-para.
display name(i).
accept key- in.
add 1 to i.