iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

44
More information on www.t ylogix.com iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

Transcript of iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

Page 1: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

iSeries FTP made easy

Thibault Dambrine, owner, TYLOGIX Consulting Inc.

Page 2: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

Webcast schedule

Today’s 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 Q&A 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.

Page 3: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

Technical FAQs

Here are answers to the most common technical problems users encounter during a webcast: Q: Why can’t 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. You’ll 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/

 

Page 4: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

iSeries FTP made easy

Thibault Dambrine, owner, TYLOGIX Consulting Inc.

Page 5: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

FTP 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.

Page 6: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

FTP conversation diagram

SERVERCLIENT

FTP

TCP

IP

Network Link & Hardware

FTP

TCP

IP

Network Link & Hardware

Page 7: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

LOOPBACK 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

Page 8: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

ASCII 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

Page 9: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

Three types of transfersASCII

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

Page 10: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

A 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

Page 11: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

Opening FTP screen:

FTP LOOPBACK initial screenFile 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):===>________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

F3=Exit F6=Print F9=Retrieve

F17=Top F18=Bottom F21=CL command line

Page 12: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

The 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)

Page 13: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

File naming convention when using FTP

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.

Windows/NT/UNIX: PATH\FILE.EXTENSION

AS/400: LIBRARY/FILE.MEMBER

Page 14: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

PUT/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.extensionlibrary/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

Page 15: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

Practical (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 LOOPBACKor FTP REMOTEor FTP IP-Address

Page 16: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

FTP 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. > 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. > 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. ===>________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ F3=Exit F6=Print F9=Retrieve

F17=Top F18=Bottom F21=CL command line

Page 17: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

FTP 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.

Page 18: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

FTP 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

Page 19: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

FTP 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

Page 20: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

Creating 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

Page 21: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

FTP 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

Page 22: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

Simple FTP program: 3 commands

*************** 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.000011.00 DLTOVR FILE(INPUT OUTPUT) 0012.00 0013.00 ENDPGM ****************** End of data **********

The most basic CL program to execute an FTP command will have the following components:

Page 23: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

Automation 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 parametersAn RPG/C/COBOL program to read the OUTPUT file

and review/report the results of the FTP operation

Page 24: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

Flexibility in automation: PGMS & PARMSPGM 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 FTPLOGfile and verify that the FTP result is successful */

DLTOVR FILE(INPUT OUTPUT)ENDPGM

Page 25: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

Real-life experience:Successful 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

Page 26: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

FTP 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

Page 27: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

FTP 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 > 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 > 000019 Enter an FTP subcommand.000020 > EBCDIC 000021 200 Representation type is EBCDIC nonprint. 000022 Enter an FTP subcommand. 000023 >

Page 28: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

FTP output for a successful transfer (2 of 2)

FTPOUTPUT 000024 Enter an FTP subcommand. 000025 > STRUCT R 000026 250 Data structure is record. 000027 Using structure R to transfer files. 000028 Enter an FTP subcommand. 000029 > 000030 Enter an FTP subcommand. 000031 > 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 > 000038 Enter an FTP subcommand.000039 > QUIT 000040 221 QUIT subcommand received.

Page 29: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

Member missing or wrong memberunsuccessful transfer

Note the File and Member Combinations in the INPUT file

Note the Reply Codes in the OUTPUT file

Page 30: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

FTP input for an unsuccessful transfer

FTPINPUT

000001000002 USER CATDA7 MYPASWRD000003000004 EBCDIC000005000006 STRUCT R000007000008 PUT CATDA7/F0911TD CATDA7/F0911NEW 000009000010 QUIT

Page 31: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

FTP 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 > 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 > 000019 Enter an FTP subcommand. 000020 > EBCDIC 000021 200 Representation type is EBCDIC nonprint. 000022 Enter an FTP subcommand. 000023 >

Page 32: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

FTP output for an unsuccessful transfer (2 of 2)

FTPOUTPUT 000024 Enter an FTP subcommand. 000025 > STRUCT R 000026 250 Data structure is record. 000027 Using structure R to transfer files. 000028 Enter an FTP subcommand. 000029 > 000030 Enter an FTP subcommand. 000031 > PUT CATDA7/F0911TD CATDA7/F0911NEW 000032 Member F0911TD in file F0911TD in library CATDA7 not found. 000033 Enter an FTP subcommand. 000034 > 000035 Enter an FTP subcommand. 000036 > QUIT000037 221 QUIT subcommand received

Page 33: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

Unrecognized user profile unsuccessful transfer

Note the positioning of the USER/PASSWORD Combination in the INPUT file

Note the Reply Codes in the OUTPUT file

Page 34: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

FTP 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

Page 35: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

FTP input with user profile unrecognized

FTPINPUT

000001 USER CATDA7 MYPASWRD000002 000003 EBCDIC000004 000005 STRUCT R000006 000007 PUT CATDA7/F0911TD.F0911 CATDA7/F0911NEW.NEWMBR 000008000009 QUIT

Page 36: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

FTP 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 >000010 Enter an FTP subcommand. 000011 > EBCDIC000012 200 Representation type is EBCDIC nonprint. 000013 Enter an FTP subcommand. 000014 >000015 Enter an FTP subcommand. 000016 > STRUCT 000017 250 Data structure is record. 000018 Using structure R to transfer files. 000019 Enter an FTP subcommand.

Page 37: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

FTP output for unrecognized user (2 of 2)

FTPOUTPUT 000020 >000021 Enter an FTP subcommand. 000022 > PUT CATDA7/F0911TD.F0911 CATDA7/F0911NEW.NEWMBR 000023 You must first issue the USER subcommand. 000024 Enter an FTP subcommand. 000025 >000026 Enter an FTP subcommand. 000027 > QUIT

000028 221 QUIT subcommand received.

Page 38: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

The 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 system’s command (i.e. for RCMD), type QUOTE RCMD HELP

Note: The AS/400 has a 1,000 character limit on a Quote command

Page 39: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

Typical use for the QUOTE Command after a PUT

FTPINPUT

000001 000002 USER CATDA7 MYPASWRD 000003000004 EBCDIC 000005 000006 STRUCT R 000007 000008 PUT LOCLIB/F0911TD.F0911 REMLIB/F0911NEW.NEWMBR 000009000010 QUOTE RCMD CALL PROCESSPGM000011 000012 QUIT

Page 40: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

Typical use for the QUOTE Command before a GET

FTPINPUT

000001 000002 USER CATDA7 MYPASWRD 000003 000004 QUOTE RCMD CALL GATHERPGM000005 000006 EBCDIC 000007 000008 STRUCT R 000009 000010 GET REMLIB/F0911TD.F0911 LOCLIB/F0911NEW.NEWMBR 000011 000012 QUIT

Page 41: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

Beef up your FTP security with EXIT programs (1 of 3)

FTP request from the outside world

Access to the

file serverfile

system

User- Defined

Exit Program (will receive parameters and act as a

gate, allowingor not the

FTPrequest

to proceed)

Your AS/400 Server

User-defined FTP securityparameters

Page 42: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

Beef up your FTP security with EXIT programs (2 of 3)

1) Application ID (FTPClient for example)2) Operation ID (Sending a file for example)3) User profile4) Remote IP address5) Length of remote IP address6) Operation 7) Length of operation8) Allow Operation (this value when returned will determine if the operation will be allowed)

Typically, an FTP Exit program will receive the following parameters and will decide with a return value if the operation is allowed.

Page 43: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

Beef 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

Page 44: iSeries FTP made easy Thibault Dambrine, owner, TYLOGIX Consulting Inc.

More information on www.tylogix.com

Questions?

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.