Title: iSeries FTP made easy
1iSeries FTP made easy
- Thibault Dambrine, owner, TYLOGIX Consulting Inc.
2Webcast schedule
- Todays event will be one hour long. Here are
the expected times for each segment of the
webcast -
- 00 05 Moderator introduces the speaker and
discusses the details of the webcast. - 05- 35 Speaker delivers a PowerPoint
presentation on the webcast topic. -
- 35- 60 Moderator and speaker engage in a QA
on the topic. - You can submit questions to the speaker at any
time during the event. Just click on the Ask a
Question button in the lower left corner of your
screen.
3Technical FAQs
- Here are answers to the most common technical
problems users encounter during a webcast -
- Q Why cant I hear the audio part of the
webcast? - A Try increasing the volume on your computer.
- Q I just entered the webcast and do not see the
slide that the speaker is referring to. What
should I do? - A The slides are constantly be pushed to your
screen. Youll should refresh (hit F5) to view
the latest slide. -
- If your question is still not answered, please
click the Ask a Question button in the lower
left corner of your screen and submit your
problem. A technical support person will respond
immediately. - You can also visit the Broadcast Help page for
more information or to test your browser
compatibility. Click here http//help.yahoo.com/
help/bcst/ -
4iSeries FTP made easy
- Thibault Dambrine, owner, TYLOGIX Consulting Inc.
5FTP client/server considerations
- FTP consists of two parts the Client and the
Server. - The distinction between FTP client and FTP server
is from the viewpoint of where the FTP commands
are initiated, not from the viewpoint of where
the data resides. - The files being transferred may initially reside
on either system.
6FTP conversation diagram
SERVER
CLIENT
FTP
TCP
IP
Network Link Hardware
7LOOPBACK Address
- With FTP, you can actually be your own Client and
Server, using the well-known address called
LOOPBACK. This is the equivalent of a local
controller in the APPC world - When you FTP to LOOPBACK, FTP will connect to
your own system using address 127.0.0.1. - The 127.0.0.1 address is consistent for ALL
implementations of FTP, the LOOPBACK handle for
127.0.0.1 is consistent for MOST implementations.
- Practical for testing applications
8ASCII vs. EBCDIC
- EBCDIC is used nearly exclusively in IBM machines
(stands for Extended Binary Coded Decimal
Interchange Code) - ASCII is used by the rest of the world (stands
for American Standard Code for Information
Interchange) - FTP has to work with both
- Conversion from ASCII to EBCDIC and back can be
done with a translation table - Note the numeric data has to be ZONED
- Note ASCII and EBCDIC are single byte
character sets
9Three types of transfers
- ASCII
- Use if you want to purposely translate your data
to ASCII - for example when the target system is
a PC or a UNIX machine - EBCDIC
- Use if you want to purposely maintain EBCDIC
Coding - for example when the target system is an
IBM 390 or an other AS/400 - BINARY
- Use if you want to preserve the original content
of the file and ensure NO translation takes place
in the transfer of data. For example when
transferring a SAVF or a graphic image
10A very basic FTP application
- When using FTP, the user will perform some or
all of the following operations - Connect to a remote host
- Define the transfer mode
- Copy files to or from the remote host
11Opening FTP screen FTP LOOPBACK initial screen
File Transfer Protocol
Previous FTP subcommands and messages
Connecting to host LOOPBACK at address
127.0.0.1 using port 21. 220-QTCP at LOOPBACK.
220 Connection will close if idle more than 5
minutes.
Enter login ID
(catda7) gt____________________________________
_____________________________ ____________________
_________________________________________________
__________________________________________________
___________________ ______________________________
_______________________________________ F3Exit
F6Print F9Retrieve F17Top
F18Bottom F21CL command line
12The HELP command What can you do with FTP?
.................................................
.................. FTP
Client Subcommands - Help
!______ ?______ ACCT___
APpend_ AScii__ Binary_ CD_____
CDUp___ CLose__ DEBug__ DELete_
DIr____ EBcdic_ Get____ Help___
LCd____ LOCSIte LOCSTat LPwd___
LS_____ LType__ MDelete MGet___
MKdir__ MOde___ MPut___ NAmefmt
NOop___ Open___ PAss___ PUt____
PWd____ QUIt___ QUOte__
REInitialize______ REName_ RESet__
RMDir__ SENDPAsv__________
SENDPOrt__________ SENDSite__________
SIte___ STAtus_ STRuct_ SUnique
SYSCmd_ SYSTem_ TYpe___ User___
Verbose
................................
...................................
Note the short-cut commands (capitalized)
13File naming convention when using FTP
Windows/NT/UNIX PATH\FILE.EXTENSION
AS/400 LIBRARY/FILE.MEMBER
- If you want to target or replace a particular
member with FTP, you can do so by adding the
member in the command. - Note In the AS/400 system LIBRARY, FILE and
MEMBER names can only be a maximum of 10
characters or fewer. - Unix, Windows-based systems do not have these
restrictions. File naming conventions may be a
consideration when you build FTP automated
applications.
14PUT/GET FTP bread butter
- Typical PUT and GET instructions from an
AS/400 to an NT server could read as - Put library/file.member directory\file.extension
- Get directory\file.extension library/file.member
(replace - Note
- The (replace in the Get example has no right
bracket. - You can do a Put or a Get using well-known
address LOOPBACK
15Practical (manual) experimenting with FTP
- On your own system, connected or not, you can FTP
to your own location by using the well-known
address LOOPBACK - First step to FTP, type
- FTP LOOPBACK
- or
- FTP REMOTE
- or
- FTP IP-Address
16FTP Put example using LOOPBACK
Previous FTP subcommands and messages
Connecting to
host LOOPBACK at address 127.0.0.1 using port 21.
220-QTCP at LOOPBACK.
220
Connection will close if idle more than 5
minutes. gt catda7
331 Enter password.
230
CATDA7 logged on.
OS/400 is the remote
operating system. The TCP/IP version is "V4R3M0".
250 Now using naming format "0".
257
"CATDA7" is current library.
gt put catda7/f0911td.f0911
catda7/f0911tst
227 Entering Passive Mode (127,0,0,1,4,115).
150 Sending file to member F0911TST in file
F0911TST in library CATDA7. 250
File transfer completed successfully.
2862 bytes
transferred in 0.198 seconds. Transfer rate
14.437 KB/sec.
gt_____________________________________________
__________________________ _______________________
__________________________________________________
__ _______________________________________________
____________________________ _____________________
__________________________________________________
____
F3Exit
F6Print F9Retrieve
F17Top F18Bottom F21CL
command line
17FTP reply codes
- 1yz - Positive Preliminary The requested action
is being initiated, another reply should follow. -
- 2yz - Positive Completion The requested action
was successfully completed. A new request may
be initiated. - 3yz - Positive Intermediate The command was
accepted, but the requested action is being held,
pending receipt of further information. - 4yz - Transient Negative Completion The command
was not accepted and the requested action did not
take place, but the error condition is temporary
and the action may be requested again. - 5yz - Permanent Negative Completion The command
was not accepted and the requested action did not
take place.
18FTP reliability recovery considerations
- FTP DOES NOT provide re-transmission services if
the transmission was interrupted. This has to be
done with logic in a program if you want to do
it. - FTP DOES NOT encrypt data when it transmits it
- For those and other more sophisticated types of
data transfers, options such as MQ Series, Tuxedo
and others are probably better options
19FTP automation 101 What you will need
- A physical file to contain the command to execute
- (INPUT)
- A physical file to receive the result of your
FTP request (OUTPUT) - A CL program to execute the command
20Creating an FTP input file
- A typical FTP input file would contain the
following instructions - USER USERNAME PASSWORD
- ASCII or EBCDIC or BINARY
- PUT LIBRARY/FILE PATH\FILE
21FTP sample input file
FTPINPUT 000001
000002 USER CATDA7 MYPASWRD
000003
000004
EBCDIC
000005
000006 STRUCT R
000007
000008 PUT
CATDA7/F0911TD.F0911 CATDA7/F0911NEW.NEWMBR
000009
000010 QUIT
22Simple FTP program 3 commands
- The most basic CL program to execute an FTP
command will have the following components
Beginning of data 0001.00
PGM
0003.00
0004.00 OVRDBF FILE(INPUT)
TOFILE(FTPCMD) 0005.00
0006.00 OVRDBF
FILE(OUTPUT) TOFILE(FTPLOG) 0008.00
0009.00 FTP
RMTSYS(LOOPBACK)
0010.00 0011.00 DLTOVR FILE(INPUT OUTPUT)
0012.00
0013.00 ENDPGM End of
data
23Automation 102 Enhancing your automated FTP
program
- The three original components remain
- The INPUT file
- The OUTPUT file
- The CL
- We will add
- An RPG/C/COBOL program to customize the INPUT
file with parameters - An RPG/C/COBOL program to read the OUTPUT file
and review/report the results of the FTP
operation
24Flexibility in automation PGMS PARMS
PGM PARM (FILE SRCPATH DESTPATH USRPRF
REMOTESYS SUCCESS) DCL VAR(FILE)
TYPE(CHAR) LEN(10) DCL
VAR(SRCPATH) TYPE(CHAR) LEN(30) DCL
VAR(DESTPATH) TYPE(CHAR) LEN(30) DCL
VAR(USRPRF) TYPE(CHAR) LEN(20) DCL
VAR(REMOTESYS) TYPE(CHAR) LEN(10) DCL
VAR(SUCCESS) TYPE CHAR) LEN(1) CALL
FTPCMDPGM PARM(FILE SRCPATH DESTPATH USRPRF
) / Program to modify the contents of
FTPCMD based on parameter / OVRDBF
FILE(INPUT) TOFILE(FTPCMD) OVRDBF
FILE(OUTPUT) TOFILE(FTPLOG) FTP REMOTESYS
/ Execute the FTP Command / CALL
FTPMONITOR PARM(SUCCESS) / Program to read the
FTPLOG file and verify that the FTP result is
successful / DLTOVR FILE(INPUT OUTPUT) ENDPGM
25Real-life experienceSuccessful transfer
- Note the positioning of the USER/PASSWORD
Combination in the INPUT file - Note the File and Member Combinations in the
INPUT file - Note the Reply Codes and where they are in
relation to the commands in the OUTPUT file
26FTP input for a successful transfer
FTPINPUT 000001
000002 USER CATDA7 MYPASWRD
000003
000004
EBCDIC
000005
000006 STRUCT R
000007
000008 PUT
CATDA7/F0911TD.F0911 CATDA7/F0911NEW.NEWMBR
000009
000010 QUIT
27FTP output for a successful transfer (1 of 2)
FTPOUTPUT
000001 Output redirected
to a file.
000002 Input read from specified override
file. 000003
Connecting to host LOOPBACK at address 127.0.0.1
using port 21. 000004 220-QTCP at LOOPBACK.
000005 220 Connection will close if idle more
than 5 minutes. 000006 Enter
login ID (catda7)
000007 331 Enter password.
000008 OS/400 is the remote operating system.
The TCP/IP version is "V4R3M0". 000009 250 Now
using naming format "0".
000010 Enter an FTP subcommand.
000011 gt USER CATDA7
000012 331 Enter
password. 000013 230 CATDA7 logged on. 000014
OS/400 is the remote operating system. The TCP/IP
version is "V4R3M0". 000015 250 Now using
naming format "0".
000016 257 "CATDA7" is current library.
000017
Enter an FTP subcommand.
000018 gt
000019 Enter an FTP subcommand. 000020 gt
EBCDIC
000021 200 Representation
type is EBCDIC nonprint.
000022 Enter an FTP subcommand.
000023 gt
28FTP output for a successful transfer (2 of 2)
FTPOUTPUT
000024 Enter an FTP
subcommand.
000025 gt STRUCT R
000026
250 Data structure is record.
000027 Using structure R
to transfer files.
000028 Enter an FTP subcommand.
000029 gt
000030 Enter an FTP subcommand.
000031 gt PUT CATDA7/F0911TD.F0911
CATDA7/F0911NEW.NEWMBR
000032 227 Entering Passive Mode
(127,0,0,1,5,9).
000033 150 Sending file to member NEWMBR in file
F0911NEW in library CATDA7. 000034 250 File
transfer completed successfully.
000035 5193 bytes transferred in
0.326 seconds. Transfer rate 15.921 KB/sec.
000036 Enter an FTP subcommand.
000037 gt
000038 Enter an FTP
subcommand. 000039 gt QUIT
000040 221 QUIT subcommand received.
29Member missing or wrong memberunsuccessful
transfer
- Note the File and Member Combinations in the
INPUT file - Note the Reply Codes in the OUTPUT file
30FTP input for an unsuccessful transfer
FTPINPUT 000001 000002 USER CATDA7
MYPASWRD 000003 000004 EBCDIC 000005 000006
STRUCT R 000007 000008 PUT CATDA7/F0911TD
CATDA7/F0911NEW 000009 000010 QUIT
31FTP output for an unsuccessful transfer (1 of 2)
FTPOUTPUT
000001 Output redirected to a file.
000002
Input read from specified override file.
000003 Connecting
to host LOOPBACK at address 127.0.0.1 using port
21. 000004 220-QTCP at LOOPBACK.
000005 220 Connection will close if idle
more than 5 minutes.
000006 Enter login ID (catda7)
000007 331
Enter password.
000008 OS/400 is the
remote operating system. The TCP/IP version is
"V4R3M0". 000009 250 Now using naming
format "0".
000010 Enter an FTP subcommand.
000011 gt USER CATDA7
000012 331
Enter password.
000013 230 CATDA7
logged on.
000014 OS/400 is the remote
operating system. The TCP/IP version is "V4R3M0".
000015 250 Now using naming format "0".
000016 257 "CATDA7" is current library.
000017
Enter an FTP subcommand.
000018 gt
000019 Enter an FTP
subcommand. 000020 gt EBCDIC
000021 200
Representation type is EBCDIC nonprint.
000022 Enter an FTP subcommand. 000023 gt
32FTP output for an unsuccessful transfer (2 of 2)
FTPOUTPUT 000024
Enter an FTP subcommand.
000025 gt STRUCT R
000026 250 Data structure is record.
000027 Using structure R to transfer
files. 000028 Enter an FTP subcommand.
000029 gt
000030 Enter an FTP
subcommand. 000031 gt PUT
CATDA7/F0911TD CATDA7/F0911NEW
000032 Member F0911TD in file F0911TD in
library CATDA7 not found. 000033 Enter an FTP
subcommand.
000034 gt
000035 Enter an FTP
subcommand.
000036 gt QUIT 000037 221 QUIT subcommand received
33Unrecognized user profile unsuccessful transfer
- Note the positioning of the USER/PASSWORD
Combination in the INPUT file - Note the Reply Codes in the OUTPUT file
34FTP input for a successful transfer(Reminder)
FTPINPUT 000001
000002 USER CATDA7 MYPASWRD
000003
000004
EBCDIC
000005
000006 STRUCT R
000007
000008 PUT
CATDA7/F0911TD.F0911 CATDA7/F0911NEW.NEWMBR
000009
000010 QUIT
35FTP input with user profile unrecognized
FTPINPUT 000001 USER CATDA7 MYPASWRD 000002
000003 EBCDIC 000004
000005 STRUCT R 000006
000007 PUT CATDA7/F0911TD.F0911
CATDA7/F0911NEW.NEWMBR 000008 000009 QUIT
36FTP output for unrecognized user (1 of 2)
FTPOUTPUT
000001 Output
redirected to a file.
000002 Input read from specified
override file.
000003 Connecting to host LOOPBACK at address
127.0.0.1 using port 21. 000004 220-QTCP at
LOOPBACK.
000005 220 Connection will close if idle
more than 5 minutes. 000006 Enter login ID
(catda7)
000007 Number of arguments for a prompted
login to the server not correct. 000008 Enter
an FTP subcommand. 000009 gt 000010 Enter an FTP
subcommand. 000011 gt EBCDIC 000012 200
Representation type is EBCDIC nonprint. 000013
Enter an FTP subcommand. 000014 gt 000015 Enter
an FTP subcommand. 000016 gt STRUCT 000017 250
Data structure is record. 000018 Using structure
R to transfer files. 000019 Enter an FTP
subcommand.
37FTP output for unrecognized user (2 of 2)
FTPOUTPUT
000020 gt 000021
Enter an FTP subcommand. 000022 gt PUT
CATDA7/F0911TD.F0911 CATDA7/F0911NEW.NEWMBR
000023 You must first issue the USER subcommand.
000024 Enter an FTP subcommand. 000025 gt 000026
Enter an FTP subcommand. 000027 gt QUIT 000028
221 QUIT subcommand received.
38The Quote Command in the AS/400
- The Quote Command allows you to run commands on
the remote system you are FTP-ing to. - To get the syntax of the QUOTE command, type in
- HELP QUOTE
- To get the list of the commands supported via
QUOTE on the remote system, type in QUOTE HELP - Most useful QUOTE command RCMD (Remote Command)
- To get help on any of the remote systems command
(i.e. for RCMD), type QUOTE RCMD HELP - Note The AS/400 has a 1,000 character limit on a
Quote command
39Typical use for the QUOTE Command after a PUT
FTPINPUT 000001
000002 USER CATDA7 MYPASWRD
000003 000004 EBCDIC
000005
000006 STRUCT R
000007
000008 PUT
LOCLIB/F0911TD.F0911 REMLIB/F0911NEW.NEWMBR
000009 000010 QUOTE RCMD CALL PROCESSPGM 000011
000012 QUIT
40Typical use for the QUOTE Command before a GET
FTPINPUT 000001
000002 USER CATDA7 MYPASWRD
000003 000004 QUOTE
RCMD CALL GATHERPGM 000005
000006 EBCDIC
000007
000008 STRUCT R 000009
000010 GET REMLIB/F0911TD.F0911
LOCLIB/F0911NEW.NEWMBR 000011 000012 QUIT
41Beef up your FTP security with EXIT programs (1
of 3)
Your AS/400 Server
User- Defined Exit Program (will receive
parameters and act as a gate, allowing or not
the FTP request to proceed)
User-defined FTP security parameters
FTP request from the outside world
Access to the file server file system
42Beef up your FTP security with EXIT programs (2
of 3)
Typically, an FTP Exit program will receive the
following parameters and will decide with a
return value if the operation is allowed.
1) Application ID (FTPClient for example) 2)
Operation ID (Sending a file for example) 3) User
profile 4) Remote IP address 5) Length of remote
IP address 6) Operation 7) Length of
operation 8) Allow Operation (this value when
returned will determine if the operation will be
allowed)
43Beef up your FTP security with EXIT programs (3
of 3)
- Where are EXIT programs accessed on the AS/400?
- WRKREGINF displays a list of the various system
exit points - What is the ID of the FTP Exit point?
- The Exit point for FTP is QIBMQTMF_SVR_LOGON.
This is where you specify a user-built program
that is called every time a user tries to log on
to your AS/400 via FTP
44Questions? Submit your questions now by
clicking on on the Ask A Question button in the
left corner of your presentation
screen.Thibault will answer your questions
off-line. The questions and answers will then be
posted on Search400.com. We will e-mail you when
your question has been answered.