Example 1: Copying from an open query file

 

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. Assume that you want to create a file from the CUSTOMER/ADDRESS file that contains only records where the value of the STATE field is Texas. You can specify as follows:

OPNQRYF FILE(CUSTOMER/ADDRESS) QRYSLT('STATE *EQ "TEXAS"')
CPYFRMQRYF FROMOPNID(ADDRESS) TOFILE(TEXAS/ADDRESS) CRTFILE(*YES)

 

Parent topic:

Copying from an open query file