$ProcLoc: Difference between revisions
m (1 revision) |
mNo edit summary |
||
Line 2: | Line 2: | ||
<span class="pageSubtitle"><section begin="desc" />Locate any of set of strings in procedure<section end="desc" /></span> | <span class="pageSubtitle"><section begin="desc" />Locate any of set of strings in procedure<section end="desc" /></span> | ||
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ProcLoc function is [[ | <p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ProcLoc function is the [[Locate (Stringlist function)]], if the [[AppendOpenProcedure (Stringlist function)]] is used to retrieve the procedure into a stringlist.</p> | ||
The $ProcLoc function accepts five arguments and returns a numeric result. | The $ProcLoc function accepts five arguments and returns a numeric result. | ||
Line 9: | Line 9: | ||
The fifth argument, if set to 'Y', indicates that the case of the data in a procedure line must match the case of the data in the search strings for a string to be considered "matched". If this argument is not set to 'Y', a lower case character would be considered to match the corresponding upper case character and vice versa. | The fifth argument, if set to 'Y', indicates that the case of the data in a procedure line must match the case of the data in the search strings for a string to be considered "matched". If this argument is not set to 'Y', a lower case character would be considered to match the corresponding upper case character and vice versa. | ||
==Syntax== | ==Syntax== | ||
<p class="syntax"><section begin="syntax" /> %RC = $ProcLoc(string1, string2, string3, string4, respect) | <p class="syntax"><section begin="syntax" /> %RC = $ProcLoc(string1, string2, string3, string4, respect) | ||
Line 15: | Line 16: | ||
</p> | </p> | ||
$ProcLoc positions the "current line" in the file so that a subsequent [[$ProcGet]] would return the line containing the matched string or strings. If you wish to continue searching through the current procedure for the next occurrence of a string or strings you must issue a [[$ProcGet]] to advance the current line. If you do not, $ProcLoc will continue to match on the current line. For example, the following code, displays the line number and contents of every line in procedure 'BIGPROC' that contains either the string 'REPEAT' or the string 'ARRAY'. | |||
<p class="code"> %A = $ProcOpn('BIGPROC') | <p class="code"> %A = $ProcOpn('BIGPROC') | ||
%LINE_NUM = 0 | %LINE_NUM = 0 | ||
Line 28: | Line 29: | ||
END REPEAT | END REPEAT | ||
</p> | </p> | ||
==Return codes== | |||
<p class="code"> | <p class="code"> | ||
>0 - The number of lines that were tested before the | >0 - The number of lines that were tested before the | ||
string or strings were located | |||
-1 - Current include level not opened by $ProcOpn | -1 - Current include level not opened by $ProcOpn | ||
-2 - Search string or strings not found | -2 - Search string or strings not found | ||
Line 38: | Line 41: | ||
<p class="caption">$ProcLoc return codes | <p class="caption">$ProcLoc return codes | ||
</p> | </p> | ||
<ul> | <ul> | ||
<li>[[Sirius $Functions]] | |||
<li> | <li>[[Fast/Unload User Language Interface]] | ||
<li>[[Janus Web Server]] | |||
<li> | |||
<li> | |||
</ul> | </ul> | ||
<p class="caption">Products authorizing $ProcLoc | <p class="caption">Products authorizing $ProcLoc | ||
</p> | </p> | ||
[[Category:$Functions|$ProcLoc]] | [[Category:$Functions|$ProcLoc]] |
Revision as of 22:20, 1 February 2011
<section begin="desc" />Locate any of set of strings in procedure<section end="desc" />
Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ProcLoc function is the Locate (Stringlist function), if the AppendOpenProcedure (Stringlist function) is used to retrieve the procedure into a stringlist.
The $ProcLoc function accepts five arguments and returns a numeric result.
The first four arguments identify strings to be located in the currently open procedure. If any of the specified strings is located in a given line of the procedure the search is terminated. At least one search string must be specified. The total length of the first 4 arguments must be 256 or less.
The fifth argument, if set to 'Y', indicates that the case of the data in a procedure line must match the case of the data in the search strings for a string to be considered "matched". If this argument is not set to 'Y', a lower case character would be considered to match the corresponding upper case character and vice versa.
Syntax
<section begin="syntax" /> %RC = $ProcLoc(string1, string2, string3, string4, respect) <section end="syntax" />
$ProcLoc positions the "current line" in the file so that a subsequent $ProcGet would return the line containing the matched string or strings. If you wish to continue searching through the current procedure for the next occurrence of a string or strings you must issue a $ProcGet to advance the current line. If you do not, $ProcLoc will continue to match on the current line. For example, the following code, displays the line number and contents of every line in procedure 'BIGPROC' that contains either the string 'REPEAT' or the string 'ARRAY'.
%A = $ProcOpn('BIGPROC') %LINE_NUM = 0 %A = 1 REPEAT WHILE %A GT 0 %A = $ProcLoc('REPEAT','ARRAY') IF %A GT 0 THEN %LINE_NUM = %LINE_NUM + %A PRINT %LINE_NUM AND $ProcGet END IF END REPEAT
Return codes
>0 - The number of lines that were tested before the string or strings were located -1 - Current include level not opened by $ProcOpn -2 - Search string or strings not found -3 - No search strings were specified -4 - Total length of search strings > 256