Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP Sources Between AS400's 1

Status
Not open for further replies.

Skittle

ISP
Sep 10, 2002
1,528
US
How can I FTP source files between AS400s?

I can FTP files but for some reason source files get corrupted. I tried send a complete QRPGSRS as a *SAVF file via FTP but it arrives as a PF.





Dazed and confused
 
Gosh darn it.

I hack away at a problem for a couple of hours then seconds...yes seconds after I type a plea for help I realise where I'm going wrong. I needed to create the source members in the destination source file first.


Dazed and confused
 
Hi Skittle,

Create first a SAVF on target AS400 and FTP to this SAVF in binary mode, e.g.

FTP REMOTE_AS400
USER/PASSWORD
QUOTE CRTSAVF REMOTELIB/REMOTESAVF
BINARY
SEND LOCALLIB/LOCALSAVF REMOTELIB/REMOTESAVF
QUIT

HTH -- Philippe
 
I realize my mistake, it's PUT not SEND on this system. Sorry
 
Thats still miles better than my solution.

Thanks TalkTurkey.

Dazed and confused
 
If you use NAMFMT1 and use a .savf extension for the save file, the save file will be created on the target system, if it doesn't exist.


"When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for here you have been, and there you will always long to return."

--Leonardo da Vinci

 
Hi flapeyre,
I didn't know that. Therefore the savf will automatically be created in an IFS folder and I'll need to use RST command to restore the contents on the target system, won't it be ?
Thx.
Philippe --
 
The save file can be created in the QSYS.LIB file system.

Look at this Google link.


"When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for here you have been, and there you will always long to return."

--Leonardo da Vinci

 
To just FTP one member from my source file I simply use the following PUT command.

NOTE: If the member doesn't exist on the remote as400 it will create it with a blank source type. The only requirements are for both source files to exist.

CL snippet:
<-------Begin CL------->
OVRDBF FILE(INPUT) TOFILE(&SRCLIB/&SRCFILE) MBR(&CMDMBR)

OVRDBF FILE(OUTPUT) TOFILE(&SRCLIB/&SRCFILE) MBR(&LOGMBR)

FTP RMTSYS(&RMTSYS)
<-------End CL------->

Input File:
<-------Begin CMD------->
USER PASS
put XMYLIB/QCLSRC.SNDMBRFTP XMYLIB/QCLSRC.SNDMBRFTP
quit
<-------End CMD------->

Output File: (Log)
<-------Begin Log------->
Output redirected to a file.
Input read from specified override file.
Connecting to host myas400 at address xxx.xxx.xxx.xxx using port
21.
220-QTCP at myas400.
220 Connection will close if idle more than 5 minutes.
Enter login ID (myuser):
331 Enter password.
230 myuser logged on.
OS/400 is the remote operating system. The TCP/IP version is "V5R2M0".
250 Now using naming format "0".
257 "XMYLIB" is current library.
Enter an FTP subcommand.
> put XMYLIB/QCLSRC.SNDMBRFTP XMYLIB/QCLSRC.SNDMBRFTP
227 Entering Passive Mode (xxx,xxx,xxx,xxx,13,198).
150 Sending file to member SNDMBRFTP in file QCLSRC in library XORTIZOSC.
250 File transfer completed successfully.
3764 bytes transferred in 0.005 seconds. Transfer rate 770.867 KB/sec.
Enter an FTP subcommand.
> quit
221 QUIT subcommand received.

<-------End Log------->

Hope this helps

Oz
 
WizTheOz, is there a bit of code mising?
I have never done an FTP session like that before but I can see how it work with one exception. How are you specifying the two FTP addresses? The source and the destination?

Also on the put command, shouldn't there be a difference between the source and destination libraries?

Dazed and confused
 
Skittle,

Sorry about that...

In the CL snippet below I am running FTP in batch mode. Some requirements for batch are to have a command file(that will hold the FTP commands you are wanting to run) and a log file(will store job log of FTP script).

When you run the FTP command you need to declare your input(command file) and output(log file) using ovrdbf. Then you run the FTP command with the remote as/400 as the parameter for RMTSYS. You can enter the ip address enclosed in single quotes.

As far as the differences between the two source libraries. That totally depends in my original example I had the same source file residing in the same library on the two as/400's. You could always put the source file into a different library on the remote as/400. I've simply renamed the script below (Input File section).

I hope this cleared things up for you, best of luck..

Oz

CL snippet:
<-------Begin CL------->
DCL VAR(&RMTSYS) TYPE(*CHAR) LEN(20) VALUE('xxx.xxx.xxx.xxx')
DCL VAR(&SRCFILE) TYPE(*CHAR) LEN(10) VALUE(QFTPSRC)
DCL VAR(&SRCLIB) TYPE(*CHAR) LEN(10) VALUE(XLOCMYLIB)
DCL VAR(&CMDMBR) TYPE(*CHAR) LEN(10) VALUE(FTPCMD)
DCL VAR(&LOGMBR) TYPE(*CHAR) LEN(10) VALUE(FTPLOG)

OVRDBF FILE(INPUT) TOFILE(&SRCLIB/&SRCFILE) MBR(&CMDMBR)

OVRDBF FILE(OUTPUT) TOFILE(&SRCLIB/&SRCFILE) MBR(&LOGMBR)

FTP RMTSYS(&RMTSYS)
<-------End CL------->

Input File:
<-------Begin CMD------->
USER PASS
put XLOCMYLIB/QCLSRC.SNDMBRFTP XRMTMYLIB/QCLSRC.SNDMBRFTP
quit
<-------End CMD------->

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top