24
Wed, Apr
0 New Articles

FTP in the Batch Environment

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

As long as personal computers and IBM midrange systems have coexisted in the business world, there has been a need to transfer files. Ever since personal computers were first introduced, end-users, impressed by the power the PC put at their fingertips, have longed to access the golden nuggets of information stored in midrange boxes. One phrase resounded inside their heads: Think of all the slicing and dicing that I could do!

Unfortunately, the treasured data seemed forever locked away in the midrange box, doled out only grudgingly by a back-logged MIS department. Data was usually delivered in the form of paper reports that had to be retyped into the PC.

Then IBM came to the rescue with a product called PC Support (now known as Client Access/400), which provided a link between the personal computer and the IBM midrange computer. Files could now be downloaded to a PC, where the end users could fiddle with them to their hearts’ content. All was right with the world.

A lot has happened since those early days of file transfer. Client/server technology has opened a whole new world of interaction between the PC and the AS/400, but there are still many situations in which a good old-fashioned file download fits the bill.

FTP versus Client Access Download

I have long relied on Client Access/400’s download function whenever I needed to transfer a file from the AS/400 to a PC. Then, a scenario arose in which I had to use the File Transfer Protocol (FTP) command included in AS/400 TCP/IP. I was pleased to find that this method had several advantages over Client Access/ 400 download:

• Speed—FTP is much faster than traditional downloads.
• Cross-platform Interoperability—Files may be transferred to DOS, Windows, Macintosh, Unix, OS/2, or even other AS/400 systems.


• No Router Program Needed—Client Access/400 downloads require a router program to be loaded. FTP does not rely on a router program, which can lose connection to the AS/400 if the system is taken down.

What is FTP?

FTP is a program that was first developed in the early 1970s for transferring files on the Internet and implemented on host computers at the Massachusetts Institute of Technology. It has undergone many changes since that time, and today it is the predominant method for Internet file transfer.

In an FTP session, there is an FTP server and an FTP client. Once a session is established, the client can transfer files to and from the host. (Actually there are two connections established between the client and the host, one to request services from the server via subcommands and one to actually transfer data.)

FTP on the AS/400

In order to use the AS/400 FTP application, TCP/IP must be configured for your AS/400. This article will not go into the specifics of configuring TCP/IP, but thorough instructions and an explanation of TCP/IP networks is contained in the IBM manual AS/400 TCP/IP Configuration and Reference (SC41-3420-00).

The AS/400 can be used as either an FTP client or server, but we will focus on using the AS/400 as an FTP client.

Before you can transfer files with an FTP server, you must first know the name or IP address of the server and a user ID and password (if required). Many universities, government agencies, companies, and private individuals have set up publicly accessible “anonymous” FTP servers that do not require a user ID or password. FTP server software must be running on the remote system.

The FTP client program is started on the AS/400 by entering either FTP or STRTCPFTP (Start TCP/IP File Transfer) at the command line. Pressing F4 to display the command parameters will present the display in Figure 1.

Let’s take a brief look at the parameters:
• Remote System—This can either be the name of the FTP server or *INTNETADR if you are specifying an Internet address. If you frequently connect to the same server, the server name can be entered into the TCP/IP host table with the Add TCP/IP Host Table Entry (ADDTCPHTE) command. You can then use the server name in the FTP command, and it will not be necessary to remember the Internet address.

• Internet Address—This parameter is used if *INTNETADR is entered for the Remote system parameter. The Internet address is usually four groups of numbers separated by periods.

• Coded Character Set Identifier—This is the number of the character set used when the transferred file is translated from EBCDIC to ASCII. *DFT specifies the default character set (ISO 8859-1 8-bit ASCII).

• Outgoing EBCDIC/ASCII Table/ Library and Incoming ASCII/ EBCDIC Table/Library—These parameters are used if you are using a custom table for translating the files to or from ASCII and EBCDIC. The tables tell FTP to translate a specific character on the host system to another specific character on the target system. (For instance, you could tell FTP to make all double quotes in the AS/400 source file into single quotes on the target file.) The default of *CCSID is usually sufficient.

When you press the Enter key, a connection is established with the remote FTP server. You will be prompted to enter the user ID and password, if required. You will


then be presented with a command line on which you can issue FTP subcommands to the remote server.

You will need to understand some of the more commonly used FTP subcommands and their meanings:

• OPEN—Connect to another FTP server from within an FTP session.
• CLOSE—Disconnect from an FTP server from within an FTP session (without ending the session).

• QUIT—Disconnect from all connected FTP servers and end the FTP session.

• PUT—Transfer a file from the AS/400 client to the FTP server. This subcommand is in the format:

PUT library/file.member target file name
• GET—Retrieve a file from the remote server to the AS/400 client.
• CD—Change the current directory on the remote FTP server.
• DIR—List the files in the current directory of the remote FTP server.
• USER—Send your user ID (logon) to the remote FTP server.
• PWD—Send your password to the remote FTP server.
• EBCDIC—Changes the default transfer type from ASCII to EBCDIC. This is useful when transferring files from one AS/400 to another.

A complete list of FTP subcommands can be viewed by keying HELP on the FTP command line. Help text for a particular subcommand can be viewed by typing a question mark (?) followed by the subcommand on the FTP command line.

FTP takes care of all character translation for the transferred files. AS/400 files transferred to a remote PC are translated to nondelimited ASCII files.

Running FTP in Batch

In addition to running in an interactive session, FTP can also be run in a batch session. When running an FTP batch session, commands are read from an AS/400 source file. The results of each command to the remote system are also logged to a file that can be scanned for errors. Figure 2 is an example of a source file containing FTP subcommands for a batch session.

Following is a brief explanation of the file:
• 0001.00—This line contains the user ID (logon) and password for the remote FTP server.

• 0002.00—This line contains the command to transfer the file called MYFILE in library QGPL to file MYFILE on the remote server.

• 0003.00—This line ends the FTP batch session and disconnects from the remote server.

A CL program can now be created to run the commands in our example source file member. Figure 3 shows an example of a CL program which will process our source file.

Here are the details of the CL program that will process our source file, shown Figure 3:

• 0002.00—The OVRDBF commands overrides the FTP input file to our source file shown in Figure 2.

• 0003.00—The OUTPUT source file member FTPLOG contains the logged messages from our batch FTP session.

• 0004.00—The FTP command establishes a connection with the remote FTP server.


After the program is run, source file member FTPLOG will contain the logged messages from the FTP session. Figure 4 show an example of an FTP log file from our batch session.

If you have a need to schedule file transfers to run unattended, the FTP CL program can be submitted to a job queue to run at a scheduled date and time.

In today’s world, the need to communicate and transfer files between diverse systems is steadily growing. The FTP file transfer application, that workhorse of the Internet, provides an easy, dependable method for filling that need.

Figure 1: Starting FTP with STRTCPFTP Command Figure 2: Sample FTP Source Figure 3: CL Program to Process FTP Source


FTP_in_the_Batch_Environment04-00.jpg 450x223

FTP_in_the_Batch_Environment04-01.jpg 450x86

FTP_in_the_Batch_Environment04-02.jpg 450x98

FTP_in_the_Batch_Environment05-00.jpg 450x231

Figure 4: FTP Log File


BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: