MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

REXX: Hex to Character Conversion Problem

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
MVS_blob
Beginner


Joined: 23 Oct 2007
Posts: 23
Topics: 9

PostPosted: Tue Jul 15, 2008 6:55 pm    Post subject: REXX: Hex to Character Conversion Problem Reply with quote

Hi all,

I've got a snippet of code that converts Hex to Char.

Code:
x2c(text)


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:

Code:
Ĭ
65
3F


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
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Tue Jul 15, 2008 8:43 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
warp5
Intermediate


Joined: 02 Dec 2002
Posts: 429
Topics: 18
Location: Germany

PostPosted: Wed Jul 16, 2008 1:02 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
MVS_blob
Beginner


Joined: 23 Oct 2007
Posts: 23
Topics: 9

PostPosted: Wed Jul 16, 2008 2:38 am    Post subject: REXX: Hex to Character Conversion Problem Reply with quote

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
View user's profile Send private message
danm
Intermediate


Joined: 29 Jun 2004
Posts: 170
Topics: 73

PostPosted: Wed Jul 16, 2008 9:10 am    Post subject: Reply with quote

It works correctly when I ran the macro.
[code:1:a94140ae88]
TEXT1: 419F TEXT1_NEW:
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Wed Jul 16, 2008 9:25 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
MVS_blob
Beginner


Joined: 23 Oct 2007
Posts: 23
Topics: 9

PostPosted: Tue Jul 22, 2008 11:00 pm    Post subject: Reply with quote

Geezer,

You were right. CAPS OFF fixed the problem.

Thanks! Very Happy
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Wed Jul 23, 2008 1:16 am    Post subject: Reply with quote

blob,

that's semigeezer.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
MVS_blob
Beginner


Joined: 23 Oct 2007
Posts: 23
Topics: 9

PostPosted: Thu Jul 24, 2008 2:23 am    Post subject: Reply with quote

Mr. Green
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group