String Searching

Instead of using relational operators and constants, specify alphanumeric character strings as part of a selection expression in an INFO/ACCESS query. The data for the specified attribute must then contain the character string if an item is to be included in the report.

For example, this query displays the last and first names of customers whose last names begin with the letter J:

>LIST CUSTOMERS WITH LAST-NAME = "J]" LAST-NAME FIRST-NAME

 

 

 

PAGE   1

10:56:35  DD MMM YYYY

 

 

 

CUSTOMERS...

Last Name...

First Name

 

 

 

HJENK7129

JENKINS

HAROLD

AJOHN5396

JOHNSON

ANNE

HJOHN7265

JOHNSON

HENRY

 

 

 

3 ITEMS LISTED.

 

 

 

 

 

>

 

 

Specifying the End of a String ([)

Use a left bracket ([) preceding a character string to specify that the data must end with the specified string. For example:

WITH LAST-NAME "[ER"

This selection expression specifies that a customer’s last name must end with the string ER.

Specifying the Beginning of a String (])

Use a right bracket (]) following a character string to specify that the data must begin with the specified string. In the example:

WITH LAST-NAME "BERG]"

This selection expression specifies that a customer’s last name must begin with the string BERG.

Specifying a Contained String ([ ])

Use both a left and a right bracket ([ ]) surrounding a character string to specify that the data must contain the specified string (at the beginning, middle, or end). In the example:

WITH LAST-NAME "[SON]"

This selection expression specifies that a customer’s last name must contain the string SON.

Specifying Wild Characters (^)

Use a caret (^) as a wild character. Any character in that position is ignored. This is an example:

WITH LAST-NAME "S^^N]"

The preceding selection expression specifies that a customer’s last name must begin with a four-letter string, consisting of the letter S, followed by any two characters, followed by the letter N (e.g., STAN, SHIN, SCAN).

In all cases, enclose the entire string specification in double quotes.

See Also

Using Selection Expressions

Using Relational Operators

Using the LIKE Connective

Using Logical Connectives

Selection Options