Previous Topic: SELECT Control StatementNext Topic: SORT Control Statement


SET Control Statement

The SET control statement sets a define field to a specific value.

Syntax

SET field=expression-1

where expression-1 specifies an expression that determines the data or value to place in the defined field.

Example

To set field ZIPCODE to positions 1–10 of address line 4, enter the following:

/DEFINE ZIPCODE CHAR(10)
/SET ZIPCODE = ADDRESS2

Similarly, if ZIPCODE was in columns 21–30 of address line 3, you would extract this information as follows:

/DEFINE ZIPCODE CHAR(10)
/SET ZIPCODE = SUBSTR(ADDRESS3,21,10)