Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Appu

New User


Joined: 26 Apr 2010
Posts: 74
Location: India

PostPosted: Wed Jul 29, 2015 11:01 am    Post subject: How to get same hex chars as given by 'HEX ON' command ?
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Wed Jul 29, 2015 11:50 am    Post subject: Reply to: How to get same hex chars as given by 'HEX ON' command ?
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: 74
Location: India

PostPosted: Wed Jul 29, 2015 12:12 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed Jul 29, 2015 12:27 pm    Post subject: Reply to: How to get same hex chars as given by 'HEX ON' command ?
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: 1218
Location: Israel

PostPosted: Wed Jul 29, 2015 5:41 pm    Post subject:
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

Senior Member


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

PostPosted: Wed Jul 29, 2015 9:45 pm    Post subject: Reply to: How to get same hex chars as given by 'HEX ON' command ?
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts SDSF Command Avtrix CLIST & REXX 4 Fri Sep 30, 2016 11:13 am
No new posts How to find a CICS resource used in C... Arunkumar Chandrasekaran CICS 8 Thu Sep 29, 2016 1:45 pm
No new posts COMPARE command sivatechdrive TSO/ISPF 7 Fri Sep 16, 2016 4:31 pm
No new posts I am unable to use SWAPBAR ON command... mrsidhu12 TSO/ISPF 3 Thu Sep 01, 2016 1:10 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us