Purpose
Returns the starting position of a specified string within a string value.
If the specified string is not found, a zero is returned.
Syntax
►►─┬─ STRING-INDEX ─┬─ ( string, search-string ) ─────────────────────────────►◄ ├─ INDEX ────────┤ └─ INDX ─────────┘
Parameters
Specifies the string that is searched.
String can be:
Specifies the string that the index function searches for within string.
Search-string can be:
Search-string cannot be longer than string.
Example
In the following example, the index function is used to test whether a product code contains the string 'ABC':
Initial value:
PROD-CODE: '12AB43 ABC3254'
Statements:
IF INDX(PROD-CODE,'ABC') EQ 0
THEN
DISPLAY TEXT 'INVALID PRODUCT CODE'.
Returned value from function: 8
Since the string 'ABC' appears in the product code (starting at character position 8), the condition is false.
|
Copyright © 2014 CA.
All rights reserved.
|
|