Ftp file transfer and more media techtarget com
Pdf File 477.59 KByte, 14 Pages
FTP, File Transfer, and More
You're probably already familiar with using a File Transfer Protocol (FTP) client for downloading files from the Internet. What you may not know is that you can do a lot more with FTP when you are connected to an OS/400 FTP server. That's because the OS/400 rendition of FTP allows you to call programs or execute commands on your 400 from an FTP client session. This ability can be great in situations that require a program to be run before or after transferring a file. We'll examine how to make the most of this functionality to help to integrate your 400 with PCs and LANs.
As with other FTP servers, logging into OS/400's implementation of FTP requires a user to enter a user name and password. Any valid OS/400 user can log in via FTP. Before you can access your 400 via FTP, you must ensure that the FTP server is conFigured and running. Use the Change FTP Attribute (CHGFTPA) command to display and, if necessary, change your FTP server configuration. Figure 6.1 shows the screen displayed by typing CHGFTPA and pressing F4 to prompt.
SECTION II: PC Client Cool Things
Figure 6.1: The CHGFTPA command is used to configure the OS/400 FTP server.
This screen is used to configure the FTP server. The first option defines whether the server runs automatically at IPL. The next parameter defines the number of instances of the FTP server that are initially started. The Inactivity Timer parameter defines the amount of time that an FTP client can remain logged in without activity before the server closes the session. The Coded Character Set Identifier defines the code page to be used by each FTP client. The next two parameters define the outgoing and incoming ASCII-to-EBCIDIC translation tables. These can be used customize character translations. The Initial Name Format parameter defines the file naming format that is used when a client initially logs in. The *LIB option causes file names to be displayed in the format LIBRARY.FILE. The *PATH format shows files in the form of their relative path. The Initial Directory parameter identifies which library will be displayed when a client logs in. *CURLIB defines that the current library for the user will be used. *HOMEDIR causes the user's home directory to be displayed. The Initial List Format parameter defines the type of file list to be displayed at a client session. *DFT uses the OS/400 default listing format. *UNIX displays the file list in a format similar to that used by the UNIX file system. Finally, the New File CCSID parameter defines the code page to be used when creating a new file from within an FTP session.
CHAPTER 6: FTP, File Transfer, and More
If the FTP server is not set to auto start or is not running, it can be started using the Start TCP/IP Server (STRTCPSVR) command:
Now we're ready to access the OS/400 FTP server. Let's log in to ensure that everything is running properly. In Windows, display a DOS window and type FTP followed by the IP address of your 400 and press Enter. You will be prompted for a user name and password. Once you've entered a valid user name and password, the FTP prompt is displayed as shown in Figure 6.2. Type DIR and press Enter to display a list of files in the current directory.
C:\>ftp 126.96.36.199 Connected to 188.8.131.52 220-QTCP at S1234ABC. 220 Connection will close if idle more than 5 minutes. User (184.108.40.206:(none)): QPGMR 331 Enter password. Password: 230 QPGMR logged on. ftp> dir Figure 6.2: An example of logging into the OS/400's FTP server.
The FTP command remotehelp is used to display a listing of the commands supported by the FTP server itself. If you are unfamiliar with FTP, a list of common FTP commands and their usage is shown in Table 6.1.
SECTION II: PC Client Cool Thingss
Table 6.1: Some Frequently Used FTP Commands
asc bin cd get, recv lcd mkdir put, send quote
Use ASCII transfer mode. Use binary transfer mode. Change the current directory on the server. Download a file from the server. Change the local directory on your client. Create a new directory on the server. Upload a file to the server. Send a remote command to the server.
Files can be easily sent to and from the 400 using the recv and send commands. It is important to remember that when you send or receive a physical file from the 400, it is going to be basically a text file when received on the PC. That means that any fields containing packed numeric data will not be viewable. The solution to that problem is to create a "pre-download" program to copy the data into a file without packed fields. This is where remote commands come into play. Using the quote FTP command along with the RCMD FTP server command, you can run a program on the 400 from within FTP as follows:
quote RCMD CALL PGM(XXX000CL)
In this example, the program named XXX000CL is called through the FTP session. This ability becomes even more powerful when you consider that you can create a "scripted" FTP session to run frequently used functions. One thing to consider is that the library list used by the FTP session may not meet the requirements of your program. Not to worry however, because we can use the same quote RCMD function to add any required libraries to the current job's library list prior to running the application. The example shown in Figure 6.3 adds three libraries to the FTP job's library list and then calls the required program.
CHAPTER 6: FTP, File Transfer, and More
quote RCMD ADDLIBLE QFNTCPL quote RCMD ADDLIBLE QSRV quote RCMD ADDLIBLE MYLIB quote RCMD CALL PGM(BLD001CL) recv BLD001PF quit
Figure 6.3: A series of FTP commands used to run a program prior to downloading a file.
In this example, the Add Library List Entry (ADDLIBLE) command is used to add the libraries QFNTCPL, QSRV, and MYLIB to our library list. Next the CALL command is used to run the CL program BLD001CL. Then the FTP recv command is used to download the file BLD001PF from the system. Finally the quit command ends the FTP session. You can use practically any OS/400 command from within an FTP script. Besides simply calling a program, you can do things like send messages to a user or run a query. For troubleshooting purposes, you can use the following command:
ftp> Quote RCMD DSPJOBLOG
This causes the job log for the FTP session to be sent to the default printer. By creating scripted FTP sessions, you can create functions for commonly used tasks. FTP scripts are basically text files that contain all of the keystrokes to be sent to the FTP server. This includes the user name and password so it's usually a good idea to create a user profile specifically for FTP scripting purposes. This allows you to give that profile access to required objects only. When the script is run, all output that would normally be sent to the FTP client display is output a QSYSPRT printer file. This is also a great tool for troubleshooting problems within an FTP script
On the client side, you can use the "!" command to simply display a DOS prompt, or this command can be followed by a program name to launch that program. For example, the following command launches Windows Explorer and displays the C:\Windows directory:
ftp> ! EXPLORER C:\WINDOWS
SECTION II: PC Client Cool Things
If a DOS program is run, processing of the FTP script is halted until the DOS program completes. If a Windows program is launched, the FTP script continues processing. This is an important point to remember if continued processing of the FTP script needs the launched application to complete. This gives you the ability to perform the same functionality client-side that the RCMD command gives you server-side. In addition to the RCMD server-side FTP command, there are several other server-side commands supported by the OS/400 FTP server. A partial list of these is shown in Table 6.2. These include commands to create a library or physical file and commands to provide information about an object or objects on the server or about the server itself.
Table 6.2: OS/400 FTP Server Side Commands
ABOR ADDM FILE(library/file) MBR(member) ADDV FILE(library/file) MBR(member) APPE (file name) CDUP CRTL (library name) CRTP FILE(Library/file) RCDLEN(80) MAXMBRS(*NOMAX) CRTS FILE(Library/file) CWD DELE library/file.member DLTF DLTL LIST (library/file.member)
End a data transfer in process. Add a member to a physical file.
Add a variable length member to a physical file.
Append to a file if one exists. Move current directory to parent directory. Create a library. Create a physical file.
Create a source physical file. Change the default library. Delete a file member. Delete a file. Delete a library. Provide information about a specific object or objects in a specified library.
- ftp file transfer protocol indigo
- install sftp server windows 7 wordpress com
- streaming media players images bestbuy com
- content spiceworksstatic com
- pdf ipad manual file transfer app pc wordpress com
- ftp file transfer and more media techtarget com
- ssh explained newfdawg com
- wordpress for developers custom themes crack ajax com
- streaming media
- bit weebly com
- pdf ftp streaming s campbellsci com
- ftp server sod help support alarisworld com
- ftp the file transfer protocol southrivertech com
- ftp server using mcf51cn family and freertos
- ftp server download warez files e com
- bailey401 home
- evaluation rubric for science powerpoint presentation
- program requirements new york legal education
- mardi gras franklin institute
- agent authorization limited power of attorney