IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.


#Sterling
#Supplychain
 View Only
Expand all | Collapse all

need help - hexadecimal to decimal conversion

  • 1.  need help - hexadecimal to decimal conversion

    Posted 12/03/10 08:34 AM

    Originally posted by: rajom777


    Hi,

    Iam using WTX8.2 build 77,

    i am trying to convert a hexadecimal value to a decimal value but not sure what function to use.

    Input : <Minimum>A100000B200000</Minimum>
    Output field is number, decimal.

    I tried the below:

    =TONUMBER(TOBASETEN( HEXTEXTTOSTREAM(Minimum), 16))

    Please help, thanks

    Raj
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 2.  Re: need help - hexadecimal to decimal conversion

    Posted 12/05/10 03:15 AM

    Originally posted by: rajom777


    i used TOBASETEN(Minimum,16) and it works.
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 3.  Re: need help - hexadecimal to decimal conversion

    Posted 03/18/14 11:34 AM

    Originally posted by: Tanya11


    hi, Can you please let me know how did you read A100000B200000 value( Properties in the type tree?).

    When I am trying to read Hex value it is reading each letter as 1 byte. But for my requiremnt is it should read it as A1(1010 0001) 00 (0000 0000).... as I need it for bit manipulation.


    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 4.  Re: need help - hexadecimal to decimal conversion

    Posted 03/19/14 11:23 AM
      |   view attached

    Originally posted by: paul.brett


    I have created an example.  Output is:

    161 0 0 11 32 0 0

    Follow me on Twitter


    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange

    Attachment(s)

    zip
    Hex.zip   9 KB 1 version


  • 5.  Re: need help - hexadecimal to decimal conversion

    Posted 03/25/14 01:43 PM

    Originally posted by: Tanya11


    Thanks for sharing the map. Can you please help me understand how the F_EACHHEXPAIR() function is defined. Is it a user defined function? If so, Where do you refer it and code it? I have never used a user defined function before. It would be realy appreciated if you can explain me in detail.

     

     


    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 6.  Re: need help - hexadecimal to decimal conversion

    Posted 03/25/14 01:54 PM

    Originally posted by: paul.brett


    F_EachHexPair() is a functional map call.  If you're not sure what a functional map is, I suggest the following presentation:

    IBM WebSphere Transformation Extender for the Absolute Beginner

    ...and in particular, the 'My Second Map' example.

    Thank-you.

    Paul.

    Follow me on Twitter


    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 7.  Re: need help - hexadecimal to decimal conversion

    Posted 03/25/14 03:47 PM

    Originally posted by: Tanya11


    Hi Paul,

    I understand how the functional map is working now.

    But my requiremnet is diffreent. When we are converting the HEX to decimal here ( in my eg, I am converting 82( HEX) it is converted to 130 (decimal) which is correct but it is taking 3 bytes.)

    I am trying to build a map to read ISO8583 message. I am supposd to read the first 16 bytes of data ( which will have 32 numbers 82 20 00 00 00...) I am supposed to read the remaining fields based on the bits in this 16 bytes.

    8220000000

    1000 0010 0010 0000 which means 1,7,11 fields are available.

    I am using teston() function to check for the bits and construted the type tree. Before, I read the bitmap as text , the 3rd and 4rth bits were being 1 in the first byte.

    Now, when I am using TESTON(TOBASETEN()) , the first 8 bits are coming as 0s.

    Can you please help in reading the data as HEX.

     

    Previously, I tried reading the bitmap as number, text with different combinations


    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 8.  Re: need help - hexadecimal to decimal conversion

    Posted 03/26/14 05:28 AM
      |   view attached

    Originally posted by: paul.brett


    Your input data is 8220000000

    82 = 130.  130 written to disk as a binary 0x82 comes out as a comma.

    , = 10000010

    20 = 32.  32 written to disk as a binary 0x20 comes out as a space.

      = 00100000

    Please see the enclosed pair of maps which demonstrate this process


    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender

    Attachment(s)

    zip
    Bits.zip   19 KB 1 version


  • 9.  Re: need help - hexadecimal to decimal conversion

    Posted 03/26/14 05:30 AM

    Originally posted by: paul.brett


    Run Test1 followed by Test2, and review the ouput file Output2.txt for the final result.  Output1.txt contains an intermediate result.

    Thanks.

    Paul

    Follow me on Twitter

     


    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 10.  Re: need help - hexadecimal to decimal conversion

    Posted 03/26/14 10:54 AM
      |   view attached

    Originally posted by: Tanya11


    Thanks paul. Its working now.

    Yesterday I was trying with teston(tobaseten)) or teston(text(tobeseten()).. by using symbol, I am getting the required binary data now.

     I have an other question here, previously, i tried using HEXTEXTTOSTREAM.. my input data is 82200000000000000400000100000000 and the output is (, **************) I have added symbol'*' in place of special caracter looks like square. but when I am using teston(hextexttostream, my first 8 bits are 0s. I just want tounderstand why its not working. I am attaching the map and the trace below.


    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender

    Attachment(s)

    zip
    sample.zip   39 KB 1 version


  • 11.  Re: need help - hexadecimal to decimal conversion

    Posted 03/26/14 12:15 PM

    Originally posted by: paul.brett


    The result of HEXTEXTTOSTREAM() is text.

    TESTON() will require a binary number object.

    Paul.

    Follow me on Twitter


    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 12.  Re: need help - hexadecimal to decimal conversion

    Posted 03/26/14 03:05 PM

    Originally posted by: Tanya11


    But the result of the symbol() is also a text. Right?

    Syntax: SYMBOL ( single-integer-expression ) Meaning: SYMBOL ( decimal_value ) Returns: A single one-byte text item

    and the result of the hexttexttostream() is a stream. But in the output file I am seeing the result as same for symbol(tobaseten()) and hextexttostream().then why is the binary values different.


    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 13.  Re: need help - hexadecimal to decimal conversion

    Posted 03/27/14 04:39 AM

    Originally posted by: paul.brett


    TESTON() will require a binary number object.

    Passing in text from other functions will produce unpredictable (and not necessarily consistent) results.


    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 14.  Re: need help - hexadecimal to decimal conversion

    Posted 04/08/14 02:09 PM

    Originally posted by: Tanya11


    Hi Paul,

    Thanks for the clear explanation. I really apreciate the help.

    I have another question regardng the error handling.

    I have the requirement as follows: When the input ISO message validation failes, we are supposed to send the field_name which failed the validation in the output message.

    Is there any way that we can get the filed which failed validation.


    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 15.  Re: need help - hexadecimal to decimal conversion

    Posted 04/09/14 03:26 AM

    Originally posted by: paul.brett


    There are multiple ways to do this, and they are almost always horribly complicated.  I believe the subject would not be possible to cover adequately in this forum.  I recommend you get some onsite mapping assistance from a more experienced mapper.

    Thank-you.

    Paul

    Follow me on Twitter


    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender