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.
OPNQRYF FILE(FILEB) QRYSLT('FIELDB *EQ "10"') OPNID(MYID) CPYFRMQRYF FROMOPNID(MYID) TOFILE(DISK1)