ADELIA |
VADELIA |
SADELIA |
WADELIA |
EADELIA |
(I/B) |
(I/B) |
(B) |
(I/B) |
(B) |
Description
This predefined function is used to convert a character into hexadecimal form.
Syntax
Result = &HEXA_CONVERSION(Character)
Parameters
Description |
Contents |
Controls |
|
Result |
Alphanumerical variable of 2 to 4 characters. With Unicode generation: |
Hexadecimal value of the character set as a parameter. The hexadecimal value set as: - EBCDIC for RPG generator with non-Unicode generation. The hexadecimal ABCDEF figures are given in upper case letters. - ANSI for Windows C generator with non-Unicode generation. The hexadecimal abcdef figures are given in lower case letters. - UNICODE for Java generator, Web client or with Unicode generation. The hexadecimal abcdef figures are given in lower case letters. |
|
Character |
One-character alphanumeric constant or variable. |
Character to be converted. |
Mandatory parameter. |
Note
The hexadecimal conversion of an empty string, a string previously initialized with a constant containing a blank character, or a string previously initialized with the *BLANK value returns varying results depending on the execution platform.
The table below shows all the specific results to take into account:
AS400 | WINDOWS | JAVA | ||||
---|---|---|---|---|---|---|
Unicode | single-byte (EBCDIC) | Unicode | single-byte | Unicode | single-byte | |
*BLANK, empty string or string with a blank | 0020 | 0040 or 40 | 0000 | 0000 or 00 | 0000 | 0000 |
Example
CHARACTER = 'A'
HEXA_VALUE = &HEXA_CONVERSION(CHARACTER)
* In a part generated in RPG
* HEXA_VALUE is: C1.
*
CHARACTER = 'Z'
HEXA_VALUE = &HEXA_CONVERSION(CHARACTER)
* In a program generated in Unicode
* HEXA_VALUE is: 005a.
CHARACTER = *BLANK
HEXA_VALUE = &HEXA_CONVERSION(CHARACTER)
* In a program generated in AS400 Unicode
* HEXA_VALUE is: 0020
* In a program generated in single-byte AS400
* HEXA_VALUE is: 0040
* In other cases
* HEXA_VALUE is: 0000
CHARACTER = *HIVAL
HEXA_VALUE = &HEXA_CONVERSION(CHARACTER)
* In a program generated in AS400 Unicode
* HEXA_VALUE is: ffff
* In a program generated in single-byte AS400
* HEXA_VALUE is: 00FF
* In a program generated in single-byte Windows
* HEXA_VALUE is: 00ff
* In other cases
* HEXA_VALUE is: ffff
List of predefined functions by topic