Home > AS/400 Tips > iSeries programmer tips > Trigger handles shortcomings of FTP on the iSeries
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES PROGRAMMER TIPS

Trigger handles shortcomings of FTP on the iSeries


Michael Rooney
09.04.2003
Rating: -3.89- (out of 5) Hall of fame tip of the month winner


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Having written an "automated" FTP command for the AS/400 in 1996, I read Tim Granatir's recent FTP tip with considerable interest. While the approach taken in Tim's tip was similar to mine -- and numerous others -- it doesn't address two of the biggest shortcomings of FTP on the iSeries. For one, the ability to dynamically generate a JOBLOG from each/every FTP client session. More than that, how can you immediately terminate an FTP session when a recognizable error condition occurs? The answer: a trigger.

As FTP writes its standard output (STDIO) to file OUTPUT, it is entirely possible to attach a database trigger to OUTPUT, where by, the triggered program "receives" the contents of the record being added to OUTPUT. The triggered program can then interpret the record for recognizable FTP error conditions. As the triggered program executes in the same program/invocation stack as the FTP process, the triggered program, upon identifying a valid FTP error condition, can issue a CPC2402 *ESCAPE message. This terminates the FTP client session immediately.

The attached .ZIP file contains my "twist" on automating FTP on the iSeries. While very similar to Tim's, I provide for immediate termination of FTP client sessions and the "echoing" of FTP Client subcommands and responses to the jobs JOBLOG. The following summarizes the components in the .ZIP file:

STRFTP -- Command line interface.

STRFTPCL -- STRFTP command processing program; creates required files in QTEMP, adds trigger and performs other trivial, yet essential tasks.

WRTSRCDTA -- Like Tim's FTP15R, it writes entry for each FTP command supplied to STRFTP.

FTPERRORS -- Triggered program; like Tim's FTP200c, it processes each STDIO record written monitoring for specific FTP errors; also uses OS/400 API's to "echo" FTP commands/responses to JOBLOG.

FTPERRORS2 -- Similar to FTPERRORS, performs second pass through STDIO output file to handle use of SYSCMD, SYSC and "!" subcommands. As this was written in 1996, I can't remember why but I think it had/has something to do with the lack of uniform standards of functions across FTP implementations.

APIERRORS -- DDS defining OS/400's API error Data Structure. Currently implemented as External DS, but not required. It's simply a matter of personal preference.

Download the file.

==================================
MORE INFORMATION
==================================

  • Fast guide to Redbooks and articles on FTP for the iSeries
    Need information fast on FTP for the iSeries? Take a look at these publications. We've found Redbooks, articles and FAQs for everyone from novice users to experienced pros.
  • FTP tips you might not know about
    FTP is a necessity when transferring files to and from the iSeries. Site expert Tim Granatir provides a collection of miscellaneous FTP tips that address such subjects as the batch FTP process, logging FTP results to a file and getting to the Integrated File System. Check them out and see if there's anything you can add to your bag of tricks.
  • Webcast: iSeries FTP automation made easy
    How do you automate an FTP function? How do you go about creating a process to transfer a different file every day to different systems, the same file to different destinations or a combination of both? Thibault Dambrine shows you how easy it can be.


Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
iSeries programmer tips
Enhancing RPG with external SQL stored procedures
Tracking data changes on IBM i with triggers
Introduction to SQLRPGLE on IBM i: Making a report
Implementing a browser interface in COBOL: Displaying database fields
Taking advantage of CL advancements, starting with V5R3
TAATOOL: Useful tools for programmers on IBM i
Implementing a browser interface in COBOL: Creating your graphic Web page
Implementing a browser interface in COBOL: Getting started
Making the most of RPG data handling on IBM i
Groovy programming on IBM i

iSeries Networking
CA Express utility helps you manage SSL certificates
20 FTP tips in 20 minutes
The Lazy Coder: Find your iSeries using a DNS or name server
The Lazy Coder: Fun with TCP/IP
Automatically check FTP process for errors
Fast guide to Redbooks and guides on printing/output
Printing tips and tricks
Improve old iSeries communication methods
'Twas the Night Before Christmas in IT
How to FTP a physical file via iSeries modem

Application Development
iSeries calling an .exe
Top 10 programmer tips
Formatted work job scheduler
Convert system date and time
Mixing free format code with embedded SQL
SQL update a field in one file from a field in another file
Webcasts for iSeries programmers
Programming advice from the pros
Easy code copying via the drag and drop method
Setting FTP time-outs

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts