OCCURS CLAUSE - PROGRAM:
We have to write a program to elaborate occurs clause. Get names and marks 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 1.
01 stu-det.
02 stu-rec occurs 10 times.
03 name pic x(20).
03 mark pic 9(3).
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 1 to i.
perform disp-para n times.
stop run.
get-para.
accept name(i).
accept mark(i).
add 1 to i.
disp-para.
display name (i).
display mark (i).
accept key- in.
add 1 to i.