Page 1 of 1

Conversion of BI value

PostPosted: Wed Aug 18, 2010 8:02 pm
by rajt
Hi There !!

Can you help me in converting a 'BI' value. Here is what am using;

17,4,BI,EDIT=(STTTTTTTTT),SIGNS=('+',-,,)

The input contains a value of FFFFADCC (A database field of INTEGER type, after the database unload). After conversion it has to display the value -21044 , but i currently see the output as +4294946252;

Can you suggest;

Thank You.

Rajesh.

Re: Conversion of BI value

PostPosted: Wed Aug 18, 2010 8:42 pm
by Alissa Margulies
You seem to be missing a leading F. FFFFFADCC is equivalent to -21044. Please check your input data to make sure you are specifying the correct position and length of the field.

In order for us to better assist you, please provide us an example of the input field with the HEX display turned on.

Thank you.

Re: Conversion of BI value

PostPosted: Wed Aug 18, 2010 8:50 pm
by kiranmayipv
Hi,

Below is the data from Database for that fieled. When i query in DB2, the value is coming correct as -21044. The value in the unloaded database file is

Ýö
FFAC
FFDC

One observation is that the sort card is working fine for positive values, but when there is a negative value its showing a problem. Also can you help me out, how you are doing the converdsion.

Thanks.

Re: Conversion of BI value

PostPosted: Wed Aug 18, 2010 9:14 pm
by kiranmayipv
Adding additional info,

There are two values at same psition in the DB2 unload file.

1st value:
--------------------
FFAC
FFDC
value in file, expected O/p -21044 , but i currently see the output as +4294946252

2nd value:
------------------------
000E
0033
Value in file, expected O/p 995, I am getting output as 995

Sort card used 17,4,BI,EDIT=(STTTTTTTTT),SIGNS=('+',-,,)

Re: Conversion of BI value

PostPosted: Wed Aug 18, 2010 9:33 pm
by kiranmayipv
need help on this post plss

Re: Conversion of BI value

PostPosted: Wed Aug 18, 2010 10:13 pm
by kiranmayipv
As suggested, I submitted the sort card by giving
0FFAC
FFFDC
in the input.

O/p recieved
+0068719455692

Re: Conversion of BI value

PostPosted: Wed Aug 18, 2010 10:18 pm
by enrico-sorichetti
quoting the principle of operations

For signed binary integers, the leftmost bit represents the sign, which is followed by the numeric field. Positive numbers are represented in true binary notation with the sign bit set to zero. When the value is zero, all bits are zeros, including the sign bit. Negative numbers are represented in two's-complement binary notation with a one in the sign-bit position.


all this irrelevant of the number of bits used to represent the number

so for the case in question, interpreting the FFFFADCC as a negative 21044 seems correct

adding a semibyte simply adds confusion

just an analogy, but for DFSORT BI implies unsigned FI implies signed
check the syncsort documentation for something similar

Re: Conversion of BI value

PostPosted: Wed Aug 18, 2010 10:23 pm
by Alissa Margulies
Change BI to FI and you should get the desired results. Let me know if you continue to encounter a problem and I would be happy to further assist you.

Re: Conversion of BI value

PostPosted: Wed Aug 18, 2010 10:23 pm
by Alissa Margulies
Sorry Enrico - you posted quicker than I did. Thanks.

Re: Conversion of BI value

PostPosted: Wed Aug 18, 2010 10:27 pm
by enrico-sorichetti
nothing to be sorry Alissa
I was just suggesting an analogy to be researched, not a solution
You are the SYNCSORT expert :D