Page History
...
Example 1: Check for a record in the file CUSMST that has a key matching the value currently in the field #CUSNUM:
...
CHECK_FOR IN_FILE(CUSMST) WITH_KEY(#CUSNUM)
...
IF_STATUS IS_NOT(*EQUALKEY)
...
ABORT MSGTXT('Customer not found in customer master')
...
ENDIF
Note how the CHECK_FOR command returns a status of *EQUALKEY or *NOTEQUALKEY, rather than the more commonly used status of *OKAY.
Example 2: Check a nominated tax code against a table of valid tax codes. The first key to the table indicates the tax classification which in this case is always income tax.
...
CHECK_FOR IN_FILE(TAXTAB) WITH_KEY('INCOME' #TAXCDE)
...
IF_STATUS IS_NOT(*EQUALKEY)
...
MESSAGE MSGTXT('Tax code specified not valid for income tax')
...
ENDIF