Ram T, are you aware that in COBOL arrays always start with element 1? Unlike C, for example, it is not possible for COBOL to use element zero of an array. If you do so, you will use memory that is not part of the array, potentially generating abends. If you check the COBOL Language Reference
manual, you will find that subscripts are required
to be a positive integer -- which means zero is not a valid subscript. Does COBOL check this? Only if the program was compiled with subscript range checking and the CHECK(ON) run time option is specified.
ramtolasi, since you're not willing to listen to experience, I ran your code exactly as you provided it:
77 A1 PIC X(10) VALUE "0123456789".
77 I PIC 99 VALUE 0.
02 C1 OCCURS 10 TIMES
MOVE A1 TO B1.
and got results of
IGYPS2120-S Expected a reference-modification specification but found ")". The
"DISPLAY" statement was discarded.
so the answer to your question, as I implied in my earlier post, is "C" -- syntax error. B1 is not an array and cannot be subscripted in this manner. If you had DISPLAY C1 (5) then a 4 would have been displayed. But as you gave the code, the answer is "C".