I am facing an issue while trying to load data to a indexed table.
Table
-----------------------------------
01 WS-ATTR-ARRAY.
10 WS-ATTRIBUTES OCCURS 40 TIMES
INDEXED BY ATRINDEX.
15 WS-ATTR-CD PIC X(01) VALUE SPACES.
01 WS-ARR-MAX-SIZE PIC 9(02)
Code which loads the table
------------------------------------
SET ATRINDEX TO 1
PERFORM A100-POPULATE-ATTR-ARRAY
UNTIL ATRINDEX > WS-ARR-MAX-SIZE
OR END-OF-ATTR-YES
-------------------------------------------
Control is not going to 'A100-POPULATE-ATTR-ARRAY'. But if hard code 40 instead of WS-ARR-MAX-SIZE, the code is working fine. I tried by giving PIC clause 'PIC S9(4) COMP' for WS-ARR-MAX-SIZE. But it did not work. Can anyone here please suggest way to remove the hard coding of 40.