** This thread discusses the article: Hex to Character Conversion Revisited **
When converting from char to hex, the source length should be twice the Char input length, not the Char input length. Jim
** This thread discusses the article: Hex to Character Conversion Revisited **
When converting from char to hex, the source length should be twice the Char input length, not the Char input length. Jim
** This thread discusses the article: Hex to Character Conversion Revisited **
In the article you state: cvthc converts from character value to hexadecimal text (that is, from 'A' to X'C1'). I feel that this may be incorrect. 'A' is the same as x'C1' Is it not correct to state: ... (that is, from 'A' to x'FCF1' or 'C1')
** This thread discusses the article: Hex to Character Conversion Revisited **
I have a need to convert EBCDIC characters to ASCII Hex (A123 = x'41313233'). Can these routines convert among CCSID's? Any other way to do this other than Select/When?
** This thread discusses the article: Hex to Character Conversion Revisited **
Thanks Bob. The cvtch and cvthc functions only work on 0-9, A-F. I need to be able to convert the entire character set, including non-alphanumeric characters (i.e. "-/.#" etc.). Any suggestions?
** This thread discusses the article: Hex to Character Conversion Revisited **
Bob, Thanks very much, yet again, for this valuable technique. I would like to utilize it now in my auditing. Could you please give a example of the Calc specs used to perform this conversion? I need to take any variable and convert it, as in a program dump which shows both Character and Hexidecimal for the variable. Many, many Thanks, Paul H. Harkins
** This thread discusses the article: Hex to Character Conversion Revisited **
Bob, how can I specify a codepage (CCSID) there ? I ask because different codepages mean different characters. For example the hex value X'7C' means in codepage 1141 the value "§" and in codepage 1153 the value "@". BR, Konni
** This thread discusses the article: Hex to Character Conversion Revisited **
The meaning of the data doesn't matter to the API. If you have a byte with the value x'7C', the toHex function will give '7C', no matter how x'7C' might appear if you display it.
** This thread discusses the article: Hex to Character Conversion Revisited **
Simple example attached...
Code
** This thread discusses the article: Hex to Character Conversion Revisited **
Phil, Many thanks for the complete example. The convert to and from Hex routines would make great BIFs for IBM in RPGLE. Best Regards, Paul H. Harkins
** This thread discusses the article: Hex to Character Conversion Revisited **
I am trying to go from a 128 hex field to a 64 character field. I assume I would only need part of the code you offered (see below)? What I don't understand is how the fields: szCharVal, szHexVal, nSrcLen and len, inCharVal, ouCharVal, inHexVal, ouHexVal relate to each other? What field would I plug in the 128 hex field and what field would return the 64 character field? THank you.
Code