Bill, I think you've hit on one "advantage". The reason I didn't think of it is I had not understood how SSRANGE worked in conjunction with variable-length tables. It looks like the current occurrence is checked against the "maximum bounds" field, but never against the actual OCCURS DEPENDING ON object. For example, the the following "table" definition:
05 X PIC X OCCURS 1 TO 10 DEPENDING ON X-CNT INDEXED BY XIDX.
If you do a MOVE X(11) TO ... you will get an "IGZ0006S" condition, where "IGZ0006S The reference to table table-name by verb number verb-number on line line-number addressed an area outside the region of the table." It does not matter that field X-CNT may have a value of more than 10. While surprising to me, this agrees with the full description of IGZ0006S which says:
IGZ0006S The reference to table table-name by verb number verb-number on line
line-number addressed an area outside the region of the table.
Explanation: When the SSRANGE option is in effect, this message is issued to
indicate that a fixed-length table has been subscripted in a way that exceeds
the defined size of the table, or, for variable-length tables, the maximum
size of the table.
The range check was performed on the composite of the subscripts and resulted
in an address outside the region of the table. For variable-length tables, the
address is outside the region of the table defined when all OCCURS DEPENDING
ON objects are at their maximum values; the ODO object's current value is not
considered. The check was not performed on individual subscripts.
Programmer response: Ensure that the value of literal subscripts and/or the
value of variable subscripts as evaluated at run-time do not exceed the
subscripted dimensions for subscripted data in the failing statement.
It also agrees with the Customization Guide where SSRANGE is described thusly:
"Generates code that checks subscripts, reference modifications, variable-length group ranges, and indexes at run time to ensure that they do not refer to storage outside the area assigned. It also verifies that a table with ALL subscripting, specified as a function argument, contains at least one occurrence in the table.
The generated code also checks that variable-length items do not exceed their defined maximum length as a result of incorrect setting of the OCCURS DEPENDING ON object. For unbounded groups or their subordinate items, checking is done only for reference modification expressions. Subscripted or indexed references to tables subordinate to an unbounded group are not checked."
In other words, the "maximum size" of the table defined above is 10, even though X-CNT could be, well, pretty much anything.
Conversely, if (for example) the above had been defined such that the value of 100 was the "maximum size", but X-CNT was set to a value of let's say 50, COBOL SSRANGE would let you freely refer to elements 51 -100.
As I said, this was a surprise to me because I assumed that SSRANGE would check the "ODO object" and perhaps not even care about the "maximum size". After all, for a LINKAGE SECTION item anyway the program doesn't really own the data anyway, so it seems to me it might be reasonable for SSRANGE to check the ODO object and not even really care about the "declared maximum".
But since it does work the way it works, and I have no intention of requesting it work differently, I guess that UNBOUNDED has the advantage that even if SSRANGE is turned on no range checking is done for unbounded data items.
Still, if there are any other differences anyone knows of (IBM COBOL development?) I'd be curious to learn about them.
Frank
fswarbrick