Ask the Expert

Working with the CPYTOIMPF command

In the CPYTOIMPF command, can the TOSTMF file name be &varible file name. I want the "to" file name to be the same as my "from" file name. But when I enter the command I provide the "from" file as &OUT from library &LSPDTA (actual name on iSeries is TAX1099M/MYLIB). The to file written as &OUT.

My guess is that you are putting quotes around your variable name. Here is an example CL program that may help.

 PGM                                                      
                                                         
DCL        VAR(&FNM) TYPE(*CHAR) LEN(10) VALUE('MYFILE') 
DCL        VAR(&TOSTMF) TYPE(*CHAR) LEN(30)                 
                                                         
CHGVAR     VAR(&TOSTMF) VALUE('MYDIR' *TCAT &FNM)               
                                                         
CPYTOIMPF  FROMFILE(&FNM) TOSTMF(&TOSTMF) +               
             STMFCODPAG(*PCASCII) RCDDLM(*CR)            
                                                         
ENDPGM  

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: Tips, tutorials and more.

Ask your systems management questions--or help out your peers by answering them--in our live discussion forums.

Read this Search400.com Featured Topic: Managing your iSeries.


This was first published in October 2002

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

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
Sort by: OldestNewest

Forgot Password?

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

Your password has been sent to: