Previous Topic: &SECCALL UPDATE

Next Topic: &SETBLNK


&SELSTR

Returns the data preceding a specified character in a supplied string.

&SELSTR (c) text

&SELSTR is a built-in function and must be used to the right of an assignment statement.

To scan the specified data looking for the nominated selection character and return the data up to the specified selection character.

&SELSTR is used to split a variable at a nominated point.

&SELSTR is used in conjunction with &REMSTR to split and manipulate strings of data.

Operands:

(c)

The selection character. The scan will be terminated at the first occurrence of the character c. If this character is not found the entire string will be assigned to the target variable. If the selection character is the first character found, a null value will be assigned to the target variable.

If the selection character is a blank then a space should be specified.

text

The data to be scanned for the occurrence of the character c.

Examples: &SELSTR

&A = &SELSTR ( ) &1      -* select data up to first blank
&HOUR = &SELSTR (.) &TIME

Notes:

&SELSTR is ideal for use with data returned from full-screen panels where it is necessary to internally manipulate the data for further processing.

&REMSTR acts as the converse to &SELSTR. &SELSTR assigns the data up to the specified character, while &REMSTR assigns the data following the specified character.

&PARSE may also be used for dissecting strings.

If &CONTROL DBCS or DBCSN or DBCSP is in effect, &SELSTR is sensitive to the presence of DBCS data.

More information:

&PARSE

&REMSTR

&SUBSTR