Can return codes be checked for Failure or Success in FTP session, to prevent premature delete of the SENDFILE.EDI ?

Technote (FAQ)


Question

Can return codes be checked for Failure or Success in FTP session, to prevent premature delete of the SENDFILE.EDI ?

Cause

If the FTP script could not connect, the script was deleting the SENDFILE.EDI file without writing to the destination. This caused confusion and difficultly in find the missing edi files and retransmitting.

Answer

Yes. The IBM Sterling Gentran:Director FTP documentation points out that CEFTP.EXE does have error handling. This article attempts to make it simple to follow.

The tool for catching the FTP return uses windows variable: ERRORLEVEL.
- Simply put, test for 0 (positive) or 1 (negative).

IF %ERRORLEVEL% EQU 1 goto FAILED
IF %ERRORLEVEL% EQU 0 goto XPASSED

Attached are two files
FTP_RC_Check_Step1.BAT - it launches the FTP framework, including debugging parms and logging. It makes the call to:
FTP_RC_Check_Step2.txt a file that holds the IP address, logon, password and FTP native parms that will execute in a FTP scripting situation.

Work Flow in Gentran:
a. Gentran Director import or screen entry occurs to create the EDI outbound content.

b. The created EDI file is written via the Communication Profile to a folder. The file is named SENDFILE.EDI

c. FTP_RC_Check_Step1.bat is launched by Process Control or Windows scheduler.
1) File name is preserved, regardless of success (SendBackup) or failure (SendFailed).
2) The FTP_RC_Check_Step2.txt is read for the required FTP login and commands, and submitted.
3) When finished the return code is passed back to the .bat file and evaluated for Positive or Negative

Tip 1: A few new sub-folders are required and must be created:
Send_Retries,
Send_in_processing,
SendBackup
SendFailed.

Tip 2: The naming convention of the DOS work in the .bat will use a date and time for the file, and create a sub folder appropriately.

Tip 3:: There is a new logging summary file created. SterlingSndEcho.log created for a quick glace to determine success or failure. Could also be used as "canary effort" for a 3rd party notification software.

Tip 4: It is the users responsibility to clean up and delete files age appropriately.
Director will not be deleting these files!


Example below is of the sub-folders and file naming convention that can be used:


The BAT and TXT examples are attached to this article. Customize as needed.

The FTPUserOption Guide outlines many other debug parameters; this article documents just one example.

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

Sterling Gentran:Director
Documentation

Software version:

5.4, 5.5

Operating system(s):

Windows

Reference #:

1634913

Modified date:

2014-06-16

Translate my page

Machine Translation

Content navigation