Wordindex, Wordlength, Wordpos (word position) – IBM SC34-5764-01 User Manual

Page 220: Words, Xrange (hexadecimal range), Wordindex wordlength

Advertising
background image

WORDINDEX

WORDINDEX(string,n)

returns the position of the first character in the nth blank-delimited word in string or returns 0 if fewer than
n words are in string. The n must be a positive whole number.

Here are some examples:

WORDINDEX('Now is the time',3)

->

8

WORDINDEX('Now is the time',6)

->

0

WORDLENGTH

WORDLENGTH(string,n)

returns the length of the nth blank-delimited word in string or returns 0 if fewer than n words are in string.
The n must be a positive whole number.

Here are some examples:

WORDLENGTH('Now is the time',2)

->

2

WORDLENGTH('Now comes the time',2)

->

5

WORDLENGTH('Now is the time',6)

->

0

WORDPOS (Word Position)

WORDPOS(phrase,string

,start

)

returns the word number of the first word of phrase found in string or returns 0 if phrase contains no words
or if phrase is not found. Multiple blanks between words in either phrase or string are treated as a single
blank for the comparison, but otherwise the words must match exactly.

By default the search starts at the first word in string. You can override this by specifying start (which must
be positive), the word at which to start the search.

Here are some examples:

WORDPOS('the','now is the time')

->

3

WORDPOS('The','now is the time')

->

0

WORDPOS('is the','now is the time')

->

2

WORDPOS('is

the','now is the time')

->

2

WORDPOS('is

time ','now is

the time')

->

0

WORDPOS('be','To be or not to be')

->

2

WORDPOS('be','To be or not to be',3)

->

6

WORDS

WORDS(string)

returns the number of blank-delimited words in string.

Here are some examples:

WORDS('Now is the time')

->

4

WORDS(' ')

->

0

XRANGE (Hexadecimal Range)

XRANGE(

start

,end

)

returns a string of all valid 1-byte encodings (in ascending order) between and including the values start

Functions

198

CICS TS for VSE/ESA: REXX Guide

Advertising