From m204wiki
Jump to navigation Jump to search

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.


The $Occurs result in the following statement is 1 if the definition of the AGENT field contains OCCURS 1:

%n = $occurs('AGENT')