You can use CPYF command for copying data from one File(PF or LF) to other.
If the destination file doesnt exist, we can use option
<pre>Create file . . . . . . . . . . > *YES *NO, *YES </pre>
But, the resultant file will be PF.
Eg. If we are copying data from TESTLF to NEWFILE,
Then the resultant NEWFILE will be of type 'PF'.
Instead of CPYF command you can use CRTDUPOBJ command for copying PF/LF
<pre> Create Duplicate Object (CRTDUPOBJ)
Type choices, press Enter.
From object . . . . . . . . . . Name, generic*, *ALL
From library . . . . . . . . . . Name, *LIBL, *CURLIB
Object type . . . . . . . . . . *ALL, *ALRTBL, *AUTL...
+ for more values
To library . . . . . . . . . . . *FROMLIB Name, *FROMLIB, *SAME...
New object . . . . . . . . . . . *OBJ Name, *OBJ, *SAME
From ASP device . . . . . . . . * Name, *, *CURASPGRP, *SYSBAS
To ASP device . . . . . . . . . *ASPDEV Name, *ASPDEV, *... </pre>
While Copying LF and corresponding PF, make sure you copy PF first and then LF.
Pradeep.
======================================================================
Minor addendum: when you use CRTDUPOBJ to duplicate the physical file, specify DATA(*NO). After using CRTDUPOBJ to duplicate the logical file(s), use CPYF to copy the data. This will ensure the duplicated logical files are based on the correct physical file.