Table of Contents

Background Processing of Transactions

Calling Transactions via Script

All TradeDesign transactions (except Managers) launched via scripts, cron or otherwise are started via the “td2batrun” script. This script creates/manages a central log file in “$TD2HOME/log/batrun.log.”

This central log file is continuously archived by renaming it in the same directory by inserting .“<Date>.<Time> inside batrun” and .“log.” This is currently already done in “td2batrun”, as long as the existing log file does not have today's date.

If any errors occur in “td2srun” or in “td2s”, which are logged on “stderr” or “stdout”, they are displayed in the process-specific log and can be read from there, as required.

“td2batrun” creates an entry (the returncodes are logged) at each start and completion of the transaction.

All required arguments for batch transactions are passed via switches, which can be specified on command line level. The switches used have to be unique compared to the usual switches used in TradeDesign.

-i Input File, Input Directory-o Output File, Output Directory

“-ety <Entity>” –> When starting a DOKA transaction in a Unix environment (e.g. via cron), the entity to be used can be set via commandline. If the transaction is lauched in jobs, another entity can be set. The other entity can also be used in the job execution. In doing so, the entity group (ETG) is set out of the entity.

Example for launching a script (export all guarantees in a file 'gar.txt' at CS):

“$TD2HOME/bin/unix/td2batrun csigie -i $TD2HOME/data/dok2host/gar.txt”

NOTE: Switches may also be used without the following content. The usage of “-i” in SYSDBA without following content is valid.

Within the transactions the switches are accessed via the SYSMOD function “LnkGetSwitch”.

NOTE: Managers (i.e. processes that normally run permanently in the background, such as MGRTSK, SWITSK, SYSWDR) are not considered as batch transactions in this sense. Managers are started via “allsrvstart” or special start scripts (as the caller is not waiting for the return of the transaction). When starting “allsrvstart” and “allsrvstop” an additional entry is created in “$TD2HOME/log/batrun.log.” Details / End / Errors are only logged for the Manager in the respective log file “$TD2HOME/log/<Managername>.log”.

“batrun.log” and the manager logs can be displayed easily via SYSMGR.

Processing Logs

As a basic principle, TradeDesign transactions that can be launched in the background (i.e. batch transactions and Managers) create their own processing log via LOGMOD. In this log, the name of the processed input file and the created archive files have to be displayed. Even if the file has been moved to ERROR, this has to be written to the log. For Managers, this processing log is written into “$TD2HOME/log/<Managername>.log”.

Usually, the archiving of import files is a task of the transaction, as only the transaction can easily distinguish if the file has to be moved to ARC or to ERROR.

Returncode

If a batch transaction can or must register a processing status, the following convention “SetContext( tdContextRETURNCODE, “x” )” should be set on 'exit' as needed.

Special Users for Background Processing


When it comes to background processing, avoid using User IDs that belong to a regular user.

Proceed as follows:

As a result background transactions run with an empty User ID, defaults are used for language, entity, entity group, etc.