This example shows how to build a file with a subset of records using the Open Query File (OPNQRYF) and Copy from Query File (CPYFRMQRYF) commands.
OPNQRYF FILE(CUSTOMER/ADDRESS) QRYSLT('STATE *EQ "TEXAS"') CPYFRMQRYF FROMOPNID(ADDRESS) TOFILE(TEXAS/ADDRESS) CRTFILE(*YES)