Example 3: Copy from an open query file

This example shows how to copy a subset of records to a diskette using the Open Query File (OPNQRYF) and Copy from Query File (CPYFRMQRYF) commands.

Assume that you want to copy all records from FILEB where the value of FIELDB is 10 to a diskette. You can specify:
OPNQRYF FILE(FILEB) QRYSLT('FIELDB *EQ "10"') OPNID(MYID)
CPYFRMQRYF FROMOPNID(MYID) TOFILE(DISK1)