SI Reader User Manual
SI Reader User Manual
mqctksi ignored ignored tcid script_ext cache_delay [controlport]
On startup ctksi reads a deal configuration file (DCF) supplied by Cognotec, checking it for any obvious errors. Once this check is completed, ctksi opens a socket, binds it to the IP and port numbers, that are associated with its first two arguments, and then repeatedly attempts to connect (as a client) to an SI Server that is expected to be listening at the bound IP location. If the connection to the SI Server fails for any reason, ctksi returns to this "attempting to connect" state.
Once connected, ctksi responds to SI Server "PING" messages and ACKs, or NACKs deals (according to the SI specification) as they are presented. Ctksi handles any duplicate deals that are presented sequentially by ACKing them and not passing them on to the Scripting System. If the same deal is received more than a few times (currently 5 times) in a row, ctksi NACKs the deal, in an attempt to persuade the SI Server to move on.
If "PING" messages stop arriving for a configurable time, the TCP-IP or MQ connection to the SI Server is reset and ctksi repeatedly attempts to reconnect using fresh resources.
Ctksi runs on any hardware and operating system that
supports an ANSI C compiler.
The parameters for ctksi are as follows:
IP the IP name or number of the remote
machine to be used to present the network protocol. This
parameter is ignored if configured for an MQ connect.
port the port number (or a port name
present in the "services" file) that ctksi should
attempt a connect on. This parameter is ignored if configured
for an MQ connect.
tcid a 4 character code (usually "LITE") which will be
the ID of any associated Reuters
Server Mimic.
script_ext the 3 character
filename extension of the set of scripts that will be
associated with this SI reader.
cache_delay the number
of seconds that this SI reader should wait for associated
Payment Instruction records before sending whatever information
it has to the downstream processor (e.g. a TOF Mimic).
controlport
this optional parameter may be set to the number or "services"
name of the control port that will accept external TCP-IP
connections and respond to status requests (7/27/2001).
setenv MRG_ECMD (uniq -6 | mail -S \"Critical Softek Message\" salist)
Each line in the <TCID>.msg file is timestamped and
its process-origin is identified. <TCID>.msg is deleted
each time after the command in MRG_ECMD is executed.
To prevent short-term error conditions from producing
orphaned notifications a 45 second delay is
implemented for new batches of error notifications.
MRG_ECMD The command to be used to process critical (information and error) messages (including all arguments to run the command) is taken from this variable. The command must take its input from the standard input stream.
CTK_MSGDIR The directory where transitory work files will be stored. Both critical messages and conversation details (Reuters only) make a temporary appearance in this directory.
CTK_LOGDIR The directory that will be used to store the logfiles generated by this program.
CTK_DLSDIR The directory that will be used to store the dealfiles generated by this program.
CTK_CACHEDIR The directory in which deals awaiting Payment Instructions should be stored. Each deal is stored in its own file and named according to the "SI Deal Reference Number"
CTK_CACHEDELAY Same as the cache_delay program argument
CTK_SCREXT Script extension specifier, usually set as an argument to ctksi
CTK_ACKLATEPI By default, this option is switched on and results in payment instruction records, that are not received within the cache-delay period, being ACKd to the SI Server. If this variable is set to "no" or "NO", these "late" payment instruction records will be NACKd. See later for a discussion of this issue.
CTK_PULSETIMEOUT The value in this variable represents the number of seconds that ctksi may wait, without receiving a PING (heartbeat) from the SI Server. If this number of seconds is exceeded, the TCP-IP port to the SI Server is completely reset and attempts are made to reconnect with a newly opened socket. If this variable is not present or it cannot be decoded as a number, the default value is set to 300 seconds.
CTK_VIRTUALHOSTNAME Enables the TCP-IP Failover feature.
CTK_TCPMSGDUMP Enables the TCP-IP Stream Dump feature.
CTK_TCPMESSAGES Enables the TCP-IP Stream Replay feature.
MQSERVER If MQ deal processing is configured, this variable must be set up in accordance with IBM's guidelines. It is used by the IBM's MQ client software to configure an MQ connection to a remote MQ server.
gzcat ctksi.tar.gz | tar xvf -
or
gunzip ctksi.tar.gz; tar xvf ctksi.tar
when executed from within the Softek home directory while logged in as "softek" should completely build the runtime directory hierarchy. The file "~softek/ctksi/i_s" will need to be edited to make sure the first two arguments (IP and port) are correct for this customer. The "softek" login should be /bin/csh and have ". ~/bin" as the first two entries in its search path and, if a TOF Mimic is to be used, the device "/dev/ttya" should have permissions set to "world rw". In addition, this port (/dev/ttya) must not have a login shell enabled on it.
~softek
~softek/bin
~softek/ctksi
~softek/ctksi/deals
~softek/ctksi/logs
~softek/ctksi/cache
The ~softek/bin directory should contain symbolic links to executable binaries and shell scripts that are also hosted in ~softek/ctksi. An important configuration file (which should usually be left as distributed) is the shell command file that defines the Environment Variables ~softek/bin/set_my_env which usually contains the lines:
#!/bin/sh
CTK_PRINT=no; export CTK_PRINT
# change the "yes" to a "no" below to NACK late Payment Instrs.
CTK_ACKLATEPI=yes; export CTK_ACKLATEPI
DL_DLSDIR=./deals; export DL_DLSDIR
CTK_CACHEDIR=./cache; export CTK_CACHEDIR
CTK_DLSDIR=$DL_DLSDIR; export CTK_DLSDIR
DL_LOGDIR=./logs; export DL_LOGDIR
CTK_LOGDIR=$DL_LOGDIR; export CTK_LOGDIR
MMC_LOGDIR=$DL_LOGDIR; export MMC_LOGDIR
CTK_VIRTUALHOSTNAME=Virtual_RRS; export CTK_VIRTUALHOSTNAME
# MQSERVER=ctksi/TCP/peizo.shappys.com; export MQSERVER
# CTK_TCPMESSAGES=TCPmsginput.bin; export CTK_TCPMESSAGES
# CTK_TCPMSGDUMP=TCPmsgdump.bin; export CTK_TCPMSGDUMP
Note: Turning on the MQ facility involves setting the MQSERVER variable and uncommenting it in the ~softek/bin/set_my_env file.
- Pick a date/time when you want to go live.
- When the moment arrives shut down the Softek interfaces (i_kill command).
- Delete all the files from the ~softek/deals directory and the ~softek/cache directory.
- Switch over the Bank's TOF client to production.
- Make sure no more "pretend" deals are entered :-).
- Restart the Softek interfaces (i_start).
The Reuters sequence
number file (LITE.seq) or the "last-SI-deal-received"
record file (LITE.lst) should not need to be touched.
If, however you want to start the production run at a specific
Reuters sequence number the file LITE.seq,
in the $CTK_DLSDIR
(~softek/deals) directory, contains
the last assigned Reuters ticket number. Providing you are
deleting the LITE*.dls files from the directory (while the
interfaces are down) you should be able to put any number in
here and have the SI reader assign the NEXT number to the next
deal (wraps back to 1 at 999,999 just like a Reuters
server).
cd ~softek; tar xvf ctksi_upd.tar
To ensure continuity of deal presentation, the following files should be preserved before the upgrade has been installed and their contents should be checked after the upgrade has been installed and before the Softek processes are restarted, to verify that they have not changed.
~softek/ctksi/deals/LITEmmdd.dls (where mmdd represent the last 5 days (mm=monthnumber and dd=daynumber))
~softek/ctksi/deals/LITE.seq
~softek/ctksi/deals/LITE.lst
~softek/ctksi/i_s (to preserve the IP and port designations of the SI Server)
First
i_kill
cd ~softek
mv ctksi preserve_ctksi
This makes sure you will not change any files in the old
(production) ctksi directory hierarchy.
Then
mkdir ctksi
cd preserve_ctksi; tar cf - . | (cd ../ctksi; tar xvfBp -)
Now follow the directions for applying
an update. You must make sure the Bank's TOF client is
targeted at a test system. You should now be able to use
i_start, i_query, and i_kill as normal
(these are implemented with symbolic links from the ~/bin
directory and should always be pointing at binaries within the
~softek/ctksi hierarchy).
Once successful testing is complete you may:
i_kill
(retarget the TOF client at a production system)
cd ~softek
rm -rf preserve_ctksi
i_start
or if it is necessary to revert back to the previous production system
i_kill
(retarget the TOF client at a production system)
cd ~softek
rm -rf ctksi
mv preserve_ctksi ctksi
i_start
If ctksi is left running overnight, a new logfile is automatically created as soon as necessary after midnight.
SP-ACTIVE
SPEC_STX,1,0,0 (* Start of Message *)
LIST_DEAL_NO,19,0,0 (* Key - Deal Num - Branch 8, Year 4, Seq 7 - *)
LIST_DEAL_ID,1,0,0 (* Key - Deal Component *)
SPEC_FX_MESSAGE_TYPE,2,0,0 (* Key - ND or UD *)
SPEC_RAB_FX_DEALNO_SEQ_NO,7,0,0 (* 501 - Source Ref *)
...
...
- a timestamp on a line by itself, together with the word "Start" and the SI ticket number.
- the fields of the record (each field begins a new line and starts with the SI field identifier (a name) followed by a colon (':') character and then followed by the field data). If the field data contains newline characters, these are also output,
- the timestamp in 1. repeated (together with the word
"End" and the ticket number).
- The system representation of the time when this deal should be presented to the TOF
- The number of possible legs for this deal type
- The number of legs received so far
- The type of the last leg received
Raw deal data is appended to this header on a separate line.
Whenever a new leg is received a new header is written and new
deal data is appended to the old on its own line. When either
all the possible deal legs have been received or the timer
in the record header has expired, the data in this file is
presented to the script system which, when configured to feed a
Reuters TOF mimic, appends
a new record to the appropriate dealstore
file and the Cache File is deleted. The ticket number for this
new Reuters deal is taken from the Client
Deal Sequence Number File after is has been
incremented.
A file named <TCID><mmdd>.dls (where <TCID> is the string used as the third parameter to ctksi) is appended to as each deal record is cleared from the SI reader's deal cache. Each record, representing the transformed deal data received from the SI server, comprises three main parts,
- a timestamp on a line by itself, together with the word "Start", the created Reuters ticket number and optionally followed by the letter "C" (to indicate a "conversation" record).
- the fields of the record (each field begins a new line and starts with a Reuters field identifier (a 3 digit number in the range 500 to 599) followed by a colon (':') character and then followed by the transformed field data). If the field data contains newline characters, these are also output,
- the timestamp in 1. repeated, together with the word
"End" and the repeated ticket number.
dealno_branch
Branch of a Deal
dealno_year
Current Year
dealno_seq_no
Deal reference number
dealno_id
Deal Id. for Near/Far leg (A resp. B)
message_type
Type of Message (ND = New Deal, UD = Update)
deal_type
SP, FR, FO, SL, SD, SN, TN, EN, SF, TF, EF or DL
e.g.
DEALROOM19991000178AUDSD
This information is used to determine if a sequential duplicate deal has been received from the SI Server. In this event, the duplicate is ACKd unless it has been received more than five times in a row, in which case it is NACKd with a "%BXX" (an anonymous NACK).
The file <tcid><mmdd>.msg contains one line for each critical message. Each line comprises four sections:
- <application name>
- [<DateTime>]
- <a critical message>
- #<a critical message number>. Error numbers produced by ctksi are in the 140,000 to 149,999 range.
For Example:
ctksi [Wed Sep 29 12:02:24 1999] Payment instructions
for SP/A deal <1000168> did not arrive in time for TOF
#141233
Record Type
Name of Script File
SP, FR, FO, DL
si501.<ext>
SN, TN, EN, SF, TF, EF
si502.<ext>
SD, SL
si503.<ext>
At the data level, there are certain SI fields that have no TOF equivalent and vica versa. These are addressed in more detail in a document from Cognotec, but certain, fairly TOF fundamental information (e.g. Counterparty TCID, which is defined for all real Reuters customers worldwide) cannot be mapped to SI equivalents. Usually, an alternative representation is provided, but some extra effort is involved, on the part of Bank systems implementers, to integrate these alternatives.
TOF deals are self contained, that is, each deal contains all the data fields needed to describe the legal deal entity. The TOF cannot supply data that might arrive later about an already sent deal. As a result, any SI Payment instruction records that arrive after the designated cache-time cannot be sent through the TOF mechanism to the Bank. Setting the CTK_ACKLATEPI environment variable to "no" or "NO" will cause these "late" messages to be NACKd when they are received by ctksi. This, however has the undesirable side-effect of not allowing these records to be printed via Cognotec's reporting system. By default, this variable is unset, and "late" PI records are ACKd to the SI Server (having the other undesirable side-effect that Cognotec systems are not aware these records have not been delivered to the Bank). There are ongoing discussions dealing with ways around these TOF limitations (e.g. providing separate Back Office and Front Office TOF feeds).
loaddlsnameThe workarea is loaded with the name of the current client deal record fileloaddlsstart
The workarea is loaded with the word "Start" followed by a "#" character and the currently available TOF ticket number.loaddlsend
The workarea is loaded with the word "End" followed by a "#" character and the currently available TOF ticket number.ctkdate2reuters
The Cognotec-format date in the workarea is replaced by the equivalent date in Reuters TOF format.ctkdealtype
The SI fields "SPEC_RAB_FX_DEAL_TYPE", "FXM_FIXED_BANK_SELL_CCY_NEAR", "FXM_FIXED_COUNT_CCY_NEAR" and "FXM_FIXED_FIXED_CCY_NEAR" are checked, decoded and used to determine the Reuters equivalent "deal type" (Reuters TOF field 514). Since FRAs are not implemented in the SI, a number between 1 and 6 is loaded into the workarea. If any of the required fields are not present, this transform will indicate failure (testable using the if statement).ctk2r2kcur
Converts an SI currency volume into its minimal Reuters form, stripping off a leading '+' and leading zeroes before a decimal point (leaving the last if necessary). Trailing zero are stripped from the RHS of a decimal point leaving only one if necessary. The resulting floating point number is placed back in the workarea.ctksubrates
The floating point number found in the workarea is taken away from the floating point number found in the savearea. The resulting floating point number is placed back in the workarea. Equivalent to the expression:workarea = savearea - workareaIf the workarea or the savearea does not contain a number, this transform will indicate failure (testable using the if statement).
ctkpuredealtype
The SI field "SPEC_RAB_FX_DEAL_TYPE" is checked, decoded and used to determine the equivalent Reuters "Pure Deal Type" (TOF field 569). Since FRAs are not implemented in the SI, a number in the set [2, 4, 8, 16] is loaded into the workarea. If the required SI field is not present or does not contain a legal value, this transform will indicate failure (testable using the if statement).ctkfieldlist
The SI field "SPEC_RAB_FX_DEAL_TYPE" is checked, decoded and used to determine the equivalent Reuters Field List Number. If everything checks out, a number in the set [501, 502, 503] is loaded into the workarea. If the required SI field is not present or does not contain a legal value, this transform will indicate failure (testable using the if statement).ctkperiod
An SI Deal Period designation in the workarea is converted into its Reuters equivalent, suitable for loading into TOF field 515 or 516.ctkloaddltype
The current SI deal type (as specified in the Deal Configuration File) is loaded into the workarea. After this transform, the workarea will contain one of the following string tokens (without the quotes):"SP", "FR", "FO", "SN", "TN", "EN", "SF", "TF", "EF", "SL", "SD", "DL"loadrawrecord
The current SI TCP-IP deal record is stripped of its STX and ETX framing characters and loaded into the workarea.loadlabeledrecord
The current SI TCP-IP deal record is stripped of its STX and ETX framing characters and labels are inserted before each data field with an intervening colon ':' character. Each field is terminated by an ASCII NL (newline) character (dec 10, hex 0x0A). The last field is also terminated by a NL character. The labels for this transform are deal-type dependent and are taken from the current dcf.ini file. The resulting new record is loaded into the workarea.The contents of the workarea is sent to the IBM MQ queue whose name is specified in the savearea. The mq.conf file is used to store information about the default queue name and any name mapping that will be used by the namemap data transform. mq_write establishes a new connect to the designated Queue Manager as necessary. Remote server access is governed by the contents of the MQSERVER environment variable, the black art of correctly setting up the value for this variable is, unfortunately, beyond the scope of this document. As of 6/15/2000 the savearea contains the name of the MQ queue into which data is inserted. If the value of the savearea is "default" (no quotes), the MQ queue name used will be the first non-comment token from the mq.conf file.The first time this function is used the mq.conf file is parsed and all lines after the first non-comment line are used to supply "from"/"to" mapping tokens. The workarea is compared against each of these "from" values in the order of appearance in the file. If a match is found the workarea is replaced with the corresponding whitespace separated "to" value on the same line in this file. If no match is found, the workarea is set to the default QM queue name, which is specified by the first non-comment string token in the mq.conf file. Note: since the mq_write script transform uses the savearea to designate the MQ queue name to write into, the script functionsave:should be called after this namemap transform.
The contents of the workarea is sent used as the argument to a UNIX popen() call. The results of the popen() (it's standard-output) are loaded back into the workArea.
q or Q quit the program gracefully
eof ctksi enters Daemon Mode (see above).
Interactive Mode is intended for use as a debugging aid, since all messages will appear on the screen as they are output. The use of Interactive Mode is strongly discouraged in production since simple keyboard entry may be used to shut the process down.
On UNIX operating systems, SIGPIPE is caught and its passage is noted in the logfile.
The following UNIX shell script has been used to create archive files in the login directory (these archive files will still need to be moved off the filestore). The script should be run periodically (monthly perhaps) and will archive and delete logfiles and dealfiles older than 60 days. The script may be run in a "cron" job as the "softek" user.
#!/bin/sh
date=`date '+%m%d%Y'`
archfile=`echo softek${date}.tar`
if [ -f ${HOME}/${archfile}.gz ]; then
echo ${archfile}.gz already exists...skipping overwrite
else
echo will create ${archfile}.gz
cd ${HOME}; files=`find . \( -name "*[0-9][0-9][0-9][0-9].log" -o -name "*[0-9][0-9][0-9][0-9].dls" \) -a -mtime +60 -a -print`
cd ${HOME}; tar cvf ${archfile} ${files}; gzip ${archfile}
cd ${HOME}; rm ${files}
fi
- ~/ctksi/scriptcfg/Makefile
- ~/ctksi/scriptcfg/ctkscript.h
The Makefile contains targets that are customer bank names and major feature combinations. It is intended that special feature requests made by customer banks will result in this set of targets being enlarged and associated with the switch combinations necessary to satisfy the bank's requests. For example:
btmjapansi:make "CUST=JPYSPOTFROMSI NOFIRST4IN508" ${CTKSCRIPTS}
This example illustrates a recursive call to the Makefile that will attempt to build scripts for the target btmjapandsi. The "make" recursion is used to allow the system to substitute some high level customization groupings and associate them with a single target token. The groupings are assigned to the local Makefile variable CUST which defaults to the value STANDARD. The above example illustrates the use of quotation marks to group multiple configuration options into the CUST variable.
The bank, in the above example, wanted a JYP spot rate
supplied by the SI feed and did not want the first four
characters of the SI client code stored as TOF field
508. These two customer requirements translate into two options
loaded into the make variable CUST which are used
in the script header file ctkscript.h to cause certain
#define variables to be switched on or off (see just
below).
The file ctkscript.h contains the cluster of C
Preprocessor switches necessary to turn on and off the standard
script features and override them with special options.
e.g.
#if defined(JPYSPOTFROMSI)
# define VAL_CUR_CODE_LABEL_544 SPEC_JPY_TEXT
# define VAL_CUR_RATE_LABEL_543 SPEC_JPY_USD_SP
# undef SPOT_CURRENCY
# undef SPOT_RATE_FILE
#endif /* defined(JPYSPOTFROMSI) */
#if defined(NOFIRST4IN508)
# undef FIRST_4CHARS_OF_CLIENT_CODE_IN_508
#endif /* defined(NOFIRST4IN508) */
which illustrates how the Makefile variables JPYSPOTFROMSI and NOFIRST4IN508 are associated with a subset of the C Preprocessor switches (macros).
The default settings in ctkscript.h and their meanings are:
#define FIRST_4CHARS_OF_CLIENT_CODE_IN_508
Use the first 4 characters of the SI's CLIENT_CODE field as the TOF TCID (field 508).
#define FILL_541_AND_542
#define FILL_561_AND_562
#define FILL_563_AND_564
Populate fields 541, 542, 561, 562, 563 and 564.
#define WANT_FORWARD_OPTION_DATA_IN_516_527_528
Populate fields 516, 527, and 528 with SI forward option data.
#define AUTOTRADER AUTODL
Use the string AUTODL as the TOF Trader Id in field 504 unless a dealer intervened, in which case populate the field with the SI's INTER_DEALER_NAME field.
#undef BROKERDEALINGCODE510
Use the value in this preprocessor macro as the token to store in TOF field 510. If this macro is not defined (default), populate field 510 with nothing (leave it blank).
#undef INTERDIN507_USERNMIN504
Populate TOF field 507 with the intervening broker's Id and store the SI's USER_NAME in TOF field 504 (switching fields 507 and 504). Off by default.
#undef SPOT_CURRENCY
#undef SPOT_RATE_FILE
By default there is no base currency defined and we do not use a file to get the base currencies spot rate.
#undef VAL_CUR_CODE_LABEL_544
If this macro is given the name of an SI field, that SI field's value would be loaded into TOF field 544 (Base rate currency code). Off by default.
#undef VAL_CUR_RATE_LABEL_543
If this macro is given the name of an SI field, that SI field's value would be loaded into TOF field 543 (base rate against USD). Off by default.
#undef MARKETSPOTRATE_IN_565_AND_566
#undef FARMARKETRATE_IN_565_AND_566
By default we do not load TOF fields 565 or 566.
#undef ONLY_DEALS_WITH_INSTRS_MAY_PASS
If this macro is switched on (default is off), the TOF will not get this deal unless settlement instructions are included. If you enable this macro, you should probably increase (from the default 30 seconds) the value of the environment variable CTK_CACHEDELAY or its associated program argument.
#undef SPOTMKTRATE_IN_560
If this macro is switched on (default is off), FXM_R_T4_RP_NR will be loaded into TOF field 560 for all deal types except Money Market.
#undef APPEND_F_TO_572
If this macro is switched on (default is off), value loaded into TOF field #572 will have an "F" character appended to it if the value of the originating SI field (M_RTS_MRKT_PRFLE_CCY_YEAR) was 365. Please note: This change was made to facilitate deal loading into the "Infinity" Front Office System and will result in a TOF field #572 being an out-of-spec. 4 characters wide instead of the Reuters standard 3 characters wide. (6/15/2000)
#undef LARGEID
If this macro is switched on (default is off), the value loaded into fields 504 and 507 are not restricted to just 6 characters. BEWARE, this does not conform to the TOF spec.
#undef SHORTUSER
If this macro is switched on (default is off), the value loaded into fields 504 is always FXM_USER_SHORTNAME. If the INTERDIN507_USERNMIN504 option is also used, this (SHORTUSER) option is automatically disabled.
#define REPOS_IN_509
Enables the processing of "Repository Funds" information within deals. This will result in the characters "|1" or "|0" being appended to field 509 in the presence resp. absence of a Repository Fund deal. This option is enabled by default.
When a Bulk Fund (Allocation) message (deal type BF_XX) is received from the SI Server, ctksi first generates a TOF "contra" deal to negate the effects of the original TOF position deal, received earlier from the SI. This "contra" deal is identical to the original "position" deal except that it's BUY/SELL flag is flipped (buy becomes sell and sell becomes buy in TOF field 514). Subsequently, ctksi generates one new TOF deal for each of the indicated funds allocated to by the Fund Manager. Up to 1000 allocation deals plus one "contra" may result from a single Bulk Funds deal. Each of these allocation deals is assigned a TOF field 567 whose first seven (zero padded) digits are the SI deal reference number and the last four (zero padded) digits are the allocation number starting from zero (max 999). The same source reference field value (TOF field 501) used in the original deal is used in the "contra" and all the new allocation deals. In the allocation deals
TOF field 509 is replaced with the "Fund Code"
TOF field 519 is replaced with the "Fixed Amount"
TOF field 545 is replaced with the "Contra Amount".Updated (10/23/2000)
TOF field 514 is flipped for each allocation where the "Allocation Buy Currency" is the same as the value of the SI "FXM_FIXED_COUNT_CCY_NEAR" field.
Since a Back Office Reference number is assigned when an allocation deal arrives, it is important that TOF dealfile processing (using this assigned ticket number) occurs immediately. Deals which have an associated Back Office Reference number spend minimal time in the TOF cache. They are designated as "write-through" and are processed immediately. Coincidentally, a previously cached deal may becomes current just as a "write-through" deal is written to the cache directory. To prevent this cached (but now current) deal taking the TOF ticket number assigned to the "write-through" deal, a file ~softek/cache/priority.dat is written in the cache directory. This priority.dat file contains the filename of the "write-through" entry. Cachefile processing always starts (or resumes) with the file whose name is contained in this priority.dat file whenever priority.dat exists.
When a Single Fund message (deal type SF_XX) is received from the SI Server, it is not designated as "write-through" (no priority.dat file is generated) however, since there can be no updates to this deal type, it is processed through the cache as soon as possible. There is no "contra" deal, nor are there any special TOF fields, associated with this deal type. Only a single ticket is created which must suffice for both position and settlement information. The Back Office System must have associated settlement details for the specified fund.
Ctksi provides (TOF only) Back Office Reference information to allow the customer to more easily track Allocation deals that are expanded by ctksi and submitted to the bank's Back Office System. The TOF ticket number that corresponds to the first, non-contra, segment of the allocation (the one that is assigned a TOF contra reference (field 567) ending in 0000) is passed back to the SI Server as the Back Office Reference.
Exception condition processing may result in the allocation deal being represented to ctksi. This is handled correctly. The most recent Back Office Reference is preserved and resent to the SI Server. See here for more details.
Ctksi has the ability to perform a primary data load directly into a Front Office System using mechanisms other than the TOF serial-line based feed. This Front Office load is accomplished using two new script files:
generated from the script configurator file siscript.h, this script file is called immediately a deal is received by ctksi. This script is responsible for performing the primary load into the Front Office System. If this script generates an error, the deal will not be ACKd to the SI Server and it will be repeated by the SI Server in a few minutes.
ackscript.ctk
generated from the script configurator file ackscript.h, this script file is called after siscript.ctk and is responsible for reading any response to a deal presented by siscript.ctk. The response does not have to come via the same mechanism that supplied the deal to the Front Office (e.g. a deal, supplied to the Front Office via a direct database write could result in an MQ confirmation message being read by this script and passed back to the SI Server). This script is responsible for decoding any Back Office Reference and related information sent from the Bank's Front Office System and passing it on to the SI Server. ***Although the script is called at the appropriate time, it currently does nothing...as of 8/29/00***.
Currently the following direct deal-loading mechanisms have been implemented at customer sites. The whole range of deal loading mechanisms are available as currently provided by Softek's scripting system including (but not limited to) the following:
Two forms of MQ data loading have been provided, but, using the scripting system, any record format may be crafted. Using this mechanism, the Back Office Reference will be available in a future release. The two provided record formats are:
- SI raw data format. A record is sent to MQ in exactly
the format it is received from the SI TCP-IP stream
except without the framing STX and ETX
characters. To enable this "raw" format, by configuring
the appropriate script, type:
cd ~softek/ctksi/scriptcfg; make mqwhen logged in as softek on the Cognotec SPARCstation.
- Labeled data format. The SI record is provided to MQ
with the associated SI field labels. Each field has the
appropriate SI label and a colon (':') prepended to it
and each field is terminated by an ASCII NL (newline)
character (dec 10, hex 0x0A). Note: The last field also
ends with a NL character. The customer bank should be
aware that the the field labels change with the deal
type. Ctksi uses the field label definition set
stored in the file ~softek/ctksi/dcf.ini
on the Cognotec SPARCstation. To enable this "labeled"
format, by configuring the
appropriate script, type:
cd ~softek/ctksi/scriptcfg; make mqlabeledwhen logged in as softek on the Cognotec SPARCstation.
r2k [serial-port [server-tcid [scriptt-ext [port[baud]]]]]
ebs [serial-port [server-tcid [scriptt-ext [port [baud]]]]]
Ctksi uses a file named mq.conf to enter MQ configuration details. This file contains two white-space separated strings on the same line, the second of which is optional.
- QueueName
- QueueManagerName
If the QueueManagerName is omitted, system defaults are used for this value. It is a fatal program error if MQ deal loading is attempted and the mq.conf file cannot be found or parsed.
From 6/15/2000, any line whose first non-whitespace character is '#' is treated as a comment line. The first non-comment line is decoded as described above. All subsequent non-comment lines are used to supply name mapping values for the namemap script transform, each such "mapping" line comprising two whitespace separated tokens, the first being the "from" name and the second being the "to" name. Since the output from the namemap script transform is used to drive the mq_write script transform (which uses the savearea to denote the queue name to be used) the script function
should be called after this namemap transform and before mq_write is called..
The MQ deal loader script will repeatedly attempt to place the most recently available deal record from the SI stream on the designated MQ queue until a successful return is received from the MQPUT() function. Once a successful return value is received from this function, ctksi will allow the SI deal server to move on to the next available deal. It may take up to two minutes (while SI TCP-IP comms are reset) for a failed deal load to be repeated. This mode of operation obviates the need for the bank's client application to be running all the time and allows MQ to act as the reliable delivery mechanism for SI-originated deals.
The ctksi MQ loader holds an MQ queue manager connection open (if possible) once a connection is established. If the queue manager connection is dropped for any reason, ctksi attempts to reestablish the connection with the next deal that is received from the SI TCP-IP stream. Writing to an MQ queue is accomplished using the mq_write script transform.
For your convenience an environment variable MQSERVER has been included (but commented out) in the ~softek/ctksi/set_my_env file. This variable should be configured according to IBM's instructions, to allow a connection to the bank's remote MQ server that is hosting the QueueName selected in the mq.conf configuration file.
Any MQ errors that are detected are reported in the ctksi logfile together with the IBM MQ reason code. If an MQ client is loaded on your browsing system this link (UNIX) may work to get you to a description of IBM's reason codes.
Any record structure into any tables with any (reasonable) data transformations. See here for more details.
CTK_TCPMESSAGES and
CTK_TCPMSGDUMP
each enable a new feature.
If CTK_TCPMSGDUMP is set to a writeable filename, ctksi will append a timestamped record of all TCP-IP data transmissions to the designated file.
If CTK_TCPMESSAGES is set to a readable filename, ctksi will use the contents of this file in place of the designated TCP-IP stream and will replay the input portion of this file as if it came from the TCP-IP stream. Records will be received into ctksi with the same tempo as they were stored in the file. Please note that this is a fairly dumb replay mechanism. The original record order (including any repeats) will be faithfully replayed into ctksi even if different server behavior would subsequently be appropriate.
The output from CTK_TCPMSGDUMP is usable as input into CTK_TCPMESSAGES. The easiest way to create a properly formatted CTK_TCPMESSAGES file is to run (or have someone else run) ctksi with a value set in the CTK_TCPMSGDUMP environment variable.
Ctksi will automatically quit when an available data stream from a CTK_TCPMESSAGES file has been exhausted. It is often useful to wait for a couple of PING messages to appear in this file when it is created (or edit them in by hand) for the replay mechanism to have enough time to flush the ctksi TOF deal cache.
The file ~softek/ctksi/set_my_env contains a commented-out template for these two environment variables.
For some, as yet unknown, reason, if the SI TCP-IP server suffers a power failure, ctksi's select() calls return no error condition to inform us of the communication outage. To circumvent this problem, versions of ctksi after the above availability date, implement an active "heartbeat" check. If an SI heartbeat has not been received within a reasonable time (usually two minutes), a complete reset of ctksi's TCP-IP subsystem is performed and a new connection is attempted with fresh sockets. This reset is repeated about every two minutes until a heartbeat from the SI server is reestablished.
A facility has been implemented that works with Cognotec's strategy for automatic TCP-IP failure recovery. Every time the TCP-IP channel is reset (either automatically, perhaps due to a heartbeat failure, or manually by restarting the interface) the environment variable CTK_VIRTUALHOSTNAME is looked up and, if it exists, it is used instead of the IP program argument for Cognotec server connects. To disable this feature, either comment out the CTK_VIRTUALHOSTNAME entry in the ~softek/bin/set_my_env file or set the value of this variable to an nonexistent host (one not present in the Operating System's hosts database).
To further increase the fail-safe nature of this interface and ensure that no deals are lost, processing of the TOF dls file of multipart allocation deals is performed in two stages:
- all changes are made to a temporary file in the deals directory
- the contents of the temporary file is appended to the TOF deal file and then the temporary file is deleted.
If, when the interface starts up, if TOF deal-file writing was interrupted during the processing of a multipart deal, the cache file that the TOF deal-file creation scripts were being run against will still be present and processing will begin anew. The old temporary file is deleted and a new one is created, eventually, processing will complete and both the temporary file and the cachefile will be deleted. During this, recovery scenario, the originating SI deal has been acknowledged and the only record of the deal is within the ctksi SPARCstation.
If, for any reason, the SI sends a deal that was a duplicate of the deal most recently processed by ctksi, this is detected and an ACK is sent back to the SI with no further processing on the part of ctksi. If this response (ACK) warrants a "Back Office Reference", the reference is obtained from the file ~softek/cache/lastbor.dat which is written by ctksi whenever a Back Office Reference number is generated.
When ctksi starts up, any currently cached but time-expired TOF deals are processed into the TOF dealfile. If a file called priority.dat exists in the cache directory (~softek/ctksi/cache) the content of this file is used as the cachefile to process first. The presence of this file at ctksi startup may indicate that a prior run of ctksi was interrupted before a Back Office Reference associated deal was fully processed. Ctksi is designed to recover from this scenario.