Various subroutines of the package FixUtil can be used to read fix message (tag, value pair). Fix message can be extracted. Tag and Value can be identified. Numeric Tag can be converted in to English readable format. It also provide functionality to selectively print only few tags of interest.
#!/usr/local/bin/perl package FixUtil; # GetTagValue is to convert fix message in to tag value pair. The parameter passed is single fix message or portion of a fix message. sub GetTagValue { my ($record)=@_; my @tagValuePair=split(/;/,$record); my $count=0; while ($count < @tagValuePair) { if ( $tagValuePair[$count] =~ /=/) { ($tag,$value)=split(/=/,$tagValuePair[$count]); $tagValue{$tag}=$value; } $count++; } return %tagValue; } # CleanUp is to convert a log statement to a clean fix message starting with 8=FIX and ending with 10=000 sub CleanUp { my ($record)=@_; $record=~s/^.*8=FIX/8=FIX/g; $record=~s/10=000.*$/10=000/g; return $record; } # GetHeader is to get log part before the fix message sub GetHeader { my ($record)=@_; $record=~s/8=FIX.*$//g; return $record; } # PrintTagValues is to print selected tags from TagValue hash created by GetTagValue. # $indent = (integer) number of spaces. This is useful if you would like to indent New, Cancel and Replace messages with different indentation. # $info = reference to an array which contains list of tags to be printed. e.g. the list should contain 38, 31, 32 if we are interested only in quantities. Following function will only print those three tags. # $records = reference to hash of tag value created by GetTagValue function sub PrintTagValues { my ($indent,$info,$records)=@_; my $indentation=" "; while($indent > 0) { $indentation=$indentation." "; $indent--; } my $count=0; if( $$info[0] =~ "All") { foreach $tag (keys(%{$records})) { print "$indentation $tag ($TagValuePair{$tag}) = $records->{$tag} \n"; } } else { while ($count < @{$info}) { print "$indentation $$info[$count] ($TagValuePair{$$info[$count]}) = $records->{$$info[$count]} \n"; $count++; } } print "\n"; } %TagValuePair = ( "1","Account", "2","AdvId", "3","AdvRefID", "4","AdvSide", "5","AdvTransType", "6","AvgPrice", "7","BeginSeqNo", "8","BeginString", "9","BodyLength", "10","CheckSum", "11","ClOrdID", "12","Commission", "13","CommType", "14","CumQty", "15","Currency", "16","EndSeqNo", "17","ExecID", "18","ExecInst", "19","ExecRefID", "20","ExecTransType", "21","HandlInst", "22","IDSource", "23","IOIid", "24","IOIOthSvc", "25","IOIQltyInd", "26","IOIRefID", "27","IOIShares", "28","IOITransType", "29","LastCapacity", "30","LastMkt", "31","LastPrice", "32","LastShares", "33","LinesOfText", "34","MsgSeqNum", "35","MsgType", "36","NewSeqNo", "37","OrderID", "38","OrderQty", "39","OrdStatus", "40","OrdType", "41","OrigClOrdID", "42","OrigTime", "43","PossDupFlag", "44","Price", "45","RefSeqNum", "46","RelatdSym", "47","Rule80A", "48","SecurityID", "49","SenderCompID", "50","SenderSubID" ); 1;