so I am just starting to learn COBOL on Z/OS. I have done quite a bit using visual cobol; however, this is still quite different.
I need to display a table starting at the Index of 1 and displaying until the index is 50
PERFORM VARYING W03-SUBJ-INDX FROM 1 BY 1
UNTIL W03-SUBJ-INDX = 50
DISPLAY W03-SUBJ-TABLE
END-PERFORM
That is what I currently have I also tried
PERFORM VARYING W03-SUBJ-INDX FROM 1 BY 1
UNTIL W03-SUBJ-INDX = 50
DISPLAY W03-SUBJ-TABLE(w03-subj-indx)
END-PERFORM
The top example displays only the first indexed item (To be expected) - The second example gives me an error stating ")" was unexpected.
Any help would be appreciated.. I was told I have to use the index
So regarding your existing code....there was some flakiness in some of the versions of the Enterprise Cobol parsers...
DISPLAY W03-SUBJ-TABLE(w03-subj-indx)
might work as this:
DISPLAY W03-SUBJ-TABLE ( w03-subj-indx )
Some of the versions of the Enterprise Cobol compiler did not parse well without spaces. This was especially important when doing reference modification, but applied to tables as well.
Give it a try, YMMV.