ARRAY BOUNDARY CHECK AND USE OF STRUCTURES
I noticed the recent post on ARRAY BOUNDARY CHECKER in the WINDOWS section.
I have found this switch useful in the past as having this set can detect a lot of unforeseen compile and mostly run-time errors.
However there is one system with this switched I encounter the following array boundary error, when it is not.
I have a structure defined as follows:
RECORD /SCHED_HEADINGS/ CREC
STRUCTURE /SCHED_HEADINGS/
CHARACTER*74 TS_HEAD
RECORD /DS_HEAD/ DUTYSCHED(4)
END STRUCTURE
STRUCTURE /DS_HEAD/
CHARACTER *2 GARCODE
CHARACTER *14 GARNAME
END STRUCTURE
When I run the suite of programs, one sub-routine errors with the following message:
Subscript 10214400 is out of range for dimension 1 for array ? DUTYSCHED with bounds 1:4
or
Subscript < space> is out of range for dimension 1 for array ? DUTYSCHED with bounds 1:4
The offending line of code is
WRITE (PTRP_LUN) CREC
Values to DUTYSHED(n) are created prior as
CREC.DUTYSCHED(I).GARCODE = GARCODE etc (where I = 1,4)
Without the array boundary error switch on this code has worked for about ten years without issue. Is there a workaround please?