When component is not numeric

If the component that is limiting the number of occurrences, such as ORDREV_OUT_NUM_ACCTS in the previous example, is not numeric, then you might need to specify some additional component rule functions.

The following example specifies ORDREV_OUT_NUM_ACCTS as text, not numeric.

05 ORDREV_OUT_NUM_ACCTS PIC X(04). 
05 ORDREV_OUT_ACCOUNT_INFO OCCURS 0 TO 1000 TIMES 
    DEPENDING ON ORDREV_OUT_NUM_ACCTS. 
         
You need to specify a rule that converts the text item to a number as in the following example:

ORDREV_OUT_ACCOUNT_INFO 
RULE: COUNT($) <= 
        TEXTTONUMBER(ORDREV_OUT_NUM_ACCTS Field)