CPYTOIMPF ‘To File’ problem

25 pts.
Tags:
CL
CPYTOIMPF
RPGLE
The following command: ===> CPYTOIMPF FROMFILE(LTCLIB/WPELG01P) TOFILE(LTCLIB/WPELGCSV) MBROPT(*REPLACE) STRDLM(*NONE) produces error To-file WPELGCSV in LTCLIB not allowed. The explanation says the To file must be an externally defined PF, which it is. I need to remove the double quote marks from the CSV file I am trying to produce. Both the From and To files are in the same library on the AS/400. How else should I specify the To File? Thanks, LWK
ASKED: September 10, 2008  5:22 PM
UPDATED: July 30, 2010  6:52 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

You could try using CPYTOSTMF instead of CPYTOIMPF.

CPYTOIMPF/CPYFRMIMPF uses the underlying DB2 engine. IBM, starting in V5R3, got fussy
about getting your CCSID correct. In previous releases I think IBM used
to do a CPYTOSTMF then a CPYTOIMPF. Breaking it down
into two tasks is another perversion that has shown some success. However
getting the CCSID right is best bet. It’s when you do things like
creating a temporary file in QTEMP that some utilities requires not to be
externally defined (CRTPF … RCDLEN(###) type of file) that makes it
tough.

Hope this helps…

Thanks. I also tried making the To File a 1 field, length = 1000 char field. The command then worked with the exception that there were still double quotes at the beginning and end of each record. LWK.

=============================================================

<i>I also tried making the To File a 1 field, length = 1000 char field. The command then worked with the exception that there were still double quotes at the beginning and end of each record.</i>

When the TOFILE is a database file, it is correct to have it defined with a single non-numeric field. But the quotes indicate either that you had quotes already in your FROMFILE or that you specified parameters incorrectly. Quotes are not going to be removed from the FROMFILE records by CPYTOIMPF.

To get answers about a problem, please show the actual commands that demonstrate the problem.

Tom

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • graybeard52
    The target of a CPYTOIMPF is usually and IFS or Windows file, since what it creates is a CSV file (or tab-delimited,etc). So the target is expected to be an IFS or QNTC name.
    3,115 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following