$ProcLoc

From m204wiki
Revision as of 21:21, 22 November 2011 by DmeWiccan (talk | contribs) (1 revision)
Jump to navigation Jump to search

Locate any of set of strings in procedure

Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for $ProcLoc is Locate, if AppendOpenProcedure 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 Function

$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

$ProcLoc return codes

Products authorizing $ProcLoc