display HEX variable with the SAY command 
Author Message
 display HEX variable with the SAY command

Using REXX for MVS, how can I display a variable that contains
unprintable characters in it's HEX equivilant.

var1 may contain the first 4 bytes of a record in a file (x'00234577')
and I want to display the contents of var1 in character format.

I want to display 00234567.

D. Rodd
NBTel

506 694-6393



Mon, 12 Feb 2001 03:00:00 GMT  
 display HEX variable with the SAY command

Quote:

>Using REXX for MVS, how can I display a variable that contains
>unprintable characters in it's HEX equivilant.

say c2x(avariable)
--

------ http://www.comlab.ox.ac.uk/oucl/users/ian.collier/imc.html

New to this group?  Answers to frequently-asked questions can be had from
http://rexx.hursley.ibm.com/rexx/ .



Mon, 12 Feb 2001 03:00:00 GMT  
 display HEX variable with the SAY command
Quote:


> >Using REXX for MVS, how can I display a variable that contains
> >unprintable characters in it's HEX equivilant.

> say c2x(avariable)
> --

> ------ http://www.comlab.ox.ac.uk/oucl/users/ian.collier/imc.html

> New to this group?  Answers to frequently-asked questions can be had from
> http://rexx.hursley.ibm.com/rexx/ .

Tried that and that prints the hex for the string not the value
contained in the variable. If the variable var1 contains 0123 then I
want to display the value 0123 not E5C1D9F1 which is var1.

D Rodd



Mon, 12 Feb 2001 03:00:00 GMT  
 display HEX variable with the SAY command
I am thinking you have it backwards maybe,
does the file contain hex chars, like a hex dump or something.
You do the opposite in this case
say x2c(ahexcharstring)
say ahexstring
would show the converted string and show original on next line
However if any of the resultant characters are unprintable you won't see
them.
Quote:
> Tried that and that prints the hex for the string not the value
> contained in the variable. If the variable var1 contains 0123 then I
> want to display the value 0123 not E5C1D9F1 which is var1.

> D Rodd



Mon, 12 Feb 2001 03:00:00 GMT  
 display HEX variable with the SAY command
Quote:

> I am thinking you have it backwards maybe,
> does the file contain hex chars, like a hex dump or something.
> You do the opposite in this case
> say x2c(ahexcharstring)
> say ahexstring
> would show the converted string and show original on next line
> However if any of the resultant characters are unprintable you won't see
> them.

> > Tried that and that prints the hex for the string not the value
> > contained in the variable. If the variable var1 contains 0123 then I
> > want to display the value 0123 not E5C1D9F1 which is var1.

> > D Rodd

The file contains as the first record:
----+----1----+----2----+----3----+----4----+
********************************* TOP OF DATA
   q                                    I3209
0009000040000000000000000000000000000000CFFFF
00F800000000000000000000000000000000000193209

If I use
var1 = substr(r.1,3,2)
var2 = substr(r.1,41,5)
say var1
will display a blank followed by a lower case q
say var2
will display I3209 which is good.
What I want to display with var1 is 0F98
How do I do that?

D Rodd



Mon, 12 Feb 2001 03:00:00 GMT  
 display HEX variable with the SAY command
say c2x(var1)
should work
Quote:
> The file contains as the first record:
> ----+----1----+----2----+----3----+----4----+
> ********************************* TOP OF DATA
>    q                                    I3209
> 0009000040000000000000000000000000000000CFFFF
> 00F800000000000000000000000000000000000193209

> If I use
> var1 = substr(r.1,3,2)
> var2 = substr(r.1,41,5)
> say var1
> will display a blank followed by a lower case q
> say var2
> will display I3209 which is good.
> What I want to display with var1 is 0F98
> How do I do that?

> D Rodd



Mon, 12 Feb 2001 03:00:00 GMT  
 display HEX variable with the SAY command
Quote:

> say c2x(var1)
> should work
> > The file contains as the first record:
> > ----+----1----+----2----+----3----+----4----+
> > ********************************* TOP OF DATA
> >    q                                    I3209
> > 0009000040000000000000000000000000000000CFFFF
> > 00F800000000000000000000000000000000000193209

> > If I use
> > var1 = substr(r.1,3,2)
> > var2 = substr(r.1,41,5)
> > say var1
> > will display a blank followed by a lower case q
> > say var2
> > will display I3209 which is good.
> > What I want to display with var1 is 0F98
> > How do I do that?

> > D Rodd

I wish it was that simple, but it isn't. That displays the hex
equivilant of var1 not the contents of var1. Have you actually tried
this?
D Rodd


Mon, 12 Feb 2001 03:00:00 GMT  
 display HEX variable with the SAY command
I'm afraid it is that simple.
You mean it is displaying hex values of VAR1
Either you have quotes around the variable name or you haven't made an
assignment to the variable name VAR1 yet.
If nothing is assigned to var1, it would have value of VAR1.
I just tried the equivalent it in kedit (don't have access to MVS), it
works fine,

var1 = '0f98'x
say var1
say c2x(var1)



Mon, 12 Feb 2001 03:00:00 GMT  
 display HEX variable with the SAY command

Quote:


>> say c2x(avariable)
>Tried that and that prints the hex for the string not the value
>contained in the variable. If the variable var1 contains 0123 then I
>want to display the value 0123 not E5C1D9F1 which is var1.

I assure you that if var1 contains '0123' then "say c2x(var1)" will
produce 'F0F1F2F3' as you desire and not 'E5C1D9F1'.

If it says 'E5C1D9F1' then var1 has not been set properly (either that
or there is a peculiar bug in the Rexx interpreter).  Try replacing it
with "say var1" and you should see that it says 'VAR1'.

imc



Mon, 12 Feb 2001 03:00:00 GMT  
 display HEX variable with the SAY command

Quote:



>> >Using REXX for MVS, how can I display a variable that contains
>> >unprintable characters in it's HEX equivilant.

>> say c2x(avariable)
>> --

>Tried that and that prints the hex for the string not the value
>contained in the variable. If the variable var1 contains 0123 then I
>want to display the value 0123 not E5C1D9F1 which is var1.

>D Rodd

Try say c2x(value(variable)) and see what that gives you.

Regards,
Doug McKibbin
(remove NOSPAM from address when emailing)



Mon, 12 Feb 2001 03:00:00 GMT  
 display HEX variable with the SAY command

Quote:

}The hex equivalent of 0123 is C0C1C2C3. See the results of executing a test
}case:
}
}      3 *-* var1 = '0123'
}        >L>   "0123"
}      4 *-* say c2x(var1)
}        >V>   "0123"
}        >F>   "F0F1F2F3"
} F0F1F2F3
}
}I suspect that you misspelled the name of the variable and that it was
}uninitialized.
}
}Shmuel (Seymour J.) Metz

I don't know how all this started but ASCII for '0123' is '30313233' and
EBCDIC is 'F0F1F2F3'.

Bye
Dennis

--------------------------------
Dennis Bareis
Melbourne, AUSTRALIA.

HomePage: http://www.ozemail.com.au/~dbareis
          - Contains heaps of FREE OS/2, DOS & WIN32 programs.
          - Heaps of COMMENTED OS/2, HTML, Java and other links
          - Some source code and programmers links.  Regina Information (including porting from OS/2)
          - Examples of the freeware (you won't find it elsewhere):
            * PPWIZARD (HTML/REXX/generic preprocessor - #define, #include, #import, #if)
              You WILL NOT find an easier to use or more powerful preprocessor than PPWIZARD.
              So far everyone who has said "PPWIZARD can't do this" has been wrong!
            * Icon for single OS/2 archive on following boot
            * REXX compiler
            * PM/Program manipulation by Window or Switch list title
            * Prevent a floppy in drive stopping boot off hard disk
            * About 20 more...
--------------------------------



Thu, 15 Feb 2001 03:00:00 GMT  
 display HEX variable with the SAY command
Quote:

> I'm afraid it is that simple.
> You mean it is displaying hex values of VAR1
> Either you have quotes around the variable name or you haven't made an
> assignment to the variable name VAR1 yet.
> If nothing is assigned to var1, it would have value of VAR1.
> I just tried the equivalent it in kedit (don't have access to MVS), it
> works fine,

> var1 = '0f98'x
> say var1
> say c2x(var1)

Hey. That works great. I had a hard time getting my thinking around the
fact that I had a hex value to display and the function is for convert
character to hex. My logic is thinking I want to convert hex to
character.
Anyway I finally have it working and I thank you for putting me straight
on this as well for all the help from all the other people who have
helped me with this problem.

Regards and thanks again
D Rodd



Fri, 16 Feb 2001 03:00:00 GMT  
 
 [ 12 post ] 

 Relevant Pages 

1. display HEX variable with the SAY co

2. From Hex Display to Hex number

3. Hex to Bin, Bin to Hex, Hex to Dec, Dec to Hex

4. no display name and no $DISPLAY environment variable

5. no display name and no $DISPLAY environment variable -- ????

6. Displaying default values with @..SAY..GETs

7. problem: display command output / kill command

8. instructor says this command illegel, help

9. display number in hex?

10. text.text and Hex display on string controls

11. changing @ say get Variable with Valid Clause

12. How to display Hex Wave in labVIEW screen

 

 
Powered by phpBB® Forum Software