$Alpha: Difference between revisions
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
<b>Syntax</b> | <b>Syntax</b> | ||
<p>The format of the $Alpha function is:</p> | <p>The format of the $Alpha function is:</p> | ||
<p class="code">$ | <p class="code">$Alpha(string <var>[</var>,language<var>]</var>) | ||
</p> | </p> | ||
<p>where:</p> | <p>where:</p> | ||
Line 35: | Line 35: | ||
<tr> | <tr> | ||
<td> | <td> | ||
<p class="code"><var>$ | <p class="code"><var>$alpha('JOHN','US')</var> | ||
</p></td> | </p></td> | ||
<td align="right"><var>1</var></td> | <td align="right"><var>1</var></td> | ||
Line 41: | Line 41: | ||
<tr> | <tr> | ||
<td> | <td> | ||
<p class="code"><var>$ | <p class="code"><var>$alpha('M�CON','FRENCHC')</var> | ||
</p></td> | </p></td> | ||
<td align="right"><var>1</var></td> | <td align="right"><var>1</var></td> | ||
Line 47: | Line 47: | ||
<tr> | <tr> | ||
<td> | <td> | ||
<p class="code">$ | <p class="code">$alpha('<var>M�CON','US')</var> | ||
</p></td> | </p></td> | ||
<td align="right">0</td> | <td align="right">0</td> | ||
Line 53: | Line 53: | ||
<tr> | <tr> | ||
<td> | <td> | ||
<p class="code"><var>$ | <p class="code"><var>$alpha('JOHN SMITH','US')</var> | ||
</p></td> | </p></td> | ||
<td align="right"><var>0</var></td> | <td align="right"><var>0</var></td> | ||
Line 59: | Line 59: | ||
<tr> | <tr> | ||
<td> | <td> | ||
<p class="code"><var>$ | <p class="code"><var>$alpha('�LE D'ORL�ANS','FRENCHC')</var> | ||
</p></td> | </p></td> | ||
<td align="right"><var>0</var></td> | <td align="right"><var>0</var></td> | ||
Line 65: | Line 65: | ||
<tr> | <tr> | ||
<td> | <td> | ||
<p class="code"><var>$ | <p class="code"><var>$alpha('12A','US')</var> | ||
</p></td> | </p></td> | ||
<td align="right"><var>0</var></td> | <td align="right"><var>0</var></td> | ||
Line 71: | Line 71: | ||
<tr> | <tr> | ||
<td> | <td> | ||
<p class="code"><var>$ | <p class="code"><var>$alpha('12A','FRENCHC')</var> | ||
</p></td> | </p></td> | ||
<td align="right"><var>0</var></td> | <td align="right"><var>0</var></td> | ||
</tr> | </tr> | ||
</table> | </table> | ||
<p>The following request sorts and prints the names of agents whose name contains non alphabetic characters. The quoted asterisk in the $ | <p>The following request sorts and prints the names of agents whose name contains non alphabetic characters. The quoted asterisk in the $Alpha call causes <var class="product">Model 204</var> to verify the contents of the field AGENT against whatever language is indicated by the value of the LANGUSER parameter:</p> | ||
<p class="code">BEGIN | <p class="code">BEGIN | ||
POL.HOLDERS: FIND ALL RECORDS FOR WHICH | POL.HOLDERS: FIND ALL RECORDS FOR WHICH | ||
Line 82: | Line 82: | ||
END FIND | END FIND | ||
FOR EACH RECORD IN POL.HOLDERS | FOR EACH RECORD IN POL.HOLDERS | ||
IF NOT $ | IF NOT $alpha (AGENT, '*') THEN | ||
PLACE RECORD ON LIST BADNAME | PLACE RECORD ON LIST BADNAME | ||
END IF | END IF | ||
Line 92: | Line 92: | ||
END | END | ||
</p> | </p> | ||
<p class="note"><b>Note:</b> For upward compatibility reasons, $ | <p class="note"><b>Note:</b> For upward compatibility reasons, $Alpha and $Alphnum do not recognize lowercase English letters as alphabetic characters unless a non-null language parameter is specified.</p> | ||
[[Category:SOUL $functions]] | [[Category:SOUL $functions]] |
Revision as of 14:21, 17 June 2014
The $Alpha function verifies whether a string is composed only of characters which are valid in the specified (or default) language. A 1 is returned if the condition is true; otherwise, a 0 is returned (for a false condition). A 0 is returned if there are any spaces or punctuation marks in the string, or if the string is null.
Syntax
The format of the $Alpha function is:
$Alpha(string [,language])
where:
- string represents the string to be verified. string must be one of:
A literal enclosed in quotation marks
- %variable.
- A field name without quotation marks. In this case, the function call must be embedded in a FOR EACH RECORD loop where the current value of the field is verified.
The optional language argument specifies the language to use. The language argument is handled as follows:
- You can enter a literal enclosed in quotation marks or a % variable containing a valid language name. If the value you enter is not a supported language, the request is canceled with the following error message. See The LANGUSER parameter in the Rocket Model 204 Parameter and Command Reference Manual for the valid values.
- When you omit the language argument, Model 204 performs the validation in U.S. English, even if the value of the LANGUSER parameter is not US, and lowercase characters are not recognized.
- An asterisk enclosed in quotation marks ('*') instructs Model 204 to use the value of the LANGUSER parameter.
M204.2340: INVALID LANGUAGE ARGUMENT: 'language' FOR $FUNCTION: ALPHA
Examples
The following table has examples of the pattern and language arguments as literals:
Function code... | Returns... |
---|---|
$alpha('JOHN','US') |
1 |
$alpha('M�CON','FRENCHC') |
1 |
$alpha('M�CON','US') |
0 |
$alpha('JOHN SMITH','US') |
0 |
$alpha('�LE D'ORL�ANS','FRENCHC') |
0 |
$alpha('12A','US') |
0 |
$alpha('12A','FRENCHC') |
0 |
The following request sorts and prints the names of agents whose name contains non alphabetic characters. The quoted asterisk in the $Alpha call causes Model 204 to verify the contents of the field AGENT against whatever language is indicated by the value of the LANGUSER parameter:
BEGIN POL.HOLDERS: FIND ALL RECORDS FOR WHICH RECTYPE = POLICYHOLDER END FIND FOR EACH RECORD IN POL.HOLDERS IF NOT $alpha (AGENT, '*') THEN PLACE RECORD ON LIST BADNAME END IF END FOR ORDERED.LIST: SORT RECORDS ON LIST BADNAME BY AGENT FOR EACH RECORD IN ORDERED.LIST PRINT AGENT END FOR END
Note: For upward compatibility reasons, $Alpha and $Alphnum do not recognize lowercase English letters as alphabetic characters unless a non-null language parameter is specified.