Example 2: Copying from an open query file

 

This example shows how to print records based on selection using the Open Query File (OPNQRYF) and Copy from Query File (CPYFRMQRYF) commands. Assume that you want to print all records from FILEA where the value of the CITY field is Chicago. You can specify as follows:

OPNQRYF FILE(FILEA) QRYSLT('CITY *EQ "CHICAGO"')
CPYFRMQRYF FROMOPNID(FILEA) TOFILE(*PRINT)

 

Parent topic:

Copying from an open query file