You get different results while specifying CRTFILE(*YES) on the CPYF command and the CPYFRMQRYF command.
If you specify CRTFILE(*YES) on the CPYF command, the to-file that is created has the same record format and type of access path as the from-file. The file level and the format level identifiers of the new to-file are identical to the file level and the format level identifiers of the from-file. The text of from-file members that are copied is used as the text of any to-file members that are created.
When the from-file is a logical file, the server assigns the following physical file attributes: SIZE(*NOMAX), ALLOCATE(*NO), and CONTIG(*NO). If the from-file is a logical file with multiple record formats, the to-file is created with the format that is specified on the RCDFMT parameter on the CPYF command.
If you specify CRTFILE(*YES) on the CPYFRMQRYF command, the file level and the format level identifiers of the new to-file are generated at the time the new to-file is created. Furthermore, the physical file's attributes match the first file that is specified on the FILE parameter of the corresponding Open Query File (OPNQRYF) command. However, the server assigns some of the attributes. The file is created with CONTIG(*NO), SIZE(*NOMAX), ALLOCATE(*NO), AUT(*NORMAL) and FILETYPE(*DATA).
The name, type, length, null capability, date, or time format, separators, and decimal positions attributes of each field on the format that is specified are used. The file is created without key fields and is an arrival sequence physical file.