× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Tue, 25 Jun 2002, Rubino, Jim wrote:
>
> Is there anyone out there who has written a program to do an FTP of a save
> file from one AS/400 to another in batch, if so I would love to know and see
> how you have done this.  I am not having much luck in doing this with a
> source file and a CL program.
>

Here's a CL program that does that.   (It uses the IBM FTP client)
Unfortunately, with this awkward interface, you have to hard-code your
password in a source member (which is a really bad idea)  but you can
always write a program that creates the FTPINPUT member on the fly...


PGM          PARM(&RMTSYS &XFERLIB &SRCLIB &TEMPLIB)

             DCL        VAR(&FOUND) TYPE(*LGL)
             DCL        VAR(&TEMPLIB) TYPE(*CHAR) LEN(10)
             DCL        VAR(&XFERLIB) TYPE(*CHAR) LEN(10)
             DCL        VAR(&SRCLIB) TYPE(*CHAR) LEN(10)
             DCL        VAR(&RMTSYS) TYPE(*CHAR) LEN(10)

             CHGVAR     VAR(&FOUND) VALUE('1')
             CHKOBJ     OBJ(&TEMPLIB/FTPSAVF) OBJTYPE(*FILE)
             MONMSG     MSGID(CPF9801) EXEC(DO)
                   CHGVAR VAR(&FOUND) VALUE('0')
             ENDDO

             IF (&FOUND *EQ '0') DO
                  CRTSAVF    FILE(&TEMPLIB/FTPSAVF)
             ENDDO
             ELSE DO
                  CLRSAVF    FILE(&TEMPLIB/FTPSAVF)
             ENDDO

             SAVLIB     LIB(&XFERLIB) DEV(*SAVF) +
                          SAVF(&TEMPLIB/FTPSAVF) DTACPR(*YES)

             OVRDBF     FILE(INPUT) TOFILE(&SRCLIB/QRPGLESRC) +
                          MBR(FTPINPUT)
             OVRDBF     FILE(OUTPUT) TOFILE(&SRCLIB/QRPGLESRC) +
                          MBR(FTPOUTPUT)
             FTP        RMTSYS(&RMTSYS)
             DLTOVR     FILE(INPUT OUTPUT)

             DLTF       FILE(&TEMPLIB/FTPSAVF)

ENDPGM

And then, here's the FTPINPUT member:

anonymous me@here.com
cd qgpl
quote rcmd dltf DESTSAVF
quote rcmd crtsavf DESTSAVF
binary
put FTPSAVF DESTSAVF
quit


You'll want to change the user-id & password on the first line, there.

Then call the program with:

         CALL FTPTHING ('ftp.wherever.com' 'MYLIB' 'SRCLIB' 'TEMPLIB')


Really, this is a terrible way to do this, because it doesn't do anything
differnely if the transfer fails.   A much better way would be to write
a program that actually recognizes the different error messages, and
handles them correctly.

I wrote a service program to make this easier.  It's freely available
if you wanted to take a look:

        http://klement.dstorm.net/ftpapi/



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.