CL program coding with the Open Query File (OPNQRYF) command
When you use the Open Query File (OPNQRYF) command, follow these rules to prevent coding errors.
In the following example, the fields INVCUS and INVPRD are defined as character data:
- Specify selection fields from a database file without an ampersand (&). Fields declared in the control language (CL) program with DCL or DCLF require the ampersand.
- Enclose fields defined in the CL program with DCL or DCLF within single quotation marks ('&testfld', for example).
- Enclose all parameter comparisons within quotation marks when compared to character fields, single quotation marks when compared to numeric fields.
QRYSLT('INVCUS *EQ "' *CAT &K1CUST *CAT '" *AND + INVPRD *GE "' *CAT &LPRD *CAT '" *AND + INVPRD *LE "' *CAT &HPRD *CAT '"')If the fields are defined numeric data, the QRYSLT parameter can look like this:QRYSLT('INVCUS *EQ ' *CAT &K1CUST *CAT ' *AND + INVPRD *GE ' *CAT &LPRD *CAT ' *AND + INVPRD *LE ' *CAT &HPRD *CAT ' ')
Parent topic:
Using Open Query File (OPNQRYF) command
Related concepts
Usage notes for the Open Query File (OPNQRYF) examples