ComputeODO

The ComputeODO internal function computes an occurrence count from the record length, the record offset of the (single) argument, and the length and span of the argument. The argument must be a repeating data item at the end of the record.

The function accepts one argument. The argument is a repeating data item. This function exists for the situation in which the repeating item is declared to have a fixed number of occurrences, but it really has a variable number of occurrences. The function computes the occurrence count from the record length. The only place it should be used is in conjunction with the ODO button in the Designer.

For example:

FD  VARIABLE-FILE  RECORD IS VARYING IN SIZE FROM 22 TO 40
                   CHARACTERS DEPENDING ON VARIABLE-LENGTH.
01  VARIABLE-RECORD.
    03  SOME-MISC-STUFF           PIC X(20).
    03  A-REPEATING-ITEM          OCCURS 10 TIMES.
        05  ANOTHER-ONE           PIC X.
        05  AND-ONE-MORE          PIC 9.

In this example, the record contains one to ten occurrences of A-REPEATING-ITEM, but the item is declared as a fixed number of occurrences. The ComputeODO function would take A-REPEATING-ITEM as its argument and compute the occurrences from the record length. For example, if a particular record were 28 bytes long, the value of the function would be four (4).

ComputeODO(Data-Item)
Argument Description
Data-Item A repeating data item at the end of the record.