Technical Blog Post
Abstract
Enabling and Configuring FTP Communications on Director
Body
After dealing with a couple of customers who wanted to configure and use FTP comms on their system, and helping them put together the necessary files and scripts and sessions, it became clear that while there is FTP documentation available, there is no White Paper-level guide that provides a step-by-step process giving the whats and whys of FTP on Director.
Using what I had learned with these customer, I set about creating just such a guide.
Whitepaper
IBM Sterling Gentran:Director
FTP Client - Quick Start Guide
Table of Contents
Before Starting_____________________________________________________________ 2
A. Obtain FTP Server Name _________________________________________________ 4
B. Obtain FTP Credentials___________________________________________________ 4
C. Required files for FTP____________________________________________________ 4
D. Modify the FTP Send text file_____________________________________________ 4
E. Modify the FTP Receive text file___________________________________________ 5
F. Modify the FTP Send batch file____________________________________________ 6
G. Modify the FTP Receive batch file__________________________________________ 7
H. Command Flow________________________________________________________ 7
I. Process Control and Other Notes:___________________________________________ 8
J. FTP Troubleshooting:____________________________________________________ 9
Before Starting
In order to use the FTP Client with IBM® Sterling Gentran:Director®, you must install the FTP option.
The FTP Option is a selection on the Director install screens. You may have installed it already – to determine that, look for the directory C:\DirectorConnection\GENTRANFTPClient on your computer.
If that directory exists, you have already installed the FTP Option.
If that directory does NOT exist, you must re-run the Director install and select the option (recommended you select ONLY that option as shown below).
In addition to the FTP Option, you should install the several pre-packaged command script files shown below.
Using version 5.5 as example, when you unzipped Director 5.5 one of the directories was GDW_v55_FTP_Install-CI0J6EN.
Invoking Setup.exe in that directory launches InstallShield with the following screens:
Obtain FTP Server Name
The FTP server name will be used in the batch files.
The server name should be used and not an IP address. An IP address will work but is subject to change on the server side. The FTP server name should be consistent.
The server name will be in the form:
ftp.gts.globalec.com
Obtain FTP Credentials
Your connection to the FTP server will be authenticated, hence you will be required to have a userid and password to access the server
Required files for FTP
Several files are required to execute any single FTP communication instance.
Many of these files are specific to the FTP connection target (Sterling, Advantis, GM, Arrow etc.)
The example files in this quick start guide will use Arrow as the FTP target. You will change the filenames to suit your situation.
These files will reside in C:\DirectorConnection\GENTRANFTPClient
Required files:
Ceftp.bat (do not modify)
Cesftp.jar (do not modify)
ArrowFTPSend.txt
ArrowFTPReceive.txt
ArrowFTPSend.bat
Arrow FTPReceive.bat
Ancillary files for Process Control:
Backup.bat
Delete.bat
Modify the FTP Send text file
locsite unsecure
open ftp.gts.globalec.com
myuserid
mypassword
passive
cd /send
lcd "C:\DirectorConnection\FTPDataFiles\Arrow\Send"
put EDIout.dat
rename EDIout.dat commit/EDIout.dat
quit
Pause
Explanation:
locsite unsecure
Make this a one-time unsecure connection (Director does not support Secure FTP).
locsite Sets the security configuration parameters locally; overrides all other parameters.
unsecure specifies an unsecure connection; valid for only one connection; you must type another locsite unsecure subcommand (before the open subcommand) for another unsecure connection.
open ftp.gts.globalec.com
Open a connection to the FTP server.
myuserid
mypassword
Provide FTP userid and password credentials.
passive
Notifies the server of a passive data transfer mode connection.
In the active mode the client initially specifies which client-side port it has opened up for the data channel, and the server initiates the connection.
In the passive mode the server specifies which server-side port the client should connect to and the client initiates the connection.
cd /send
Changes to the /send directory on the FTP server.
lcd "C:\DirectorConnection\FTPDataFiles\Send"
Local Change Directory - changes to the directory on the local machine where the FTP data file resides.
put EDIOut.dat
FTP "put" command writes a file to the FTP location.
rename EDIOut.dat commit/EDIOut.dat
Effectively commits the write.
quit
Quit the FTP session.
Pause
Pauses the command line and gives the user an opportunity to see any errors that may have been generated, or verify the FTP went through successfully.
References:
community.hpe.com/hpeb/attachments/hpeb/itrc-156/367823/1/344232.pdf
Modify the FTP Receive text file
locsite unsecure
open ftp.gts.globalec.com
myuserid
mypassword
passive
cd /receive
lcd "C:\DirectorConnection\FTPDataFiles\Receive"
mget *
quit
locsite unsecure
Make this a one-time unsecure connection (Director does not support Secure FTP).
locsite Sets the security configuration parameters locally; overrides all other parameters.
unsecure specifies an unsecure connection; valid for only one connection; you must type another locsite unsecure subcommand (before the open subcommand) for another unsecure connection.
open ftp.gts.globalec.com
Open a connection to the FTP server.
myuserid
mypassword
Provide FTP userid and password credentials.
passive
Notifies the server of a passive data transfer mode connection.
In the active mode the client initially specifies which client-side port it has opened up for the data channel, and the server initiates the connection.
In the passive mode the server specifies which server-side port the client should connect to and the client initiates the connection.
cd /receive
Changes to the /receive directory on the FTP server.
lcd "C:\DirectorConnection\FTPDataFiles\Receive"
Local Change Directory - changes to the directory on the local machine where the FTP data files are to be written.
mget *
FTP "get" command reads a file in from the FTP location.
"mget" does multiple "gets".
Using the wildcard means to get all available files.
quit
Quit the FTP session.
Modify the Send batch file
:: FTP batch file for Gentran:Director
CALL ceftp.bat -a ArrowFtpSnd.txt -i -x -d 2 arrowsnd.log
This calls the ceftp batch file and passes the following parameters:
-a = indicates what follows is the name of the automation script file.
ArrowFtpSnd.txt = the automation script file.
-i = Turns off interactive prompting during multiple document transfers.
-x = Turns on result code exiting for the entire instance of the client.
-d = Specifies the level of debug and/or the debug file; overwritten at each FTP Option startup:
0 = Lowest debug level
1 = Connection status, send/receiving a file, security channel requested
2 = FTP commands, SSL FTP responses, and level 1 logs
3 = IPC connections (ipaddr, port #), accepts, rejects, authentication status (pass or failed) and level 2
logs
Note: If only the debug level is specified, the debug information is displayed on the screen.
2 = The desired debug level.
arrowsnd.log = the desired debug log file (can be fully qualified path, otherwise written in the same directory from which the batch file was invoked).
Modify the Receive batch file
:: FTP batch file for Gentran:Director
CALL ceftp.bat -a ArrowFtpRcv.txt -i -x -d 2 arrowrcv.log
This calls the ceftp batch file and passes the following parameters:
-a = indicates what follows is the name of the automation script file.
ArrowFtpRcv.txt = the automation script file.
-i = Turns off interactive prompting during multiple document transfers.
-x = Turns on result code exiting for the entire instance of the client.
-d = Specifies the level of debug and/or the debug file; overwritten at each FTP Option startup:
0 = Lowest debug level
1 = Connection status, send/receiving a file, security channel requested
2 = FTP commands, SSL FTP responses, and level 1 logs
3 = IPC connections (ipaddr, port #), accepts, rejects, authentication status (pass or failed) and level 2
logs
Note: If only the debug level is specified, the debug information is displayed on the screen.
2 = The desired debug level
arrowrcv.log = the desired debug log file (can be fully qualified path, otherwise written in the same directory from which the batch file was invoked).
Backup.bat
move C:\DirectorConnection\FTPDataFiles\Receive\*.* C:\DirectorConnection\FTPDataFiles\Arrow\Receive
copy C:\DirectorConnection\FTPDataFiles\Arrow\Receive\*.* C:\DirectorConnection\FTPDataFiles\Arrow\Receive\backup\
copy C:\DirectorConnection\FTPDataFiles\Arrow\Receive\*.* C:\DirectorConnection\FTPDataFiles\Receive\ReceiveFile.edi
Delete.bat
del C:\DirectorConnection\FTPDataFiles\Receive\*.* /Q
Command Flow
The sequence of calls to effect the FTP transaction in this example is:
ArrowFTPSend.bat invokes Ceftp.bat using ArrowFTPSend.txt as a command parameter
Arrow FTPReceive.bat invokes Ceftp.bat using ArrowFTPReceive.txt as a command parameter
Process Control and Other notes
The whole of the FTP transaction should be integrated in a Process Control Session and executed by a Process Control Event either manually or on a scheduled basis.
Using a Process Control Session allows the user to wrap the FTP commands in a structured flow, and to apply best practices in file management.
There is a requirement for a Communication Profile to exist for FTP that is of type File Copy and which points to the directory where the outbound FTP file will be placed.
The comm profile applies only to outbound data.
Notice the profile specifies a single file, EDIout.dat.
Until the this file is transmitted via FTP, Director will continue to concatenate outbound documents to it.
In the Process Control Session you should implement a flow similar to the following:
- Delete any existing output data file
- Initiate a send receive session using the Arrow FTP comm profile to populate EDIout.dat
- Rename the data file to move to a target-specific directory, C:\DirectorConnection\FTPDataFiles\Arrow\Send\EDIout.dat
- Execute FTP send batch file for the target
- Execute FTP receive batch file for the target
- Back up the received EDI
- Execute GDW_Process_File to invoke the translator
- Delete the received EDI (ReceiveFile.edi)
FTP Troubleshooting
For Gentran, FTP is a simple file copy function. The majority of the time any issues with an FTP set up is going to be connectivity with and permissions on the FTP server.
The first thing to do will be to verify you can manually connect to the FTP server using your credentials, and that you have permission to “put” a file to the FTP server’s directory (as specified in the FTP send text file).
If you are using a network drive to store FTP files locally, make sure you have write permission to that directory. Network drive connections can be lost, so this architecture model should be used with care.
Care must also be taken to differentiate Gentran problems (eg, translator issues) with FTP problems (pretty much limited to connection and permissions issues).
That being said, there are other problems that can come up while running an FTP send or receive.
See the following for matching symptoms and their solutions:
http://www-01.ibm.com/support/docview.wss?uid=swg21561973
Configuring FTP communication to use with Sterling Gentran:Director (public)
http://www-01.ibm.com/support/docview.wss?uid=swg21552917
Director FTP communication session does not work (public)
http://www-01.ibm.com/support/docview.wss?uid=swg21560792
Exec_Program Command in Process Control Hangs While Running the SterlingFTPRcv.bat File (public)
http://www-01.ibm.com/support/docview.wss?uid=swg21561057
Director FTP communications do not work after moving to a new computer (public)
http://www-01.ibm.com/support/docview.wss?uid=swg21964426
Gentran Director FTP Not Receiving Data (public)
http://www-01.ibm.com/support/docview.wss?uid=swg21536547
Receiving error when trying to connect to the IWDLINK via FTP - Error: 426 Transfer failed (public)
The following links are for Internal use only, however if your symptoms appear to match, you should include the document number (“swg21234567”) in your PMR for the responding engineer to use:
http://www-01.ibm.com/support/docview.wss?uid=swg21560954
Backup Batch Process Copies Files Multiple Times (internal)
http://www-01.ibm.com/support/docview.wss?uid=swg21539016
FTP connection not made (internal)
http://www-01.ibm.com/support/docview.wss?uid=swg21555475
Director FTP communications do not work after update of Java version (internal)
UID
ibm11122765