As400 CPYF command

pfd

Reputable Poster
I needed some help with the CPYF command on the AS/400. I needed to copy a few records from F4801S back to F4801 (These records were accidentally purged). I know how to copy entire files. I am not sure how to copy just records with a specific Work Order #. Any help will be appreciated.

Thanks,
Matt
AS/400, V5R3, One World Xe, SP23
 
Matt;
If you know what relative record number they are, you can specify a "from" and "to" record number using the CPYF command. Use F10 "Additional parameters" and specify in the "copy from record number" and "copy to record number" fields the beginning and ending record number(s). You can also use "Include records by character test" option and specify the field name (i.e. Customer number) and the character position and grab them that way. Try playing around with the CPYF command with a copied file (the whole file) to see what it does for you. A long way around is to copy the whole file to a work file, then SQL (delete) everything out of it but what you want to keep.
wink.gif
 
If you do CPYF and F4, then F10 for additional parameters, there is an
Include Records by field test, toward the end of the command parameter
list, that lets you specify to copy only for certain values (can have
multiple tests here - standard and/or logic as well, just like IBM
query). I would recommend doing a test copy to a dummy file first, to
make sure you have your selection criteria set correctly, before copy to
a production file.

John Dickey
Financial Systems Administrator
White-Rodgers, division of Emerson Electric
8100 West Florissant Ave.
P.O. Box 36922
St. Louis, MO 63136-9022
314-553-3067
[email protected]
 
Matt you can do the following - replacing yourlib with the library name
where each of the files reside and replace 12345678 with the number of
the Work Order Number you want to add back into the F4801.

CPYF FROMFILE(YOURLIB/F4801S) TOFILE(YOURLIB/F4801) MBROPT(*ADD)
INCREL((*IF WADOCO *EQ 12345678)) FMTOPT(*MAP *DROP)

I hope this helps you.

Jim Rubino
 
Re: RE: As400 CPYF command

I must say that the World discussion board is extremely responsive! Thanks everybody! I did get the CPYF command to work for the set of records that I wanted to copy.

Thanks,
Matt
 
Back
Top