$ChkPat: Difference between revisions

From m204wiki
Jump to navigation Jump to search
No edit summary
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<p>The $ChkPat function verifies the syntax of a pattern. If the pattern is valid, a null string is returned; otherwise, an error message string is returned.</p>
<p>
<b>Syntax</b>
The <var>$ChkPat</var> function verifies the syntax of a pattern. If the pattern is valid, a null string is returned; otherwise, an error message string is returned.</p>
<p class="code">$ChkPat(<var class="term">pattern</var>[,<var class="term">language</var>])
 
==Syntax==
<p class="syntax">$ChkPat(<span class="term">pattern</span>[,<span class="term">language</span>])
</p>
</p>
<p>Where:</p>
<p>
<p><var>The required pattern</var> argument is the string of characters to verify, which can be a literal enclosed in quotation marks or a %variable.</p>
Where:</p>
<p><var>The optional language</var> argument specifies the language to use. The language argument is handled as follows:</p>
<ul>
<li>The required <var class="term">pattern</var> argument is the string of characters to verify, which can be a literal enclosed in quotation marks or a %variable.
<!-- This is not really required and probably we should change the doc to say that it defaults to the null string, which is a valid pattern. That example is used in QASHR tests SOUL.DME.263.QAR: -->
<p>See the [[Like clause|description of SOUL patterns]].</p></li>
 
<li>The optional <var class="term">language</var> argument specifies the language to use. The language argument is handled as follows:
<ul>
<ul>
<li>When <var class="term">language</var> is omitted, <var class="product">Model&nbsp;204</var> performs the validation in U.S. English, even if the value of the LANGUSER parameter is not US, and lowercase characters are not recognized.</li>
<li>If <var class="term">language</var> is omitted, <var class="product">Model&nbsp;204</var> performs the validation in U.S. English (even if the value of the <var>LANGUSER</var> parameter is not US) and lowercase characters are not recognized.</li>
</li>
 
<li>An asterisk enclosed in quotation marks (<tt>'*'</tt>) instructs <var class="product">Model&nbsp;204</var> to use the value of the LANGUSER parameter.</li>
<li>An asterisk enclosed in quotation marks (<tt>'*'</tt>) instructs <var class="product">Model&nbsp;204</var> to use the value of the <var>LANGUSER</var> parameter.</li>
</li>
 
<li>You can enter the name of a valid language enclosed in quotation marks or a %variable containing a valid language. If the value you enter is not supported, the request is canceled with an error message. See The LANGUSER parameter in the Rocket <var class="product">Model&nbsp;204</var> Parameter and Command Reference Manual for the valid values.</li>
<li>You can enter the name of a valid language enclosed in quotation marks or a %variable containing a valid language. If the value you enter is not supported, the request is canceled with an error message. See the <var>[[LANGUSER parameter|LANGUSER]]</var> parameter for the valid values.</li>
</li>
</ul></li>
</ul>
</ul>
<p>Without $ChkPat, pattern syntax errors can cause cancellation of the request or require the coding of complex ON units.</p>
<p>
<b>Examples</b>
Without <var>$ChkPat</var>, pattern syntax errors can cause cancellation of the request or require the coding of complex <var>ON</var> units.</p>
<p>For U.S. English:</p>
 
==Examples==
<p>
For U.S. English:</p>
<!-- The following example is used in QASHR tests SOUL.DME.263.QAR: -->
<p class="code">%PAT='ABC*'
<p class="code">%PAT='ABC*'


Line 25: Line 36:
END IF
END IF
</p>
</p>
<p>For French Canadian:</p>
<p>
For French Canadian:</p>
<p class="code">%PAT='p&#234;ch&#233;'
<p class="code">%PAT='p&#234;ch&#233;'


Line 34: Line 46:
END IF
END IF
</p>
</p>
<b>Usage notes</b>
 
<p>$ChkPat supports language-sensitive specification of patterns through an optional second parameter (such as [[$ALPHA#$ALPHA|$Alpha]] and [[$ALPHNUM#$ALPHNUM|$ALPHNUM]]).</p>
==Usage notes==
<p>All characters X'00' through X'FF' are valid in a pattern presented to the User Language pattern matcher. The $ChkPat function no longer invokes either of the following messages when it encounters these characters.</p>
<p>
<var>$ChkPat</var> supports language-sensitive specification of patterns through an optional second parameter (such as <var>[[$Alpha]]</var> and <var>[[$AlphNum]]</var>).</p>
<p>
All characters X'00' through X'FF' are valid in a pattern presented to the SOUL pattern matcher. The <var>$ChkPat</var> function no longer invokes either of the following messages when it encounters these characters.</p>
<p class="code">M204.1688: errortype IN PATTERN 'pattern' AT CHARACTER char
<p class="code">M204.1688: errortype IN PATTERN 'pattern' AT CHARACTER char


M204.1689: errortype IN PATTERN 'pattern' AT CHARACTER char
M204.1689: errortype IN PATTERN 'pattern' AT CHARACTER char
</p>
</p>
[[Category:SOUL $functions]]
[[Category:SOUL $functions]]

Latest revision as of 18:53, 23 January 2018

The $ChkPat function verifies the syntax of a pattern. If the pattern is valid, a null string is returned; otherwise, an error message string is returned.

Syntax

$ChkPat(pattern[,language])

Where:

  • The required pattern argument is the string of characters to verify, which can be a literal enclosed in quotation marks or a %variable.

    See the description of SOUL patterns.

  • The optional language argument specifies the language to use. The language argument is handled as follows:
    • If language is omitted, 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.
    • You can enter the name of a valid language enclosed in quotation marks or a %variable containing a valid language. If the value you enter is not supported, the request is canceled with an error message. See the LANGUSER parameter for the valid values.

Without $ChkPat, pattern syntax errors can cause cancellation of the request or require the coding of complex ON units.

Examples

For U.S. English:

%PAT='ABC*' %X=$chkpat(%PAT) IF %X NE '' THEN PRINT %X JUMP TO ERROR.RETURN END IF

For French Canadian:

%PAT='pêché' %X=$chkpat(%PAT,'FRENCHC') IF %X NE '' THEN PRINT %X JUMP TO ERROR.RETURN END IF

Usage notes

$ChkPat supports language-sensitive specification of patterns through an optional second parameter (such as $Alpha and $AlphNum).

All characters X'00' through X'FF' are valid in a pattern presented to the SOUL pattern matcher. The $ChkPat function no longer invokes either of the following messages when it encounters these characters.

M204.1688: errortype IN PATTERN 'pattern' AT CHARACTER char M204.1689: errortype IN PATTERN 'pattern' AT CHARACTER char