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
dar...@nbtel.nb.ca
506 694-6393
say c2x(avariable)
--
---- Ian Collier : i...@comlab.ox.ac.uk : WWW page (including REXX section):
------ 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/ .
D Rodd
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
var1 = '0f98'x
say var1
say c2x(var1)
>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
>Ian Collier wrote:
>>
>> In article <35E561...@nbtel.nb.ca>, dar...@nbtel.nb.ca wrote:
>> >Using REXX for MVS, how can I display a variable that contains
>> >unprintable characters in it's HEX equivilant.
>>
>> say c2x(avariable)
>> --
>> ---- Ian Collier : i...@comlab.ox.ac.uk : WWW page (including REXX section):
>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)
}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.
email : d...@anz.com
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...
--------------------------------
Regards and thanks again
D Rodd