# Help with Decode Re: Decimals

**URL:** <https://forum.fixtrading.org/t/help-with-decode-re-decimals/1142>\
**Category:** General Q&A\
**Tags:** xid\_169785, imported, fast-protocol\
**Created:** [February 13, 2010, 11:00pm UTC](https://forum.fixtrading.org/t/help-with-decode-re-decimals/1142 "2010-02-13T23:00:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasonbraswell\_x](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@jasonbraswell\_x](https://forum.fixtrading.org/u/jasonbraswell_x)\
**Post date:** [February 13, 2010, 11:00pm UTC](https://forum.fixtrading.org/t/help-with-decode-re-decimals/1142/1 "2010-02-13T23:00:57Z")

</div>

Imported from previous forum

---

<div class="post-metadata">

**Author:** ![jasonbraswell\_x](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@jasonbraswell\_x](https://forum.fixtrading.org/u/jasonbraswell_x)\
**Post date:** [February 13, 2010, 11:00pm UTC](https://forum.fixtrading.org/t/help-with-decode-re-decimals/1142/2 "2010-02-13T23:00:57Z")

</div>

I’ve read the other threads dealing with decimals and pmaps, but I’m still stumped with a recent decode problem. Below is a snippet of production data that I tried to parse the other day; it’s the first element of a sequence. The bits are on the left, and my reading of the pmap status is on the far right.

My problem is that for the very last field, tag 451, there is no initial value in the template for the exponent. Also, if I’m reading it correctly, the pmap bit is turned off for this field (because all pmaps end with an infinite string of zeros). This means the exponent can’t be null, which means I’m supposed to read the mantissa. However, as you can see, it appears that the mantissa field is lined up with what looks like a null value on the wire. Even if it’s not a null value, just a zero value, what can I do with a decimal that has no exponent? I’m thinking I _must_ be reading that first pmap incorrectly.

Help would be greatly appreciated. Thanks.

11110011 Pmap   
10110000 MandatoryDefault EntryType(269) Y   
10000001 OptionalDefault PriceExp(270) Y   
01111110 11100010 MandatoryDelta PriceMant(270) N/A  
10001011 OptionalDelta EntrySize(271) N/A  
10000000 OptionalDefault QuoteCond(276) Y  
OptionalConstant TradeCond(277) N  
OptionalCopy PriceLevel(1023) N   
10000010 OptionalCopy NumOrders(346) Y  
10000000 OptionalDefault TradingSessID(277) Y  
OptionalDelta TradeVol(1020) N   
OptionalDefault Tick Direction(274) N   
OptionalDefault NetChangeExp(451) N   
10000000 MandatoryDelta NetChangeMantissa(451) N/A   
11110101 (Should be next Pmap)

---

<div class="post-metadata">

**Author:** ![romanholovakha\_x](https://avatars.discourse-cdn.com/v4/letter/r/8e7dd6/32.png) [@romanholovakha\_x](https://forum.fixtrading.org/u/romanholovakha_x)\
**Post date:** [February 15, 2010, 3:39pm UTC](https://forum.fixtrading.org/t/help-with-decode-re-decimals/1142/3 "2010-02-15T15:39:41Z")

</div>

Hi Jason,

From your post:

My problem is that for the very last field, tag 451, there is no initial value in the template for the exponent.  
Also, if I’m reading it correctly, the pmap bit is turned off for this field (because all pmaps end with an infinite string of zeros).

> > This is correct.

This means the exponent can’t be null, which means I’m supposed to read the mantissa.

> > This is incorrect. In your template exponent is Optional Default filed which means it can be null. (Please review the Table 3.2 on this page [http://jettekfix.com/node/47](http://jettekfix.com/node/47))  
> > In your case exponent is null (as does not present in the stream and does not have initial value). ([http://jettekfix.com/node/76](http://jettekfix.com/node/76))  
> > So if exponent is null we does not decode mandatory field at all. The null decoded value of Exponent means null of complex decimal value. (Please read the notes after the image 3.20 on this page [http://jettekfix.com/node/58](http://jettekfix.com/node/58))

In such case your table should look like:

11110011 Pmap  
10110000 MandatoryDefault EntryType(269) Y  
10000001 OptionalDefault PriceExp(270) Y  
01111110 11100010 MandatoryDelta PriceMant(270) N/A  
10001011 OptionalDelta EntrySize(271) N/A  
10000000 OptionalDefault QuoteCond(276) Y  
OptionalConstant TradeCond(277) N  
OptionalCopy PriceLevel(1023) N  
10000010 OptionalCopy NumOrders(346) Y  
10000000 OptionalDefault TradingSessID(277) Y  
OptionalDelta TradeVol(1020) N  
OptionalDefault Tick Direction(274) N  
OptionalDefault NetChangeExp(451) N  
MandatoryDelta NetChangeMantissa(451) N/A  
10000000 (Should be next Pmap)

11110101 (the first field in the fields group)

* * *

Best regards, Roman

> I’ve read the other threads dealing with decimals and pmaps, but I’m  
> still stumped with a recent decode problem. Below is a snippet of  
> production data that I tried to parse the other day; it’s the first  
> element of a sequence. The bits are on the left, and my reading of the  
> pmap status is on the far right.
> 
> My problem is that for the very last field, tag 451, there is no initial  
> value in the template for the exponent. Also, if I’m reading it  
> correctly, the pmap bit is turned off for this field (because all pmaps  
> end with an infinite string of zeros). This means the exponent can’t be  
> null, which means I’m supposed to read the mantissa. However, as you can  
> see, it appears that the mantissa field is lined up with what looks like  
> a null value on the wire. Even if it’s not a null value, just a zero  
> value, what can I do with a decimal that has no exponent? I’m thinking I  
> _must_ be reading that first pmap incorrectly.
> 
> Help would be greatly appreciated. Thanks.
> 
> 11110011 Pmap 10110000 MandatoryDefault EntryType(269) Y 10000001  
> OptionalDefault PriceExp(270) Y 01111110 11100010 MandatoryDelta  
> PriceMant(270) N/A 10001011 OptionalDelta EntrySize(271) N/A 10000000  
> OptionalDefault QuoteCond(276) Y OptionalConstant TradeCond(277) N  
> OptionalCopy PriceLevel(1023) N 10000010 OptionalCopy NumOrders(346) Y  
> 10000000 OptionalDefault TradingSessID(277) Y OptionalDelta  
> TradeVol(1020) N OptionalDefault Tick Direction(274) N OptionalDefault  
> NetChangeExp(451) N 10000000 MandatoryDelta NetChangeMantissa(451) N/A  
> 11110101 (Should be next Pmap)

---

<div class="post-metadata">

**Author:** ![jasonbraswell\_x](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@jasonbraswell\_x](https://forum.fixtrading.org/u/jasonbraswell_x)\
**Post date:** [February 15, 2010, 4:30pm UTC](https://forum.fixtrading.org/t/help-with-decode-re-decimals/1142/4 "2010-02-15T16:30:23Z")

</div>

OK, I understand now. I was thinking there was a difference between a value being null and it being empty. In particular, I was assuming it could only be null if a null value was actually sent on the wire.

Got it. Thanks.

> Hi Jason,
> 
> From your post:
> 
> My problem is that for the very last field, tag 451, there is no initial  
> value in the template for the exponent. Also, if I’m reading it  
> correctly, the pmap bit is turned off for this field (because all pmaps  
> end with an infinite string of zeros).
> 
> > > This is correct.
> 
> This means the exponent can’t be null, which means I’m supposed to read  
> the mantissa.
> 
> > > This is incorrect. In your template exponent is Optional Default  
> > > filed which means it can be null. (Please review the Table 3.2 on  
> > > this page [http://jettekfix.com/node/47](http://jettekfix.com/node/47))  
> > > In your case exponent is null (as does not present in the stream and  
> > > does not have initial value). ([http://jettekfix.com/node/76](http://jettekfix.com/node/76)) So if  
> > > exponent is null we does not decode mandatory field at all. The null  
> > > decoded value of Exponent means null of complex decimal value. (Please  
> > > read the notes after the image 3.20 on this page  
> > > [http://jettekfix.com/node/58](http://jettekfix.com/node/58))
> 
> In such case your table should look like:
> 
> 11110011 Pmap 10110000 MandatoryDefault EntryType(269) Y 10000001  
> OptionalDefault PriceExp(270) Y 01111110 11100010 MandatoryDelta  
> PriceMant(270) N/A 10001011 OptionalDelta EntrySize(271) N/A 10000000  
> OptionalDefault QuoteCond(276) Y OptionalConstant TradeCond(277) N  
> OptionalCopy PriceLevel(1023) N 10000010 OptionalCopy NumOrders(346) Y  
> 10000000 OptionalDefault TradingSessID(277) Y OptionalDelta  
> TradeVol(1020) N OptionalDefault Tick Direction(274) N OptionalDefault  
> NetChangeExp(451) N MandatoryDelta NetChangeMantissa(451) N/A 10000000  
> (Should be next Pmap)
> 
> 11110101 (the first field in the fields group)
> 
> * * *
> 
> Best regards, Roman
> 
> > I’ve read the other threads dealing with decimals and pmaps, but I’m  
> > still stumped with a recent decode problem. Below is a snippet of  
> > production data that I tried to parse the other day; it’s the first  
> > element of a sequence. The bits are on the left, and my reading of the  
> > pmap status is on the far right.
> > 
> > My problem is that for the very last field, tag 451, there is no  
> > initial value in the template for the exponent. Also, if I’m reading  
> > it correctly, the pmap bit is turned off for this field (because all  
> > pmaps end with an infinite string of zeros). This means the exponent  
> > can’t be null, which means I’m supposed to read the mantissa. However,  
> > as you can see, it appears that the mantissa field is lined up with  
> > what looks like a null value on the wire. Even if it’s not a null  
> > value, just a zero value, what can I do with a decimal that has no  
> > exponent? I’m thinking I _must_ be reading that first pmap  
> > incorrectly.
> > 
> > Help would be greatly appreciated. Thanks.
> > 
> > 11110011 Pmap 10110000 MandatoryDefault EntryType(269) Y 10000001  
> > OptionalDefault PriceExp(270) Y 01111110 11100010 MandatoryDelta  
> > PriceMant(270) N/A 10001011 OptionalDelta EntrySize(271) N/A 10000000  
> > OptionalDefault QuoteCond(276) Y OptionalConstant TradeCond(277) N  
> > OptionalCopy PriceLevel(1023) N 10000010 OptionalCopy NumOrders(346) Y  
> > 10000000 OptionalDefault TradingSessID(277) Y OptionalDelta  
> > TradeVol(1020) N OptionalDefault Tick Direction(274) N OptionalDefault  
> > NetChangeExp(451) N 10000000 MandatoryDelta NetChangeMantissa(451) N/A  
> > 11110101 (Should be next Pmap)

---

<div class="post-metadata">

**Author:** ![rolfandersson58\_x](https://avatars.discourse-cdn.com/v4/letter/r/b9e5f3/32.png) [@rolfandersson58\_x](https://forum.fixtrading.org/u/rolfandersson58_x)\
**Post date:** [February 16, 2010, 9:41am UTC](https://forum.fixtrading.org/t/help-with-decode-re-decimals/1142/5 "2010-02-16T09:41:28Z")

</div>

Jason,

TradeVol seems to be defined as an optional delta in which case it doesn’t have a pmap bit and the value is always present in the stream (NULL or not).

As a consequence the last 10000000 byte in the snippet is the TradeVol value (a NULL in this case) and the 11110101 is the pmap of the next message.

BTW, which feed is this snippet from?

Best,  
Rolf
