Copying from an open query file
You can use the Copy from Query File (CPYFRMQRYF) command to copy from an open query file to another file or to print a formatted listing of the records.
Any open query file, except those using distributed data management (DDM) files, specified with the input, update, or all operation value on the FILE parameter of the Open Query File (OPNQRYF) command can be copied using the CPYFRMQRYF command. The CPYFRMQRYF command cannot be used to copy to logical files.
Although the CPYFRMQRYF command uses the open data path of the open query file, it does not open the file. Consequently, you do not have to specify SHARE(*YES) for the database file you are copying.
- 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.
- 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.
- Example 3: Copying 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.
- Example 4: Copying from an open query file
This example shows how to create a copy of the output of a dynamic join using the Open Query File (OPNQRYF) and Copy from Query File (CPYFRMQRYF) commands.
Parent topic:
Other runtime considerations for the Open Query File (OPNQRYF) command
Related concepts
Database file management