$Occurs: Difference between revisions
Jump to navigation
Jump to search
m (misc formatting) |
|||
Line 1: | Line 1: | ||
<p>The $ | <p> | ||
The <var>$Occurs</var> function interprets a character string argument as a field name in the following manner: </p> | |||
<ul> | <ul> | ||
<li>In file context, $ | <li>In file context, <var>$Occurs</var> returns 0 if the field description in the current file containing the specified field does not include the <var>OCCURS</var> field attribute. <var>$Occurs</var> returns a number representing the number of specified occurrences if the field has <var>OCCURS</var> in its description. </li> | ||
<li>In group context, $ | <li>In group context, <var>$Occurs</var> returns 0 only when the field is described without an <var>OCCURS</var> attribute in every file making up the group. Otherwise, the function returns the minimum <var>OCCURS</var> specification included in all of the files. </li> | ||
<li>If the field specified as the $ | <li>If the field specified as the <var>$Occurs</var> argument is not defined in the current file or group, <var>$Occurs</var> returns a value of -1. </li> | ||
</li> | |||
</ul> | </ul> | ||
< | |||
< | ==Example== | ||
<p> | |||
The <var>$Occurs</var> result in the following statement is 1 if the definition of the <code>AGENT</code> field contains <code>OCCURS 1</code>: | |||
</p> | </p> | ||
<p> | <p class="code">%n = $occurs('AGENT') | ||
</p> | |||
[[Category:SOUL $functions]] | [[Category:SOUL $functions]] |
Latest revision as of 00:10, 22 June 2018
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
The $Occurs result in the following statement is 1 if the definition of the AGENT
field contains OCCURS 1
:
%n = $occurs('AGENT')