Automate transferring data from the iSeries

Rick wrote in with this question recently:
"I am trying to automate transferring data from the iSeries to a PC server using FTP. I have built the CL's, the RPG ILE program and the test file. Everything looks good except that when I execute the CL and the program gets to the FTP portion I receive a message, 'You must first issue the User sub command.' I have researched this and have been unable to determine where my file differs from the posted ones. Can anyone give me pointers?"
File Layout =======
FTP 192.168.66.99
USER FTPUser
PASS FRED999
PUT WEBAPP/QRYARMST QRYARMST.TXT
QUIT
======================
-- Deb Tart, associate editor

Answer Wiki

We ftp files in batch on a regular basis. We do it through the use of source files to get the actual commands to run. I am attaching the CL and the source file we use to do this as an example.
PGM
OVRDBF FILE(INPUT) TOFILE(FABRICLIB/QTXTSRC) +
MBR(MAHINPUT)
OVRDBF FILE(OUTPUT) TOFILE(FABRICLIB/QTXTSRC) +
MBR(MAHOUTPUT)
FTP RMTSYS(FTP.INTFABGRP.COM) /* SEND FILES TO +
THE FTP SERVER */

The input source file contains the following

as400 as400
cd /maharam
PUT FABGPL/MAHRECVP MAHRECVP.TXT
quit

The top 2 lines are the user id and password. The output source file contains the ftp log so you can view any errors etc. Hope this helps.

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

Processing your response...

Discuss This Question: 3 &nbspReplies

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

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

It would appear that the ftp logon and/or password is failing. Therefore, when you issue a subsequent ftp command such as a put or get, the user is not logged on, hence the message- "You must first issue the USER subcommand"
Your ftp script should look something like the follwing:-
*************** Beginning of data ****
0001.00 tom TOMSpwd
0002.00 ascii
0003.00 cd /fnx/fx/import
0004.00 put phdixtro.phdixtro ibisrolls.txt
0005.00 quit
********* End of Data ***********
Line 0001.00 logs on to the remote site with user and user password. If the User does not exist or the password is incorrect, you will get the "issue the USER subcommand" message when it tries to execute line 0002.00
I hope this helps

What they said was correct. To clarify, in your case,
the infile CL should be:
---------------
FTPUser FRED999
put webapp/qryarmst qryarmst.txt
quit
---------------
The outfile should be an empty cl member that you will want to clear periodically.
the calling cl should be something like:
---------------
ovrdbf file(input) tofile(library/qclsrc) mbr(infile)
ovrdbf file(output) tofile(library/qclsrc) mbr(outfile)
ftp rmtsys('192.168.66.99')
dltovr *all
----------------
Barnes

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

Processing your reply...

Ask a Question

Free Guide: Managing storage for virtual environments

Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!

To follow this tag...

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