IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to get same hex chars as given by 'HEX ON' command ?


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Appu

New User


Joined: 26 Apr 2010
Posts: 73
Location: India

PostPosted: Wed Jul 29, 2015 11:01 am
Reply with quote

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

Superior Member


Joined: 14 Mar 2007
Posts: 10882
Location: italy

PostPosted: Wed Jul 29, 2015 11:50 am
Reply with quote

Your explanation was clear as mud icon_cool.gif

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

New User


Joined: 26 Apr 2010
Posts: 73
Location: India

PostPosted: Wed Jul 29, 2015 12:12 pm
Reply with quote

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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jul 29, 2015 12:27 pm
Reply with quote

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

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Jul 29, 2015 5:41 pm
Reply with quote

Still clear as mud... icon_sad.gif

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

Global Moderator


Joined: 01 Sep 2006
Posts: 2589
Location: Silicon Valley

PostPosted: Wed Jul 29, 2015 9:45 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts keylist key definition longer than 40... TSO/ISPF 2
No new posts REXX/CMS How to place command console... CLIST & REXX 4
No new posts Help needed in automation cics transa... CLIST & REXX 1
No new posts How to Login in to cics region and is... CICS 9
No new posts Passing containers on START command CICS 4
Search our Forums:

Back to Top