TEST( ) function

Returns a logical value indicating whether a specified string occurs at a specific byte position in a record.

Syntax

TEST(byte_position, string)

Parameters

byte_position

Numeric. The sequential number from the left in the table layout that identifies the location of the first character of the string parameter.

string

Character. The character string to search for. You can specify a field, expression, or a quoted string.

Output

Logical. Returns T (true) if the specified text string starts at the specified byte location within a record, and F (false) otherwise.

Remarks

This function identifies whether the value of the string parameter starts at the position specified by byte_position. The function evaluates to false (F) if the start of the string is not identified at the specified position, even if string appears at another position in the line.

The string parameter is case-sensitive. Specifying “DEPT” does not find “Dept”. If there is a chance the case may be mixed, first use the UPPER( ) function to convert all characters to uppercase.

Examples

Given a record containing:

    Department: Marketing
....|....|....|....|....|

The following expression evaluates to T (true):

TEST(5, "Department")

Both of the following expressions evaluate to F (false). The first expression is not a match because the string Department start at the number 5 byte position, not the sixth. The second expression is not a match because the function is case-sensitive.

TEST(6, "Department")

TEST(5, "DEPARTMENT")

To create a filter identifying page headings, specify:

TEST(1, "Page:")

Related reference
UPPER( ) function


(C) 2015 ACL Services Ltd. All Rights Reserved.