CAST specification

The CAST specification transforms the value of one data type into another data type.

Syntax

For the syntax of the CAST statement see CAST function.

Parameters

Source expression

A CAST specification returns its first operand (source_expression) as the type specified by the second operand (the target data type). In all cases, if the source expression is NULL, the result is NULL. If the evaluated source expression is not compatible with the target data type, or if the source expression is of the wrong format, a runtime error is generated.

Not all conversions are supported; see Supported casts for a full list of supported conversions.

CCSID

The CCSID clause allows you to specify a code page. It is used for certain conversions only.

The CCSID expression can be any expression evaluating to a value of type INT. It is interpreted according to normal WebSphere Business Integration Message Broker rules for CCSIDs.

ENCODING

The ENCODING clause allows you to specify the encoding. It is used for certain conversions only. The ENCODING value can be any expression evaluating to a value of type INT. It is interpreted according to normal WebSphere Business Integration Message Broker rules for encoding. Valid values are:
  • MQENC_NATIVE (0x00000222L)
  • MQENC_INTEGER_NORMAL (0x00000001L)
  • MQENC_INTEGER_REVERSED (0x00000002L)
  • MQENC_DECIMAL_NORMAL (0x00000010L)
  • MQENC_DECIMAL_REVERSED (0x00000020L)
  • MQENC_FLOAT_IEEE_NORMAL (0x00000100L)
  • MQENC_FLOAT_IEEE_REVERSED (0x00000200L)
  • MQENC_FLOAT_S390 (0x00000300L)

Related concepts
ESQL

Related tasks
Developing ESQL
Casting data from message fields

Related reference
Complex ESQL functions
CAST function
Supported casts
Implicit casts