Re: Need a kick in the *** on FTP from AS/400 to PC or FTP Server
- From: "JTF" <jflaker@xxxxxxxxx>
- Date: 12 Apr 2007 18:58:58 -0700
Try this
OVRDBF FILE(INPUT) TOFILE(QTEMP/FTPCMD)
OVRDBF FILE(OUTPUT) TOFILE(QTEMP/FTPLOG)
FTP RMTSYS(&RMTSYS)
The INPUT file is the file that has the ftp commands including the
user. It would look something like this
USERNAME PASSWORD
FILEFMT 1 <--This is to get into PC naming
PUT SOMELIB/SOMEFILE.SOMEMEMBER DESTINATIONDIR/DESTINATIONFILENAME
QUIT
The OUTPUT will capture the session's output which will tell you if
the FTP send or rec'v is good....Here is the source for that....call
immediately after each put or get to find if the send was
good..........if OK, the pgm will return a 'Y'
F********************************************************************
FOUTPUT IF F 256 DISK
E********************************************************************
E TEXT 1 3 36
I********************************************************************
IOUTPUT NS
I 1 3 CTL#
I 1 5 CTL#1
I 1 8 CTL#2
I 3 6 CTL#3
I 5 40 @TEXT
I 54 72 @TEXT2
I*
I SDS
I *PROGRAM QPROG
I *PARMS QPARM
I 254 263 QUSER
I 244 253 QJOBN
C********************************************************************
C *ENTRY PLIST
C PARM FILE 10
C PARM OK 1
C********************************************************************
C* FIRST TIME ROUTINE
C********************************************************************
C MOVE 'N' OK
C********************************************************************
C* MAIN PROGRAM
C********************************************************************
C READ OUTPUT 95
C *IN95 DOWEQ*OFF
C* -------------------------
C CTL# IFEQ 'PUT'
C CTL#1 OREQ '> PUT'
C CTL#1 OREQ '> put'
C CTL#1 OREQ 'APPEND'
C CTL#2 OREQ '> APPEND'
C CTL#2 OREQ '> append'
C*
C READ OUTPUT 95
C *IN95 DOWEQ*OFF
C*
C CTL# IFEQ '250'
C******* CTL# OREQ '426'
C CTL# OREQ '226'
C @TEXT IFEQ TEXT,1
C @TEXT2 OREQ TEXT,2
C @TEXT OREQ TEXT,3
C MOVE 'Y' OK
C END
C END
C*
C READ OUTPUT 95
C ENDDO
C*
C END
C* -------------------------
C CTL# IFEQ 'GET'
C CTL#1 OREQ '> GET'
C CTL#1 OREQ '> get'
C CTL#3 OREQ 'MGET'
C CTL#3 OREQ 'mget'
C*
C READ OUTPUT 95
C *IN95 DOWEQ*OFF
C*
C CTL# IFEQ '226'
C CTL# OREQ '250'
C @TEXT IFEQ TEXT,3
C @TEXT OREQ TEXT,1
C MOVE 'Y' OK
C END
C END
C*
C READ OUTPUT 95
C ENDDO
C*
C END
C* -------------------------
C READ OUTPUT 95
C ENDDO
C********************************************************************
C SETON LR
C RETRN
C********************************************************************
**
File transfer completed successfully
have been truncated
Transfer complete.
On Apr 10, 8:51 am, Gilbert Noetzel <gilbe...@xxxxxxxxxx> wrote:
Guys and Gals!
I read most of the subjects on FTPing to/from AS/400. I do not consider
our AS/400 is any different than others.
Here is what I need to do (for the first time in my life):
I need to find an automated way to send a Database file on the native
AS/400 to a PC Server or xxxxxftp.com server. I thought I could do this
with CLP programming, but I hit a 'stone wall' when I do this manually.
Below error is an example and I do not know why this happen, I changed
the file name and the error is still there:
CPYTOIMPF FROMFILE(LIBRARY/HDLOT) TOFILE(LIBRARY2/SHDLOT)
File QCP_EXFA in library QTEMP already exists.
QCP_EXFA in QTEMP type *FILE already exists.
Data was truncated on an input, output or update operation.
Error Occurred in SQL Call Level Interface
Error Occurred in SQL Call Level Interface
No records copied from file HDLOT in LIBARY.
Copy command ended because of error.
I did this 3 seperate time and each fail when I change the 'TOFILE' name
to other names. The interesting thing is that I did a DSPF on the
SHDLOT file, and it shows 1 record already copied but nothing else. It
seemed it bombed after copying 1 record.
I would appreciate any or all of your insight in creating an automated
(end of day) type script to FTP file(s) from AS/400 to an FTP/PC/Web Server.
Thanks a lot !
Gil
.
- References:
- Need a kick in the *** on FTP from AS/400 to PC or FTP Server
- From: Gilbert Noetzel
- Need a kick in the *** on FTP from AS/400 to PC or FTP Server
- Prev by Date: Re: Ugrade from V5R2M0 questions
- Next by Date: Re: One more quick journal question if you please...
- Previous by thread: Re: Need a kick in the *** on FTP from AS/400 to PC or FTP Server
- Next by thread: Stored procedure. Help
- Index(es):