stevehicks has asked for the wisdom of the Perl Monks concerning the following question:
The rough guidance I have is that the format is :B2t^?\251 cEy]\213\247\3350002900262O0 NL000634286722^F^Q^S\210^F^S^S\ +210
Field Type Len
then I get :($messageType,$ProtoOrVer,$MsgLen,$MsgSeqNum,$ClOrdID,$OnBehalfOfCompI +D,$rest) =unpack "A A n B32 B64 A*",$sourceMsg};
(This looks right because OnBehalfOfCompID is in the right place) Now, given that using "n" works for the MsgLen field(length of 2 from spec and n == 16 bits on pack perldoc page) I tried using n2 on the basis that the field is supposed to be twice as long but I get the following, which is obviously wrong :08:02:43 : messageType == B 08:02:43 : ProtoOrVer == 2 08:02:43 : MsgLen == 116 08:02:43 : MsgSeqNum == 00000000000000001111111010010101 08:02:43 : ClOrdID == 000001001100011010100010100111101011101011010001 +1110010110111011 08:02:43 : OnBehalfOfCompID == 00029002 08:02:43 : rest == 62O0 NL000634286722^F^Q^S\210^F^S^S\210
On the basis that the field has a length of 4 x 8 == 32 I have also tried using combinations of "S", "L" and "N", for example :07:43:55 : messageType == B 07:43:55 : ProtoOrVer == 2 07:43:55 : MsgLen == 116 07:43:55 : MsgSeqNum == 0 07:43:55 : ClOrdID == 32681 07:43:55 : OnBehalfOfCompID == 8291 07:43:55 : rest == 17785
to which I get :($messageType,$ProtoOrVer,$MsgLen,$MsgSeqNum,$ClOrdID,$OnBehalfOfCompI +D,$rest) =unpack "A A n N N2 A*",$sourceMsg};
..which is also clearly wrong. I've had 4 hours hours sleep, I'm at my wit's end and I'm up against the wall to get this nailed today. Any help GREATLY appreciated !!08:11:45 : messageType == B 08:11:45 : ProtoOrVer == 2 08:11:45 : MsgLen == 116 08:11:45 : MsgSeqNum == 32681 08:11:45 : ClOrdID == 543376761 08:11:45 : OnBehalfOfCompID == 1569433565 08:11:45 : rest == 00029002
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Lost in unpack hell
by ikegami (Patriarch) on Feb 11, 2010 at 09:29 UTC | |
by stevehicks (Sexton) on Feb 11, 2010 at 10:43 UTC | |
by zentara (Cardinal) on Feb 11, 2010 at 12:19 UTC | |
by stevehicks (Sexton) on Feb 11, 2010 at 17:09 UTC | |
by ikegami (Patriarch) on Feb 11, 2010 at 16:00 UTC | |
by stevehicks (Sexton) on Feb 11, 2010 at 17:17 UTC | |
|
Re: Lost in unpack hell
by Anonymous Monk on Feb 11, 2010 at 08:31 UTC |