identification division.
program-id. testing.
data
division.
working-storage section.
01 A.
05
num-people pic 9 value 3.
05 B
occurs 5 times.
10 C
occurs 3 times.
15 Z pic 9 value 0.
15 Y pic 9 value 0.
01 D pic 9.
01 E pic 9.
procedure
division.
paragraph-one.
perform
varying D from 1 by 1 until D > 5
perform varying E from 1 by 1 until e > 3
display 'z(' d ','
e ')= ' z (d,e)
end-perform
end-perform.
display
"c (1,1)" c (1,1).
display
"B(1-5) = " B(1),' ' B(2),' ' B(3) ' ' b(4) ' ' b(5).
display
"A = " A.
* OUTPUT
* z(d,e) always = 0
* c(1,1) = 00
* B(1-5) = 000000 000000 000000 000000 000000
* A = 3000000000000000000000000000000
* ERRORS
* display "B (1,1) ",
B (1,1). *** too many subscripts
* display
"A (?) ", A (1). *** same as below
* display
"A(?,?) ", A (1,1). *** ':' expected, Numeric literal found
* display
"C(1-3) ", C(1), C(2), C(3).
*** more subscripts needed
* display
"C = ", C. *** subscript
required
* display
"B = " B. *** subscript
required
accept
omitted.
stop
run.