Start of change

HEX-OF

The HEX-OF function returns an alphanumeric character string consisting of the bytes of the input argument converted to a hexadecimal representation.

The type of the function is alphanumeric.

Format

Read syntax diagramSkip visual syntax diagramFUNCTION HEX-OF(argument-1 )
argument-1
Can be a data item, literal, or intrinsic function result of any data class. argument-1 identifies the source character string for the conversion.

The returned value is an alphanumeric character string consisting of the bytes of argument-1 converted to a hexadecimal representation. The length of the output character string in bytes is two times the length of argument-1 in bytes.

Examples

  • FUNCTION HEX-OF('Hello, world!') returns 'C8859393966B40A6969993845A'
  • 01 BIN PIC 9(9) BINARY VALUE 12.
    .
    .
    
    FUNCTION HEX-OF(BIN) returns '0000000C'
  • 01 PAC PIC 9(5) COMP-3 VALUE 12345.
    .
    .
    FUNCTION HEX-OF(PAC) returns '12345F'
  • 01 ZON PIC 9(5) VALUE 12345.
    .
    .
    FUNCTION HEX-OF(ZON) returns 'F1F2F3F4F5'
  • FUNCTION HEX-OF(FUNCTION NATIONAL-OF(' ')) returns '0020'
End of change