This example shows how to select records using multiple fields of the Open Query File (OPNQRYF) command.
OVRDBF FILE(FILEA) SHARE(*YES) OPNQRYF FILE(FILEA) QRYSLT('AMT *EQ 0 *OR LSTDAT + *LE "88-12-31" ') CALL PGM(PGMC) CLOF OPNID(FILEA) DLTOVR FILE(FILEA)
QRYSLT('AMT *EQ ' *CAT &VARAMT *CAT ' *OR + LSTDAT *LE "' *CAT &VARDAT *CAT '"')or, typed in reverse order:
QRYSLT('"' *CAT &VARDAT *CAT '" *GT LSTDAT *OR ' + *CAT &VARAMT *CAT ' *EQ AMT')
The &VARAMT variable must be defined as a character type. If the variable is passed to your control language (CL) program as a numeric type, you must convert it to a character type to allow concatenation. You can use the Change Variable (CHGVAR) command to do this conversion.