Question

  Asked: Apr 1 2008   11:14 AM GMT
  Asked by: Pradeepr


How to FTP a file from PC to my personal library?


RPGLE, RPG ILE, RPG IV, AS/400, AS/400 FTP

How to FTP a file from PC to my personal library?

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
+1
Click to Vote:
  •   1
  •  0




Hi,

1. Start an FTP session from your PC to your AS/400. From command type FTP hostname. (replace hostname with your hostname or IP address).

2. Type your user id and password when prompted.

3. Change working directory on your PC to where your file is. lcd directoryname.

4. Change working directory on AS/400 to your personal library. cd libraryname.

5. Select binary or ascii if necessary. BIN or ASC. You probably don't need to do this if you're just transferring text.

6. Transfer the file. PUT pcfilename as400filename (where pcfilename is the filename with the extension e.g. myfile.txt and the as400filename is a valid AS/400 object name - <= 10 characters long).

7. Exit the FTP session. quit.

That should be enough to get your file to the AS/400.

Regards,

Martin Gilbert.
  • AddThis Social Bookmark Button

Browse more Questions and Answers on AS/400.

Looking for relevant AS/400 Whitepapers? Visit the Search400.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register

Gilly400  |   Apr 1 2008  12:33PM GMT

Hi,

I also have a PC batch file (for windows XP) which I sometimes use for basic FTP transfers. This doesn’t do any error checking, it’s just a quick and dirty front end to <a href="http://FTP." rel="nofollow">FTP.</a> Just cut and paste the text under this into a PC text file and save as something like FTPFIL.BAT

Cheers,

Martin Gilbert.

@REM
@REM *****************************************
@REM *** FTPFIL.BAT ***
@REM *** ============= ***
@REM *** FTP file between PC and AS400s ***
@REM *** ***
@REM *** Written by Martin Gilbert ***
@REM *** October 2007 ***
@REM *** V1.0 ***
@REM *** ***
@REM *****************************************
@REM
@color 0c
@cls
@REM *****************************************
@REM First enter all the parameters necessary
@REM ========================================
@REM
@REM cls between system name, user id password
@REM and putget to avoid showing all these
@REM parameters on the screen at the same time
@REM
@REM *****************************************
@echo .
@set /p sysnam=Please enter the AS400 system name………………:
@if “%sysnam%”=="" goto nosysnam
@cls
@echo .
@set /p user=Please enter your User Id………………………:
@if “%user%”=="" goto nouser
@cls
@echo .
@set /p pass=Please enter your password……………………..:
@if “%pass%”=="" goto nopass
@cls
@echo .
@set /p putget=Please enter put (to as400) or get (from as400)…..:
@if “%putget%”=="" goto noputget
@echo .
@set /p pcfile=Please enter the PC file name…………………..:
@if “%pcfile%”=="" goto nopcfile
@echo .
@set /p aslib=Please enter the AS400 library………………….:
@if “%aslib%”=="" goto noaslib
@echo .
@set /p asfile=Please enter the AS400 file name………………..:
@if “%asfile%”=="" goto noasfile
@echo .
@set /p mode=Please enter the ASCII or BIN for transfer mode…..:
@if “%mode%”=="" goto nomode
@echo .
@cls
@REM *****************************************
@REM Show status messages
@REM *****************************************
@echo .
@if “%putget%”=="put” echo Sending file %pcfile%
@if “%putget%”=="put” echo To system %sysnam%
@if “%putget%”=="put” echo In library %aslib% as %asfile%
@if “%putget%”=="get” echo Retrieving file %asfile% In library %aslib%
@if “%putget%”=="get” echo From system %sysnam%
@if “%putget%”=="get” echo To file %pcfile%
@echo Using %mode% mode
@echo Please wait
@REM *****************************************
@REM Delete old files
@REM *****************************************
@echo .
@if exist FTPFIL.FTP del /Q FTPFIL.FTP > NUL
@if exist FTPFIL.LOG del /Q FTPFIL.LOG > NUL
@REM *****************************************
@REM Build FTP script
@REM *****************************************
@echo .
@echo Building FTP script
@echo .
@echo %user% > FTPFIL.FTP
@echo %pass% >> FTPFIL.FTP
@echo %mode% >> FTPFIL.FTP
@echo CD %aslib% >> FTPFIL.FTP
@if “%putget%”=="put” echo put %pcfile% %asfile% >> FTPFIL.FTP
@if “%putget%”=="get” echo get %asfile% %pcfile% >> FTPFIL.FTP
@echo quit >> FTPFIL.FTP
@REM *****************************************
@REM Run the FTP script
@REM *****************************************
@FTP -s:FTPFIL.FTP %sysnam% > FTPFIL.LOG
@cls
@REM *****************************************
@REM Delete the FTP script IMPORTANT !
@REM FTP script contains user and password !
@REM *****************************************
@if exist FTPFIL.FTP del /Q FTPFIL.FTP > NUL
@REM *****************************************
@REM Send completion message
@REM *****************************************
@echo .
@echo FTP session completed
@echo .
@goto end
@REM
@REM *****************************************
@REM *** Error handling. ***
@REM *****************************************
@REM
@REM *****************************************
:nosysnam
@echo .
@echo AS400 system name not entered
@echo Please try again
@echo .
@goto end
@REM *****************************************
:nouser
@echo .
@echo No user entered
@echo Please try again
@echo .
@goto end
@REM *****************************************
:nopass
@echo .
@echo No password entered
@echo Please try again
@echo .
@goto end
@REM *****************************************
:noputget
@echo .
@echo put or get must be entered
@echo Please try again
@echo .
@goto end
@REM *****************************************
:nopcfile
@echo .
@echo PC file name not entered
@echo Please try again
@echo .
@goto end
@REM *****************************************
:noaslib
@echo .
@echo AS400 library name not entered
@echo Please try again
@echo .
@goto end
@REM *****************************************
:noasfile
@echo .
@echo AS400 file name not entered
@echo Please try again
@echo .
@goto end
@REM *****************************************
:nomode
@echo .
@echo Transfer mode not entered
@echo Enter ASCII or BIN
@echo Please try again
@echo .
@goto end
@REM *****************************************
@REM *** End of program. ***
@REM *****************************************
@REM
:end
@pause
:exit