Re: [U2] Null character causes odd UV behaviour
Have you tried setting the SQLNULL value in the uvconfig? The Euro character can have werd results if this is left at 128. John Hester wrote: I'm just curious if anyone can shed some like on this odd behaviour I'm seeing with the ASCII null character (128) in a UV string variable. We have bidirectional sync between UV and MS SQL 2005 over ODBC, and it's possible to get the null character back from the SQL side. It doesn't happen under normal circumstances, but is within the realm of possibility. I guard against it with: CONVERT CHAR(128) TO '' IN VARNAME This worked fine when originally implemented (UV 9.5.1 I think), but now it seems to be broken (UV 10.2.7 on RH EL 5.1). We're testing an upgrade of our CRM software on the SQL side, and a developer was testing trigger changes that caused some fields to be sent to UV as null instead of empty strings. This caused a program which tries to build a file ID from one of these variables to abort on the READ statement. I put in some print statements for debugging, and I'm getting very odd results. Here's the code: 0089: CONVERT CHAR(128) TO '' IN STATE 0090: STATE = UPCASE(STATE) 0091: PRINT 'STATE = ':STATE:'' 0092: PRINT 'LEN(STATE) = ':LEN(STATE) 0093: PRINT 'SEQ(STATE[1,1]) = ':SEQ(STATE[1,1]) 0094: IF STATE = '' THEN 0095: PRINT 'UV THINKS STATE IS AN EMPTY STRING' 0096: END ELSE 0097: PRINT 'UV DOES NOT THINK STATE IS AN EMPTY STRING' 0098: END 0099: READV DUM FROM FILE.CF, 'STA*':STATE, 1 ELSE and here's the output it produces: STATE = LEN(STATE) = 0 SEQ(STATE[1,1]) = UV DOES NOT THINK STATE IS AN EMPTY STRING Program PGMCR1001: Line 99, Improper data type. I can eliminate the error with the following code: STATE2 = '' FOR I = 1 TO LEN(STATE) STATE2 := STATE[I,1] NEXT I STATE = STATE2 Is this a bug? It looks that way to me. -John ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users -- View this message in context: http://www.nabble.com/Null-character-causes-odd-UV-behaviour-tp25482734p25679744.html Sent from the U2 - Users mailing list archive at Nabble.com. ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Null character causes odd UV behaviour
If you are trying to see if the value is null, try @NULL. Brenda L Price UniVerse Programmer Rapid Response Team Market America, Inc. Greensboro, NC -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- boun...@listserver.u2ug.org] On Behalf Of John Hester Sent: Wednesday, September 16, 2009 8:54 PM To: U2 Users List Subject: Re: [U2] Null character causes odd UV behaviour -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Baakkonen, Rodney A (Rod) 46K Sent: Wednesday, September 16, 2009 5:16 PM To: U2 Users List Subject: Re: [U2] Null character causes odd UV behaviour Try SWAP instead of CONVERT. I can't find any UV documentation on the syntax for SWAP, and it what I tried wouldn't compile, but it looks like UV BASIC just can't see the null character as a character. Thanks to a suggestion from Laure Hansen I tried writing the value out to a file, and it is definitely character 128: Top. : P 0001: ^128 Bottom at line 1. I was able to work around it with: IF LEN(STATE) = 0 THEN STATE = '' Seems like a bug to me, though. Thanks, John ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Null character causes odd UV behaviour
I think the other option for the SWAP statement is the CHANGE function. e.g. STATE = CHANGE(STATE, CHAR(128), ) This must be pretty old because the argument order is different than most everything else. HTH, Bill Baakkonen, Rodney A (Rod) 46K said the following on 9/16/2009 6:21 PM: I think if you looked at the hex values of Char(128) you would see two characters. Convert will only change one character for another (same size). Swap will change characters of any size to characters of any size. SWAP CHAR(128) WITH IN STATE should work if I remember right. -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of IT-Laure Hansen Sent: Wednesday, September 16, 2009 7:58 PM To: 'u2-users@listserver.u2ug.org' Subject: Re: [U2] Null character causes odd UV behaviour Indeed. I'd call IBM or my VAR if I were you. And thanks for the mention! Laure Hansen, City of Redwood City I.T. Tel: 650-780-7087 Cell: 650-207-3235 - Original Message - From: u2-users-boun...@listserver.u2ug.org u2-users-boun...@listserver.u2ug.org To: U2 Users List u2-users@listserver.u2ug.org Sent: Wed Sep 16 17:54:12 2009 Subject: Re: [U2] Null character causes odd UV behaviour -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Baakkonen, Rodney A (Rod) 46K Sent: Wednesday, September 16, 2009 5:16 PM To: U2 Users List Subject: Re: [U2] Null character causes odd UV behaviour Try SWAP instead of CONVERT. I can't find any UV documentation on the syntax for SWAP, and it what I tried wouldn't compile, but it looks like UV BASIC just can't see the null character as a character. Thanks to a suggestion from Laure Hansen I tried writing the value out to a file, and it is definitely character 128: Top. : P 0001: ^128 Bottom at line 1. I was able to work around it with: IF LEN(STATE) = 0 THEN STATE = '' Seems like a bug to me, though. Thanks, John ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
[U2] Null character causes odd UV behaviour
I'm just curious if anyone can shed some like on this odd behaviour I'm seeing with the ASCII null character (128) in a UV string variable. We have bidirectional sync between UV and MS SQL 2005 over ODBC, and it's possible to get the null character back from the SQL side. It doesn't happen under normal circumstances, but is within the realm of possibility. I guard against it with: CONVERT CHAR(128) TO '' IN VARNAME This worked fine when originally implemented (UV 9.5.1 I think), but now it seems to be broken (UV 10.2.7 on RH EL 5.1). We're testing an upgrade of our CRM software on the SQL side, and a developer was testing trigger changes that caused some fields to be sent to UV as null instead of empty strings. This caused a program which tries to build a file ID from one of these variables to abort on the READ statement. I put in some print statements for debugging, and I'm getting very odd results. Here's the code: 0089: CONVERT CHAR(128) TO '' IN STATE 0090: STATE = UPCASE(STATE) 0091: PRINT 'STATE = ':STATE:'' 0092: PRINT 'LEN(STATE) = ':LEN(STATE) 0093: PRINT 'SEQ(STATE[1,1]) = ':SEQ(STATE[1,1]) 0094: IF STATE = '' THEN 0095: PRINT 'UV THINKS STATE IS AN EMPTY STRING' 0096: END ELSE 0097: PRINT 'UV DOES NOT THINK STATE IS AN EMPTY STRING' 0098: END 0099: READV DUM FROM FILE.CF, 'STA*':STATE, 1 ELSE and here's the output it produces: STATE = LEN(STATE) = 0 SEQ(STATE[1,1]) = UV DOES NOT THINK STATE IS AN EMPTY STRING Program PGMCR1001: Line 99, Improper data type. I can eliminate the error with the following code: STATE2 = '' FOR I = 1 TO LEN(STATE) STATE2 := STATE[I,1] NEXT I STATE = STATE2 Is this a bug? It looks that way to me. -John ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Null character causes odd UV behaviour
Try SWAP instead of CONVERT. -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of John Hester Sent: Wednesday, September 16, 2009 6:28 PM To: U2 Users List Subject: [U2] Null character causes odd UV behaviour I'm just curious if anyone can shed some like on this odd behaviour I'm seeing with the ASCII null character (128) in a UV string variable. We have bidirectional sync between UV and MS SQL 2005 over ODBC, and it's possible to get the null character back from the SQL side. It doesn't happen under normal circumstances, but is within the realm of possibility. I guard against it with: CONVERT CHAR(128) TO '' IN VARNAME This worked fine when originally implemented (UV 9.5.1 I think), but now it seems to be broken (UV 10.2.7 on RH EL 5.1). We're testing an upgrade of our CRM software on the SQL side, and a developer was testing trigger changes that caused some fields to be sent to UV as null instead of empty strings. This caused a program which tries to build a file ID from one of these variables to abort on the READ statement. I put in some print statements for debugging, and I'm getting very odd results. Here's the code: 0089: CONVERT CHAR(128) TO '' IN STATE 0090: STATE = UPCASE(STATE) 0091: PRINT 'STATE = ':STATE:'' 0092: PRINT 'LEN(STATE) = ':LEN(STATE) 0093: PRINT 'SEQ(STATE[1,1]) = ':SEQ(STATE[1,1]) 0094: IF STATE = '' THEN 0095: PRINT 'UV THINKS STATE IS AN EMPTY STRING' 0096: END ELSE 0097: PRINT 'UV DOES NOT THINK STATE IS AN EMPTY STRING' 0098: END 0099: READV DUM FROM FILE.CF, 'STA*':STATE, 1 ELSE and here's the output it produces: STATE = LEN(STATE) = 0 SEQ(STATE[1,1]) = UV DOES NOT THINK STATE IS AN EMPTY STRING Program PGMCR1001: Line 99, Improper data type. I can eliminate the error with the following code: STATE2 = '' FOR I = 1 TO LEN(STATE) STATE2 := STATE[I,1] NEXT I STATE = STATE2 Is this a bug? It looks that way to me. -John ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Null character causes odd UV behaviour
-Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Baakkonen, Rodney A (Rod) 46K Sent: Wednesday, September 16, 2009 5:16 PM To: U2 Users List Subject: Re: [U2] Null character causes odd UV behaviour Try SWAP instead of CONVERT. I can't find any UV documentation on the syntax for SWAP, and it what I tried wouldn't compile, but it looks like UV BASIC just can't see the null character as a character. Thanks to a suggestion from Laure Hansen I tried writing the value out to a file, and it is definitely character 128: Top. : P 0001: ^128 Bottom at line 1. I was able to work around it with: IF LEN(STATE) = 0 THEN STATE = '' Seems like a bug to me, though. Thanks, John ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Null character causes odd UV behaviour
Indeed. I'd call IBM or my VAR if I were you. And thanks for the mention! Laure Hansen, City of Redwood City I.T. Tel: 650-780-7087 Cell: 650-207-3235 - Original Message - From: u2-users-boun...@listserver.u2ug.org u2-users-boun...@listserver.u2ug.org To: U2 Users List u2-users@listserver.u2ug.org Sent: Wed Sep 16 17:54:12 2009 Subject: Re: [U2] Null character causes odd UV behaviour -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Baakkonen, Rodney A (Rod) 46K Sent: Wednesday, September 16, 2009 5:16 PM To: U2 Users List Subject: Re: [U2] Null character causes odd UV behaviour Try SWAP instead of CONVERT. I can't find any UV documentation on the syntax for SWAP, and it what I tried wouldn't compile, but it looks like UV BASIC just can't see the null character as a character. Thanks to a suggestion from Laure Hansen I tried writing the value out to a file, and it is definitely character 128: Top. : P 0001: ^128 Bottom at line 1. I was able to work around it with: IF LEN(STATE) = 0 THEN STATE = '' Seems like a bug to me, though. Thanks, John ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Null character causes odd UV behaviour
Have you tried CONVERT @NULL.STR TO IN STATE (for info on @NULL.STR see @variables in the BASIC help file) -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of IT-Laure Hansen Sent: Thursday, 17 September 2009 8:58 AM To: 'u2-users@listserver.u2ug.org' Subject: Re: [U2] Null character causes odd UV behaviour Indeed. I'd call IBM or my VAR if I were you. And thanks for the mention! Laure Hansen, City of Redwood City I.T. Tel: 650-780-7087 Cell: 650-207-3235 - Original Message - From: u2-users-boun...@listserver.u2ug.org u2-users-boun...@listserver.u2ug.org To: U2 Users List u2-users@listserver.u2ug.org Sent: Wed Sep 16 17:54:12 2009 Subject: Re: [U2] Null character causes odd UV behaviour -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Baakkonen, Rodney A (Rod) 46K Sent: Wednesday, September 16, 2009 5:16 PM To: U2 Users List Subject: Re: [U2] Null character causes odd UV behaviour DISCLAIMER: Disclaimer. This e-mail is private and confidential. If you are not the intended recipient, please advise us by return e-mail immediately, and delete the e-mail and any attachments without using or disclosing the contents in any way. The views expressed in this e-mail are those of the author, and do not represent those of this company unless this is clearly indicated. You should scan this e-mail and any attachments for viruses. This company accepts no liability for any direct or indirect damage or loss resulting from the use of any attachments to this e-mail. ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Null character causes odd UV behaviour
It may also be worth playing with the RAW.INPUT and/or RAW.OUTPUT compiler directives: eg. BASIC BP progname RAW.INPUT RAW.OUTPUT These directives alter how system delimiters are mapped (I'm not sure whether null counts as a system delimiter) DISCLAIMER: Disclaimer. This e-mail is private and confidential. If you are not the intended recipient, please advise us by return e-mail immediately, and delete the e-mail and any attachments without using or disclosing the contents in any way. The views expressed in this e-mail are those of the author, and do not represent those of this company unless this is clearly indicated. You should scan this e-mail and any attachments for viruses. This company accepts no liability for any direct or indirect damage or loss resulting from the use of any attachments to this e-mail. ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Null character causes odd UV behaviour
-Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Womack, Adrian Sent: Wednesday, September 16, 2009 6:06 PM To: U2 Users List Subject: Re: [U2] Null character causes odd UV behaviour Have you tried CONVERT @NULL.STR TO IN STATE (for info on @NULL.STR see @variables in the BASIC help file) I don't have an easy way to test that at the moment since my workaround resulted in all the bad data getting cleared out. I would expect the same result, though, since @NULL.STR is just a placeholder for CHAR(128). The really odd thing is that this code didn't produce any errors: 0001: OPEN 'CF' TO FILE.CF ELSE STOPM 'NO CF FILE' 0002: STATE = CHAR(128) 0003: CONVERT CHAR(128) TO '' IN STATE 0004: READV DUM FROM FILE.CF, 'STA*':STATE, 1 ELSE NULL Same file, same character, same ID, but the character didn't come over from SQL via ODBC. Apparently the one I got from SQL was a special CHAR(128). -John ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Null character causes odd UV behaviour
-Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Womack, Adrian Sent: Wednesday, September 16, 2009 6:13 PM To: U2 Users List Subject: Re: [U2] Null character causes odd UV behaviour It may also be worth playing with the RAW.INPUT and/or RAW.OUTPUT compiler directives: eg. BASIC BP progname RAW.INPUT RAW.OUTPUT These directives alter how system delimiters are mapped (I'm not sure whether null counts as a system delimiter) I'll have to try that after we can get some null character fields back in on the SQL side. Thanks, John ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Null character causes odd UV behaviour
I think if you looked at the hex values of Char(128) you would see two characters. Convert will only change one character for another (same size). Swap will change characters of any size to characters of any size. SWAP CHAR(128) WITH IN STATE should work if I remember right. -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of IT-Laure Hansen Sent: Wednesday, September 16, 2009 7:58 PM To: 'u2-users@listserver.u2ug.org' Subject: Re: [U2] Null character causes odd UV behaviour Indeed. I'd call IBM or my VAR if I were you. And thanks for the mention! Laure Hansen, City of Redwood City I.T. Tel: 650-780-7087 Cell: 650-207-3235 - Original Message - From: u2-users-boun...@listserver.u2ug.org u2-users-boun...@listserver.u2ug.org To: U2 Users List u2-users@listserver.u2ug.org Sent: Wed Sep 16 17:54:12 2009 Subject: Re: [U2] Null character causes odd UV behaviour -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Baakkonen, Rodney A (Rod) 46K Sent: Wednesday, September 16, 2009 5:16 PM To: U2 Users List Subject: Re: [U2] Null character causes odd UV behaviour Try SWAP instead of CONVERT. I can't find any UV documentation on the syntax for SWAP, and it what I tried wouldn't compile, but it looks like UV BASIC just can't see the null character as a character. Thanks to a suggestion from Laure Hansen I tried writing the value out to a file, and it is definitely character 128: Top. : P 0001: ^128 Bottom at line 1. I was able to work around it with: IF LEN(STATE) = 0 THEN STATE = '' Seems like a bug to me, though. Thanks, John ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users