Previous Topic: Control &NDBSCAN Resource Usage

Next Topic: Reserved Words

Scan Expressions

A scan request contains a free form text scan expression. This expression contains:

Parentheses can be used to group parts of the expression.

The expression can be spread across several NCL statements, using the START/DATA/END syntax, as per the &NDBADD, &NDBUPD, and &NDBFMT statements. This syntax also allows construction of the scan expression. This is especially useful in table-driven systems, for example, the features table.

The expression consists of a number of scan-tests, connected by AND, OR, NOT, and parentheses. Each test can:

The following are examples of valid scan expressions:

SURNAME = SMITH AND DOB LT 600101
DESC* CONTAINS MVS
DATECLOSED ABSENT OR DATECLOSED  DATEOPEN PLUS 5
NAME LIKE 'J% SMITH%'
SEX = 'F' AND (STATUS = 'SINGLE' | STATUS = 'DIVORCED')
SEX = 'F' AND STATUS = ANY 'SINGLE', 'DIVORCED'

The last two expressions are equivalent. The parentheses are required in the first of these to bind the OR (|) tests together, as AND takes precedence over OR.