Using Masks and Wildcards

Masking and/or wildcard characters can be used in your table requests to retrieve records without having to specify each selection value or fieldname.  

Mask ($) - To Select Specific Records

The dollar sign ($) is used to mask corresponding characters in field values, so they are ignored.  Masking is frequently used in screening statements to retrieve a group of records that begin with the same character. For example, you could use a mask to select only those CBID values that begin with R (represented employees):

 

EX AC

TABLE FILE AC
PRINT ac:wname
if ac:CBID eq 'r$$'

END

 

Additional notes on masks:

  • The masked data field must have an alphanumeric (A) format.

  • You can use the EQ and NE logical operators to perform screening on masked fields.

  • Masking is not supported in compound WHERE statements that use the AND or OR logical operators.

  • An asterisk (*) can be used to terminate the mask.  For example, the screening statement IF AC:LASTNAME EQ 'SM$*' will retrieve all employees whose last name begins with the letters SM.

  • Warning!  FOCUS will not retrieve data inclusive of the last value in the specified range when masking is used.  For example, the screening statement IF AC:LASTNAME FROM 'A$*' TO 'D$*' will only retrieve employees whose last name begins with A, B and C.  Note:  FOCUS will correctly retrieve data for a specified range if masking is not used.

Wildcard (*) - To Select All Records

The asterisk (*) is a wildcard that can be used to display all the fields in a single path file. The wildcard command is frequently used to verify the data contained in hold files.  For example, to display all the fields in your PERMLRG hold file without specifying each fieldname, you could execute the following commands:

 

TABLE FILE permlrg

PRINT *

END

 

Additional notes on using wildcards:

  • The wildcard can be used with the verb PRINT or LIST.

  • The field values are displayed in the order in which they are accessed from the database.    

  • The wildcard command will only display 'real' fields in the file (i.e., defined fields will not display).

 

Refer to your FOCUS documentation for additional information on masks and wildcards.