|
I can
help you.
Attached I have three source members.
The CL
pgm does the actual FTP command and I fill SRCMBR FTPIN in the RPG pgm. So
here are the things you need to create:
RPGFTP
- rpg pgm
FTPCL
- cl pgm
FTPIN
- source member for FTP script input
FTPOUT
- source member for FTP logging.
Let me
know if I need to explain it more. There is more explaining in the text
file I have attached.
Aaron
Bartell
|
RPGFTP - I took out all the code that you didn't need for this example. This will basically open the source file member and write out the FTP script to it. SRCDTA is the record name for that file so that is why it is not defined in the pgm. FQFTPSRC O E DISK RENAME(QFTPSRC:RFTPSRC) C exsr $FTPSetup ********************************************************************************************** * FTP Setup ********************************************************************************************** C $FTPSetup BEGSR * C eval SRCDTA = 'username' + 'password' C WRITE RFTPSRC C eval SRCDTA = 'ascii' C WRITE RFTPSRC C eval SRCDTA = 'NAMEFMT 1' C WRITE RFTPSRC C eval SRCDTA = 'lcd /PREPRESS/PPIN' C WRITE RFTPSRC C eval SRCDTA = 'QUIT' C WRITE RFTPSRC C ENDSR _________________________________________________ FTPIN - This is the source member that was written to in the above pgm. I store in the source file QFTPSRC. username password ascii NAMEFMT 1 lcd /PREPRESS/PPIN . . .<any other FTP scripting that you need>. . . QUIT __________________________________________________ FTPCL - The CL pgm that will do the actual FTPing. As you can see it will override QFTPSRC to point to FTPIN for the RPG program to write to. Clear the input and output FTP source members. FTPOUT will contain the log from executing the FTP script. I can't remember why the CHGCMD is there but just leave it because it works. So after the RPG pgm has written out the FTP script to the source member you need to tell the FTP program where FTPIN resides so it can use it to execute. That is what the three OVRDBF are for right before the FTP command. And finally execute the FTP command with the IP address of the server specified. PGM DCL VAR(&RMTIP) TYPE(*CHAR) LEN(15) VALUE('172.26.7.123') OVRDBF FILE(QFTPSRC) TOFILE(QFTPSRC) + MBR(FTPIN) CLRPFM FILE(QFTPSRC) MBR(FTPIN) CLRPFM FILE(QFTPSRC) MBR(FTPOUT) CALL PGM(RPGFTP) CHGCMD CMD(QSYS/FTP) ALLOW(*ALL) OVRDBF FILE(QFTPSRC) TOFILE(QFTPSRC) + MBR(FTPIN) OVRDBF FILE(INPUT) TOFILE(QFTPSRC) + MBR(FTPIN) OVRDBF FILE(OUTPUT) TOFILE(QFTPSRC) + MBR(FTPOUT) FTP RMTSYS(&RMTIP) DLTOVR FILE(*ALL)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.