@@ -43,6 +43,7 @@ class EncodedSession(Session):
4343 putScaledTime -- Appends a Scaled Time value to the message.
4444 putScaledTimestamp -- Appends a Scaled Timestamp value to the message.
4545 putScaledDate -- Appends a Scaled Date value to the message.
46+ putScaledCount2 -- Appends a scaled and signed decimal to the message
4647 putValue -- Determines the probable type of the value and calls the supporting function.
4748 getInt -- Read the next Integer value off the session.
4849 getScaledInt -- Read the next Scaled Integer value off the session.
@@ -396,6 +397,11 @@ def putScaledInt(self, value):
396397 value += 0
397398 scale = abs (value .as_tuple ()[2 ])
398399 valueStr = toSignedByteString (int (value * decimal .Decimal (10 ** scale )))
400+
401+ #If our length is more than 9 bytes we will need to send the data using ScaledCount2
402+ if len (valueStr ) > 9 :
403+ return self .putScaledCount2 (value )
404+
399405 packed = chr (protocol .SCALEDLEN0 + len (valueStr )) + chr (scale ) + valueStr
400406 self .__output += packed
401407 return self
@@ -531,6 +537,15 @@ def putScaledDate(self, value):
531537 self .__output += packed
532538 return self
533539
540+ def putScaledCount2 (self , value ):
541+ """ Appends a scaled and signed decimal to the message """
542+ scale = abs (value .as_tuple ()[2 ])
543+ sign = "1" if value .as_tuple ()[0 ] == 0 else "-1"
544+ value = toSignedByteString (int (value * decimal .Decimal (10 ** scale )))
545+ packed = chr (protocol .SCALEDCOUNT2 ) + chr (scale ) + sign + chr (len (value )) + value
546+ self .__output += packed
547+ return self
548+
534549 def putValue (self , value ):
535550 """Determines the probable type of the value and calls the supporting function."""
536551 if value is None :
0 commit comments