Re: [UD] 8 Bite Integers
I like to thank all of you for the information. Cheers Fawaz --- Robert Colquhoun [EMAIL PROTECTED] wrote: At 12:58 PM 5/03/2004, you wrote: That is because UV (and I presumed UD) work on two's complement integers, so the top bit flips you between a positive and a negative integer. This is why I work the algorithm with 8 bit blocks, so that bit 1 in the 32 bit integer is never 1 and so BITAND works as expected. The problem was it was using signed 64 bit integers everywhere except in these functions which seem to use 32 bit integers, as an example program on unidata: ININT=2147483648 CRT ININT = :ININT CRT BITAND(ININT, 1) = :BITAND(ININT, 1) CRT BITAND(ININT, 2^31 -1) = :BITAND(ININT, 2147483647) CRT BITAND(ININT, 2 ^31) = :BITAND(ININT, 2147483648) :TEST ININT = 2147483648 // = 2 ^ 31 BITAND(ININT, 1) = 1// should be 0 BITAND(ININT, 2^31 -1) = 2147483647 // should be 0 BITAND(ININT, 2 ^31) = 2147483647 // should be 2^32 In your program you have BITAND(ININT, 255) to strip out the smallest byte which will work if and only if ININT 2^31 I probably should report this to ibm support, but ibm outsourced our support contract recently to a third party and i am very nervous about calling them up: http://www.salon.com/tech/feature/2004/02/23/no_support/index_np.html (Sorry about the ad, but article is one of the funniest i have seen this year). - Robert -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users __ Do you Yahoo!? Yahoo! Search - Find what youre looking for faster http://search.yahoo.com -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users
RE: [UD] 8 Bite Integers
INT( AMOUNT ) ? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Fawaz Ashraff Sent: Thursday, March 04, 2004 2:43 PM To: U2 Users Discussion List Subject: RE: [UD] 8 Bite Integers Hi David, Thanks for the info. May be I didn't explain my problem correctly. I have a Unidata numeric field (Amount- 100.00 or -100.00) and I need to convert it to a 8 Bite integer so that Informix will recognise it. Cheers Fawaz --- Logan, David (SST - Adelaide) wrote: Hi Fawaz, Is this what you are looking for? SEQ function Syntax SEQ (expression) Description Use the SEQ function to convert an ASCII character to its numeric string equivalent. Expression evaluates to the ASCII character to be converted. If expression evaluates to the null value, null is returned. The SEQ function is the inverse of the CHAR function. In NLS mode, use the UNISEQ function to return Unicode values in the range x0080 through x00F8. Using the SEQ function to convert a character outside its range results in a run-time message, and the return of an empty string. For more information about these ranges, see the UniVerse NLS Guide. PICK, IN2, and REALITY Flavors In PICK, IN2, and REALITY flavors SEQ( ) is 255 instead of 0. In IDEAL and INFORMATION flavor accounts, use the SEQ.255 option of the $OPTIONS statement to cause SEQ( ) to be interpreted as 255. Example G=T A=SEQ(G) PRINT A, A+1 PRINT SEQ(G) 11-632 UniVerse BASIC /productinfo/alldoc/UNIVERSE10/basic/Ch11 1/9/02 This is the program output: 84 85 71 Regards David Logan Database Administrator HP Managed Services 139 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 +61 417 268 665 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fawaz Ashraff Sent: Friday, 5 March 2004 5:34 AM To: U2 Users Discussion List Subject: [UD] 8 Bite Integers Good Afternoon. We are moving part of our application to Informix(From Unidata). I need to convert some of the data Fields to 8 bite Integers through a UniBasic program and write it to a flat file. Having problem converting data to 8 Bite Integers. Any suggestions would be highly appreciated. Cheers Fawaz __ Do you Yahoo!? Yahoo! Search - Find what you're looking for faster http://search.yahoo.com -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users __ Do you Yahoo!? Yahoo! Search - Find what you're looking for faster http://search.yahoo.com -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users Notice of Confidentiality: The information included and/or attached in this electronic mail transmission may contain confidential or privileged information and is intended for the addressee. Any unauthorized disclosure, reproduction, distribution or the taking of action in reliance on the contents of the information is prohibited. If you believe that you have received the message in error, please notify the sender by reply transmission and delete the message without copying or disclosing it. -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users
RE: [UD] 8 Bite Integers
If the number's an integer, how about using HEX.STRING = DTX(var) to get a hexadecimal equivalent of the number in question. Fill on the left with zeros to 16 characters (8 bytes worth). Then, pick off hex characters, 2 at a time (1 byte), then do: INFORMIX.CHAR = CHAR(XTD(this.byte)) and concatenate them together into an 8-character (byte) string. One gotcha I can think of is if any of the bytes end up as a system delimiter that would cause problems in the middle of a flat file. WRITESEQ to a type-19 file or path may overcome some of those difficulties. --Ron P. -Original Message- From: Fawaz Ashraff [mailto:[EMAIL PROTECTED] Sent: Thursday, March 04, 2004 1:43 PM To: U2 Users Discussion List Subject: RE: [UD] 8 Bite Integers Hi David, Thanks for the info. May be I didn't explain my problem correctly. I have a Unidata numeric field (Amount- 100.00 or -100.00) and I need to convert it to a 8 Bite integer so that Informix will recognise it. Cheers Fawaz --- Logan, David (SST - Adelaide) wrote: Hi Fawaz, Is this what you are looking for? SEQ function Syntax SEQ (expression) Description Use the SEQ function to convert an ASCII character to its numeric string equivalent. Expression evaluates to the ASCII character to be converted. If expression evaluates to the null value, null is returned. The SEQ function is the inverse of the CHAR function. In NLS mode, use the UNISEQ function to return Unicode values in the range x0080 through x00F8. Using the SEQ function to convert a character outside its range results in a run-time message, and the return of an empty string. For more information about these ranges, see the UniVerse NLS Guide. PICK, IN2, and REALITY Flavors In PICK, IN2, and REALITY flavors SEQ( ) is 255 instead of 0. In IDEAL and INFORMATION flavor accounts, use the SEQ.255 option of the $OPTIONS statement to cause SEQ( ) to be interpreted as 255. Example G=T A=SEQ(G) PRINT A, A+1 PRINT SEQ(G) 11-632 UniVerse BASIC /productinfo/alldoc/UNIVERSE10/basic/Ch11 1/9/02 This is the program output: 84 85 71 Regards David Logan Database Administrator HP Managed Services 139 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 +61 417 268 665 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fawaz Ashraff Sent: Friday, 5 March 2004 5:34 AM To: U2 Users Discussion List Subject: [UD] 8 Bite Integers Good Afternoon. We are moving part of our application to Informix(From Unidata). I need to convert some of the data Fields to 8 bite Integers through a UniBasic program and write it to a flat file. Having problem converting data to 8 Bite Integers. Any suggestions would be highly appreciated. Cheers Fawaz __ Do you Yahoo!? Yahoo! Search - Find what you're looking for faster http://search.yahoo.com -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users __ Do you Yahoo!? Yahoo! Search - Find what you're looking for faster http://search.yahoo.com -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users
RE: [UD] 8 Bite Integers
Hi Fawaz, It really shouldn't matter. You should be able to write the data out to the flatfile and have it appear 100.00 or -100.00 and the load programs (onpload, High Performance Loader etc.) will just convert according to the schema that you have defined for that table. Can you give an example of a problem field? Regards David Logan Database Administrator HP Managed Services 139 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 +61 417 268 665 -Original Message- From: Fawaz Ashraff [mailto:[EMAIL PROTECTED] Sent: Friday, 5 March 2004 6:13 AM To: U2 Users Discussion List Cc: Logan, David (SST - Adelaide) Subject: RE: [UD] 8 Bite Integers Hi David, Thanks for the info. May be I didn't explain my problem correctly. I have a Unidata numeric field (Amount- 100.00 or -100.00) and I need to convert it to a 8 Bite integer so that Informix will recognise it. Cheers Fawaz --- Logan, David (SST - Adelaide) wrote: Hi Fawaz, Is this what you are looking for? SEQ function Syntax SEQ (expression) Description Use the SEQ function to convert an ASCII character to its numeric string equivalent. Expression evaluates to the ASCII character to be converted. If expression evaluates to the null value, null is returned. The SEQ function is the inverse of the CHAR function. In NLS mode, use the UNISEQ function to return Unicode values in the range x0080 through x00F8. Using the SEQ function to convert a character outside its range results in a run-time message, and the return of an empty string. For more information about these ranges, see the UniVerse NLS Guide. PICK, IN2, and REALITY Flavors In PICK, IN2, and REALITY flavors SEQ( ) is 255 instead of 0. In IDEAL and INFORMATION flavor accounts, use the SEQ.255 option of the $OPTIONS statement to cause SEQ( ) to be interpreted as 255. Example G=T A=SEQ(G) PRINT A, A+1 PRINT SEQ(G) 11-632 UniVerse BASIC /productinfo/alldoc/UNIVERSE10/basic/Ch11 1/9/02 This is the program output: 84 85 71 Regards David Logan Database Administrator HP Managed Services 139 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 +61 417 268 665 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fawaz Ashraff Sent: Friday, 5 March 2004 5:34 AM To: U2 Users Discussion List Subject: [UD] 8 Bite Integers Good Afternoon. We are moving part of our application to Informix(From Unidata). I need to convert some of the data Fields to 8 bite Integers through a UniBasic program and write it to a flat file. Having problem converting data to 8 Bite Integers. Any suggestions would be highly appreciated. Cheers Fawaz __ Do you Yahoo!? Yahoo! Search - Find what you're looking for faster http://search.yahoo.com -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users __ Do you Yahoo!? Yahoo! Search - Find what you're looking for faster http://search.yahoo.com -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users
Re: [UD] 8 Bite Integers
Hello, At 08:44 AM 5/03/2004, Craig Bennett wrote: LOWESTBYTE = BITAND(ININT, 255) ININT = INT(ININT/256) When trying to implement hash algorithms i noticed values 32 bits do not work properly with some of the basic functions in unidata and i think universe. Definitely MOD() and i think BITAND() had problems. - Robert -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users
Re: [UD] 8 Bite Integers
At 12:58 PM 5/03/2004, you wrote: That is because UV (and I presumed UD) work on two's complement integers, so the top bit flips you between a positive and a negative integer. This is why I work the algorithm with 8 bit blocks, so that bit 1 in the 32 bit integer is never 1 and so BITAND works as expected. The problem was it was using signed 64 bit integers everywhere except in these functions which seem to use 32 bit integers, as an example program on unidata: ININT=2147483648 CRT ININT = :ININT CRT BITAND(ININT, 1) = :BITAND(ININT, 1) CRT BITAND(ININT, 2^31 -1) = :BITAND(ININT, 2147483647) CRT BITAND(ININT, 2 ^31) = :BITAND(ININT, 2147483648) :TEST ININT = 2147483648 // = 2 ^ 31 BITAND(ININT, 1) = 1// should be 0 BITAND(ININT, 2^31 -1) = 2147483647 // should be 0 BITAND(ININT, 2 ^31) = 2147483647 // should be 2^32 In your program you have BITAND(ININT, 255) to strip out the smallest byte which will work if and only if ININT 2^31 I probably should report this to ibm support, but ibm outsourced our support contract recently to a third party and i am very nervous about calling them up: http://www.salon.com/tech/feature/2004/02/23/no_support/index_np.html (Sorry about the ad, but article is one of the funniest i have seen this year). - Robert -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users