Hello there fellow COBOLics,
we found something, that looks like a defect in the COBOL 6.3 Compiler. We have a variable length table that is defined like
01 TEMP-OUT.
03 ODO-Object PIC S9(4) BINARY.
03 ODO-Subject OCCURS 0 TO 42 DEPENDING ON ODO-Object.
05 Tabular-Data-1 PIC X(69).
05 Tabular-Data-2 PIC X(69).
05 Tabular-Data-n PIC X(69).
and then the SORT looks like:
SORT ODO-Object
ASCENDING Tabular-Data-1
Tabular-Data-2
Now, whenever ODO-Object contains ZERO, Message IGZ0279W is issued for each data-name given in the SORT Statement as a result of the NUMCHECK option. Since sorting an empty table is a rather trivial task, we would not expect those fields to be touched at all.
Language Reference in regard to SORT states pretty clearly: "The number of occurrences of table elements that are referenced by data-name-2 is determined by the rules in the OCCURS clause." And the Programming Guide in regard to ODO states "The length of the variable portions of a group item is the product of the object of the DEPENDING
ON phrase and the length of the subject of the OCCURS clause."
Can someone confirm this behaviour. Is there a reason for this behaviour or is it really a defect?
Kind regards,
Christoph
------------------------------
Christoph
------------------------------