ImpactUpload Utility

The ImpactUpload utility generates Impact Simplified External Transaction Files when the front-office completes trades with the afs:TRADE application.  

This utility is controlled via an ImpactUpload section in the afstrade.ini file.

[ImpactUpload] 
; Directories/Filenames 
BASE_DIRECTORY - The root directory for all data, sequence files.
LOG_DIRECTORY - relative to the base directory. 
SEQUENCE_DIRECTORY - relative to the base directory.  
UPLOAD_QUEUE_DIRECTORY - Identifies where the Impact files are placed immediately after creation. Any files in this directory have NOT been ftp'd. 
UPLOAD_SENT_DIRECTORY - Identifies which files have been ftp'd. 
FTP_MACHINE - The IP address of the FTP machine. 
FTP_DIRECTORY - The directory on the FTP machine where the impact files are written. The user who logs
onto this machine MUST have write permission to this directory. 
FTP_TIMEOUT - The number of seconds the application will try to write to the ftp machine. The smaller the number,
the greater the chance of timing out too soon. The greater the number, the longer the application takes to process each
Ticket Event. 

Each file's name is defined as follows:

<seq.#>_<primary_ticket_number>_<detail_ticket_number>_<revision>.txt 
seq# - sequence number, from 0000 to 9999 
primary_ticket_number - the main number of the ticket, 6 characters 
detail_ticket_number - the allocation number, 3 characters 
revision - the detail's revision number, 3 characters 

As trades are completed, these files are written to disk by ImpactUpload. ImpactUpload then attempts to send the each file to FTP_MACHINE via ftp. If the ftp fails, the file remains in the queue directory. ImpactUpload will attempt to ftp the file again the next time an Impact file is created. Immediately after the file is delivered to the ftp machine, a corresponding "trigger" file (.trg) is ftp'd. Once the trigger file has completed sending, the file is archived to the sent directory. 

There should be no files in the queue directory at the end of the day. If there are, they may be manually ftp'd to the ftp server.  We also recommend that the sent directory be purged after all transactions have been verified in the back-office. 

Operation

Run the application and a database login panel appears (or see Running applications from the command line). Once successfully logged on to the database, an ftp login appears. This requires a valid username and password for access to the FTP_MACHINE defined in the ini file. The utility then performs ping and connect operations to verify the connection. If an error occurs, the user has the opportunity to quit, continue and only create files locally, or try to re-login to the ftp machine. 

The ImpactUpload form appears after the ftp connection is verified. If the utility was started after trading has begun, it will play "catch-up" and process all events up to the last ticket event. The log which is displayed on the form is written to the log directory as Ticket_Impact.log. On startup, an already existing log file is archived with the current date/time stamp. 

The sequence directory contains 2 necessary files: the last event handled by the app (ImpactEvent.seq) and the last ticket sequence number (TicketImpact.seq). These ticket sequence files may be destroyed as part of the end-of-day process. Both files are created (with value of 0) at startup if they do not yet exist. The ImpactEvent.seq file MUST be destroyed when the events are cleared.  

After an Impact file has been created, ImpactUpload sets the tckdtl.is_bop value to indicate the status of the Impact upload as follows: 
0 - 2: Impact file not generated 
10-12: Impact file generated for valid ticket 
20-22: Impact file generated for canceled ticket 
Please note that the "ten's" digit is used for the Impact utility. (The "one's" digit is used by the TicketUpload program if your site uses that program). 

The program has the capability of regenerating and resending an file if the program fails to handle a certain event. The
Resend button will become active after the utility is paused. Selecting the Resend button then prompts the user for the event
number associated with the ticket. A valid ticket event will only be accepted. When the user is done resending a ticket, the
utility is simply restarted. 

Example ini file

[ImpactUpload]
BASE_DIRECTORY=P:\Fnbc\dat
LOG_DIRECTORY=logs
SEQUENCE_DIRECTORY=sequence
UPLOAD_QUEUE_DIRECTORY=ticket\upload
UPLOAD_SENT_DIRECTORY=ticket\upload\sent
FTP_MACHINE=192.149.42.195
FTP_DIRECTORY=/home/Impact
FTP_TIMEOUT=15