View previous topic :: View next topic
|
Author |
Message |
Appu
New User
Joined: 26 Apr 2010 Posts: 73 Location: India
|
|
|
|
Hello Team,
I am trying to read the HEX of the characters displayed in the terminal as follows :
Code: |
FIELD = SUBSTR(ZSCREENI,CURSOR,NOCHARS)
SAY 'Hex=' C2X(FIELD)
|
The code works fine in extracting the field ; but problem comes with the HEX conversion. For eg:-
Code: |
.EÜ.É.ªý.....
0C51709800020
05A614AD00102
|
For the above field, I was expecting the hex value to be the same as what we get when we make the HEX ON command.
For eg:- I expected 00C55A1671049A8D0000012002 ; but the output i got was 4BC55A4B714B9A8D4B4B4B4B4B , that means it has taken the hex of each character as I had used C2X.
So any suggestions to get the same hex value as shown by 'HEX ON ' command in the ISPF ? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10882 Location: italy
|
|
|
|
Your explanation was clear as mud
this works for me
Code: |
ch = "ABCDEF"
wk = c2x(ch)
wh = ""
wl = ""
do i = 1 to length(wk) - 1 by 2
wh = wh || substr(wk, i , 1 )
wl = wl || substr(wk, i + 1, 1 )
end
say ch
say wk
say wh
say wl
|
|
|
Back to top |
|
|
Appu
New User
Joined: 26 Apr 2010 Posts: 73 Location: India
|
|
|
|
Hi,
Thanks for the response. But your code also works exactly same as that of mine.
For eg:- in a member, type the HEX value
'00C55A1671049A8D0000012002'X
and see after reading this field and applying C2X, the hex value obtained is as follows with your code as well.
4BC55A4B714B9A8D4B4B4B4B4B |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You are taking the characters from the screen, not the data. You can't then complain that it shows you the hex of the characters.
If you want that value, you'll need to extract from the data, not the screen. Where'd you get the idea that would work? |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Still clear as mud...
However, this is what you have:
Code: |
.E!.ֵַ.ת.....
4C54749844444
B5AB1BADBBBBB |
and this is what you want:
Code: |
E! ֵַ ת
0C51709800020
05A614AD00102 |
Somebody or something has replaced the non-printable characters by a dot,
you only have to figure out when this happened and prevent it. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2589 Location: Silicon Valley
|
|
|
|
Quote: |
So any suggestions to get the same hex value as shown by 'HEX ON ' command in the ISPF ? |
You have to be more specific. 'ISPF' has several ways to show data.
I suspect you used BROWSE to display the data. Browse uses a period as a placeholder for non-display characters. Edit and View display the same data with blanks for non-display characters.
Regardless, if you are examining the screen image, as your code shows:
Code: |
FIELD = SUBSTR(ZSCREENI,CURSOR,NOCHARS)
SAY 'Hex=' C2X(FIELD) |
you will only have access to what ISPF wants to show you. You will get 40C55A4071409A8D4040404040 instead of 4BC55A4B714B9A8D4B4B4B4B4B.
The basic problem is that you are examining ISPF's carefully chosen display characters rather than the actual data. |
|
Back to top |
|
|
|