Automate transfer from AS400 to a PC

jokerjoe6773
jokerjoe6773 used Ask the Experts™
on
I need to transfer 4 files from a AS400 to a pc share. The files are CSV files if that matters. I know how to set the schedule up on the 400 to create the files I just don't know how to do the actual transfer from the 400 where the file is created to the pc where the file needs to be. Please be as specific as you can be since I am not a 400 guru.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
VP Technology / Senior Consultant
Commented:
Manual transfer or automated?

Manual transfer options:

1) Drag and drop from IBM i Navigator for Windows, if that program is installed on your PC
2) Map a share in IBM i NetServer, and then drag and drop using Windows Explorer or the DOS COPY/XCOPY command.  NetServer is an AS/400 service that allows AS/400 folders to be shared on a Windows network.
3) If your PC is running an FTP server, use AS/400 FTP client to PUT files to the PC server.
4) If your AS/400 is running the FTP service, use the PC FTP client to GET files from the AS/400 server.
5) Configure the QNTC file system on the AS/400, create a link to the PC server, and use the AS/400 COPY command to copy the files from the AS/400 to the PC server.  This file system allows the AS/400 to directly interact with Windows file shares.

Most of the above methods can also be automated.

- Gary Patterson

Commented:
If you use the #4 option listed by Gary_The_IT_Pro:

4) If your AS/400 is running the FTP service, use the PC FTP client to GET files from the AS/400 server.

You could use a Robo-FTP script running on the PC to download the file, retry failed downloads, and send the support team an email or SMS text if download fails repeatedly.

Commented:
Where are the file now? QSYS? IFS?

Steve

Author

Commented:
I need it automated. They are in QSYS

Author

Commented:
Here is what I would like to have happen...I would like to create a share and have the query write to that share then maybe map a drive on the PC to that share.

Commented:
Is this pc share on the 400 or on a windows machine?

If it is on a PC then cause your AS/400 userid and password to match your windows userid and password and the try this: wrklnk '/QNTC/*'  
you will be presented with a list of shares that the 400 can see.   Do you see the one you are looking for?  If you do then Gary's #5 will do the job.

If it is on the 400 let me know.  I have more recommendations.

Steve
                                                                   

Author

Commented:
I don't really have the share set up yet...I actually want it on the 400 but I'm not sure how to go about making a share that I can put a query in. See what I have is a query that I want to run at night and that query creates a CSV file which in turn is used by a program that is located on a PC. The program on the PC just needs access to those files.
Gary PattersonVP Technology / Senior Consultant
Commented:
When you say "query", do you mean Query/400 (WRKQRY) or something else?  How, exactly , do you run this query?
You said that your query generates a CSV.  How does it do that?  Normally a CSV would be stored in a stream file in the IFS, not in the QSYS file system.

Lots of ways to accomplish this, but here is one relatively easy way to do something like this:

1) Configure NetServer, and create a Windows-style file share.  NetServer is an AS/400 service that allows you to publish AS/400 IFS folders as Windows-compatible shares.  PC users can access these shares just like any other shares on the network.

2) Use some query facility (embedded SQL, QMQRY, WRKQRY, STRSQL, etc) to create a database file containing your query results

3) Use the CPYTOIMPF command to convert the DB file to a CSV stream file in the IFS folder that you previously shared though NetServer.

Steps 2-3 can be automated in a CL and scheduled if this is something that needs to happen regularly.

Configuring NetServer:  http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=%2Frzaij%2Frzaijconnetas.htm
CPYTOIMPF command: http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=%2Fcl%2Fcpytoimpf.htm

- Gary Patterson
...then cause your AS/400 userid and password to match your windows userid and password...

That piece is often not possible. A more reasonable way to do it is to create a local user on the PC that is exporting a share and have it match an AS/400 profile (and password). Many Windows user profiles are network profiles, so creating a local Windows user on that PC is a workable alternative. The structure of the name and the password can be easier to match up.

Tom

Commented:
For a user to read/write to the IFS, it needs to be configured in WRKDIRE.  So you need to create the PC user on the AS400.
Gary PattersonVP Technology / Senior Consultant

Commented:
For a user to read/write to the IFS, it needs to be configured in WRKDIRE.  So you need to create the PC user on the AS400.

I'm pretty sure that I use the IFS on numerous systems where my profile is not in the system directory.  All you need is a profile with adequate authority to the folder (and files, of course).
The WRKDIRE entry is only required when the old/obsolete /QDLS file system is used. Almost no one should be using it nowadays.

Tom
What we have ended up doing is creating the share on the 400 and using the XTMENU to extract the CSV file to the shared drive then mapped that share on the PC.

Thanks for all the help and advice.

Author

Commented:
Used XTMENU to complete the process.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial