View previous topic :: View next topic |
Author |
Message |
MVS_blob Beginner
Joined: 23 Oct 2007 Posts: 23 Topics: 9
|
Posted: Tue Jul 15, 2008 6:55 pm Post subject: REXX: Hex to Character Conversion Problem |
|
|
Hi all,
I've got a snippet of code that converts Hex to Char.
Pretty basic...
When text = '000F', the conversion works fine.
When text = '016F', the conversion works fine.
When text = '344F', the conversion works fine.
When text = '419F', the conversion works fine.
...etc
BUT..
When text = '435F', the conversion comes out to:
Have I hit a limit? Can anyone explain this discrepency?
P.S I need to use 'F' instead of 'C' as I'm performing a comparison afterward where the hex value contains an 'F'. |
|
Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Tue Jul 15, 2008 8:43 pm Post subject: |
|
|
say c2x(x2c('435f')) seems to work fine. Can you post a small snippet of code that shows the problem start to finish? _________________ New members are encouraged to read the How To Ask Questions The Smart Way FAQ at http://www.catb.org/~esr/faqs/smart-questions.html. |
|
Back to top |
|
 |
warp5 Intermediate

Joined: 02 Dec 2002 Posts: 429 Topics: 18 Location: Germany
|
Posted: Wed Jul 16, 2008 1:02 am Post subject: |
|
|
You are converting hex values to character values and displaying them. The terminal has to be able to display those values. If you convert F1F2 you would get 12, C1C2 gives you AB, but you are converting special characters that may or may not be properly displayed on your terminal, and might be special functions. |
|
Back to top |
|
 |
MVS_blob Beginner
Joined: 23 Oct 2007 Posts: 23 Topics: 9
|
Posted: Wed Jul 16, 2008 2:38 am Post subject: REXX: Hex to Character Conversion Problem |
|
|
Interesting...
I just ran this code:
Code: | /* REXX */
TEXT1 = '419F'
TEXT2 = '435F'
TEXT1_NEW = X2C(TEXT1)
TEXT2_NEW = X2C(TEXT2)
SAY 'TEXT1:' TEXT1 'TEXT1_NEW:' TEXT1_NEW
SAY 'TEXT2:' TEXT2 'TEXT2_NEW:' TEXT2_NEW
EXIT
|
Results (HEX ON):
[code:1:91d22caa6d] TEXT1: 419F TEXT1_NEW: |
|
Back to top |
|
 |
danm Intermediate
Joined: 29 Jun 2004 Posts: 170 Topics: 73
|
Posted: Wed Jul 16, 2008 9:10 am Post subject: |
|
|
It works correctly when I ran the macro.
[code:1:a94140ae88]
TEXT1: 419F TEXT1_NEW: |
|
Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Wed Jul 16, 2008 9:25 am Post subject: |
|
|
Works for me too. Sounds like some kind of translation table problem within the ISPF setup. I don't think the setting for CAPS should matter but you might try it with CAPS ON vs CAPS OFF. Or try a different terminal type (type SETTINGS)
I tried these and it made no difference, but ... _________________ New members are encouraged to read the How To Ask Questions The Smart Way FAQ at http://www.catb.org/~esr/faqs/smart-questions.html. |
|
Back to top |
|
 |
MVS_blob Beginner
Joined: 23 Oct 2007 Posts: 23 Topics: 9
|
Posted: Tue Jul 22, 2008 11:00 pm Post subject: |
|
|
Geezer,
You were right. CAPS OFF fixed the problem.
Thanks!  |
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Wed Jul 23, 2008 1:16 am Post subject: |
|
|
blob,
that's semigeezer. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
MVS_blob Beginner
Joined: 23 Oct 2007 Posts: 23 Topics: 9
|
Posted: Thu Jul 24, 2008 2:23 am Post subject: |
|
|
 |
|
Back to top |
|
 |
|
|