$Occurs
The $OCCURS function interprets a character string argument as a field name in the following manner:
- In file context, $OCCURS returns 0 if the field description in the current file containing the specified field does not include the OCCURS field attribute. $OCCURS returns a number representing the number of specified occurrences if the field has OCCURS in its description.
- In group context, $OCCURS returns 0 only when the field is described without an OCCURS attribute in every file making up the group. Otherwise, the function returns the minimum OCCURS specification included in all of the files.
- If the field specified as the $OCCURS argument is not defined in the current file or group, $OCCURS returns a value of -1.
Example
$OCCURS ('AGENT')
equals 1 if the description of AGENT contains OCCURS 1.