Elementary data types

This section contains information about data types used in the MQI (or in exit functions). These are described in detail, followed by examples showing how to declare the elementary data types in the supported programming languages in the following topics.

The data types used in the MQI (or in exit functions) are either:

  • Elementary data types, or
  • Aggregates of elementary data types (arrays or structures)

The following elementary data types are used in the MQI (or in exit functions):

Elementary data type name Data type Description
MQBOOL Boolean

The MQBOOL data type represents a boolean value. The value 0 represents false. Any other value represents true. An MQBOOL must be aligned as for the MQLONG data type.

MQBYTE Byte

The MQBYTE data type represents a single byte of data. No particular interpretation is placed on the byte; it is treated as a string of bits, and not as a binary number or character. No special alignment is required.

When MQBYTE data is sent between queue managers that use different character sets or encodings, the MQBYTE data is not converted in any way. The MsgId and CorrelId fields in the MQMD structure are like this.

An array of MQBYTE is sometimes used to represent an area of main storage that is not known to the queue manager. For example, the area might contain application message data or a structure. The boundary alignment of this area must be compatible with the nature of the data contained within it.

In the C programming language, any data type can be used for function parameters that are shown as arrays of MQBYTE. This is because such parameters are always passed by address, and in C the function parameter is declared as a pointer-to-void.

MQBYTEn String of n bytes

Each MQBYTEn data type represents a string of n bytes, where n can take any of the following values: 8, 16, 24, 32, 40, or 128. Each byte is described by the MQBYTE data type. No special alignment is required.

If the data in the byte string is shorter than the defined length of the string, the data must be padded with nulls to fill the string.

When the queue manager returns byte strings to the application (for example, on the MQGET call), the queue manager pads with nulls to the defined length of the string.

Named constants are available to define the lengths of byte string fields. These are listed in Constants

MQCHAR Character

The MQCHAR data type represents a single-byte character, or one byte of a double-byte or multi-byte character. No special alignment is required.

When MQCHAR data is sent between queue managers that use different character sets or encodings, the MQCHAR data usually requires conversion in order for the data to be interpreted correctly. The queue manager does this automatically for MQCHAR data in the MQMD structure. Conversion of MQCHAR data in the application message data is controlled by the MQGMO_CONVERT option specified on the MQGET call; see the description of this option in MQGMO - Get-message options for further details.

MQCHARn String of n characters

Each MQCHARn data type represents a string of n characters, where n can take any of the following values: 4, 8, 12, 20, 28, 32, 48, 64, 128, or 256. Each character is described by the MQCHAR data type. No special alignment is required.

If the data in the string is shorter than the defined length of the string, the data must be padded with blanks to fill the string. In some cases a null character can be used to end the string prematurely, instead of padding with blanks; the null character and characters following it are treated as blanks, up to the defined length of the string. The places where a null can be used are identified in the call and data type descriptions.

When the queue manager returns character strings to the application (for example, on the MQGET call), the queue manager always pads with blanks to the defined length of the string; the queue manager does not use the null character to delimit the string.

Named constants are available that define the lengths of character string fields and are listed in Constants.

MQFLOAT32 32-bit floating point number

The MQFLOAT32 data type is a 32-bit floating-point number represented using the standard IEEE floating-point format. An MQFLOAT32 must be aligned on a 4-byte boundary.

The use of MQFLOAT32 in C on z/OS requires the use of the FLOAT(IEEE) compiler flag.

The use of MQFLOAT32 in COBOL is limited to compilers that support floating-point numbers in IEEE format. This might require the use of the FLOAT(NATIVE) compiler flag.

MQFLOAT64 64-bit floating point number

The MQFLOAT64 data type is a 64-bit floating-point number represented using the standard IEEE floating-point format. An MQFLOAT64 must be aligned on an 8-byte boundary.

The use of MQFLOAT64 in C on z/OS requires the use of the FLOAT(IEEE) compiler flag.

The use of MQFLOAT64 in COBOL is limited to compilers that support floating-point numbers in IEEE format. This might require the use of the FLOAT(NATIVE) compiler flag.

MQHCONFIG Configuration handle

The MQHCONFIG data type represents a configuration handle, that is, the component that is being configured for a particular installable service. A configuration handle must be aligned on its natural boundary.

Applications must not rely on the format of the data stored inside this handle. If valid, its value is intended to be usable in further MQI calls, but is not intended to have any meaning besides that purpose.

MQHCONN Connection handle

The MQHCONN data type represents a connection handle, that is, the connection to a particular queue manager. A connection handle must be aligned on a 4-byte boundary.

Applications must not rely on the format of the data stored inside this handle. If valid, its value is intended to be usable in further MQI calls, but is not intended to have any meaning besides that purpose.

MQHMSG Message handle

The MQHMSG data type represents a message handle that gives access to a message. A message handle must be aligned on an 8-byte boundary.

Applications must not rely on the format of the data stored inside this handle. If valid, its value is intended to be usable in further MQI calls, but is not intended to have any meaning besides that purpose.

MQHOBJ Object handle

The MQHOBJ data type represents an object handle that gives access to an object. An object handle must be aligned on a 4-byte boundary.

Applications must not rely on the format of the data stored inside this handle. If valid, its value is intended to be usable in further MQI calls, but is not intended to have any meaning besides that purpose.

MQINT8 8-bit signed integer The MQINT8 data type is an 8-bit signed integer that can take any value in the range -128 to +127, unless otherwise restricted by the context.
MQINT16 16-bit signed integer The MQINT16 data type is a 16-bit signed integer that can take any value in the range -32 768 to +32 767, unless otherwise restricted by the context. An MQINT16 must be aligned on a 2-byte boundary.
MQINT32 32-bit signed integer

The MQINT32 data type is a 32-bit signed binary integer that can take any value in the range -2 147 483 648 through +2 147 483 647, unless otherwise restricted by the context.

See the definition of MQLONG.

MQINT64 64-bit signed integer

The MQINT64 data type is a 64-bit signed integer that can take any value in the range -9 223 372 036 854 775 808 through +9 223 372 036 854 775 807, unless otherwise restricted by the context.

For COBOL, the valid range is limited to -999 999 999 999 999 999 through +999 999 999 999 999 999. A 64-bit integer must be aligned on an 8-byte boundary.

MQLONG 32-bit signed integer

The MQLONG data type is a 32-bit signed binary integer that can take any value in the range -2 147 483 648 through +2 147 483 647, unless otherwise restricted by the context.

For COBOL, the valid range is limited to -999 999 999 through +999 999 999. An MQLONG must be aligned on a 4-byte boundary.

MQPID Process identifier

The IBM MQ process identifier.

This is the same identifier used in MQ trace and FFST™ dumps, but might be different from the operating system process identifier.

MQPTR Pointer

The MQPTR data type is the address of data of any type. A pointer must be aligned on its natural boundary; this is a 16-byte boundary on IBM i, and an 8-byte boundary on other platforms.

Some programming languages support typed pointers; the MQI also uses these in a few cases (for example, PMQCHAR and PMQLONG in the C programming language).

MQTID Thread identifier

The IBM MQ thread identifier.

This is the same identifier used in MQ trace and FFST™ dumps, but might be different from the operating system thread identifier.

MQUINT8 8-bit unsigned integer The MQUINT8 data type is an 8-bit unsigned integer that can take any value in the range 0 to +255, unless otherwise restricted by the context.
MQUINT16 16-bit unsigned integer The MQUINT16 data type is a 16-bit unsigned integer that can take any value in the range 0 through +65 535, unless otherwise restricted by the context. An MQUINT16 must be aligned on a 2-byte boundary.
MQUINT32 32-bit unsigned integer

The MQUINT32 data type is a 32-bit unsigned binary integer.

See the definition of MQULONG.

MQUINT64 64-bit unsigned integer

The MQINT64 data type is a 64-bit unsigned integer that can take any value in the range 0 through +18 446 744 073 709 551 615, unless otherwise restricted by the context.

For COBOL, the valid range is limited to 0 through +999 999 999 999 999 999. A 64-bit integer must be aligned on an 8-byte boundary.

MQULONG 32-bit unsigned integer

The MQULONG data type is a 32-bit unsigned binary integer that can take any value in the range 0 through +4 294 967 294, unless otherwise restricted by the context.

For COBOL, the valid range is limited to 0 through +999 999 999. An MQULONG must be aligned on a 4-byte boundary.

PMQACH Pointer Pointer to a data structure of type MQACH
PMQAIR Pointer Pointer to a data structure of type MQAIR
PMQAXC Pointer Pointer to a data structure of type MQAXC
PMQAXP Pointer Pointer to a data structure of type MQAXP
PMQBMHO Pointer Pointer to a data structure of type MQBMHO
PMQBO Pointer Pointer to a data structure of type MQBO
PMQBOOL Pointer Pointer to data of type MQBOOL
PMQBYTE Pointer Pointer to data of type MQBYTE
PMQBYTEn Pointer Pointer to data of type MQBYTEn, where n can be 8, 16, 24, 32, 40, 128
PMQCBC Pointer Pointer to a data structure of type MQCBC
PMQCBD Pointer Pointer to a data structure of type MQCBD
PMQCHAR Pointer Pointer to data of type MQCHAR
PMQCHARN Pointer Pointer to a data type of MQCHARN, where n can be 4, 8, 12, 20, 28, 32, 48, 64, 128, 256, 264
PMQCHARV Pointer Pointer to a data structure of type MQCHARV
PMQCIH Pointer Pointer to a data structure of type MQCIH
PMQCMHO Pointer Pointer to a data structure of type MQCMHO
PMQCNO Pointer Pointer to a data structure of type MQCNO
PMQCSP Pointer Pointer to a data structure of type MQCSP
PMQCTLO Pointer Pointer to a data structure of type MQCTLO
PMQDH Pointer Pointer to a data structure of type MQDH
PMQDHO Pointer Pointer to a data structure of type MQDHO
PMQDLH Pointer Pointer to a data structure of type MQDLH
PMQDMHO Pointer Pointer to a data structure of type MQDMHO
PMQDMPO Pointer Pointer to a data structure of type MQDMPO
PMQEPH Pointer Pointer to a data structure of type MQEPH
PMQFLOAT32 Pointer Pointer to a data structure of type MQFLOAT32
PMQFLOAT64 Pointer Pointer to a data structure of type MQFLOAT64
PMQFUNC Pointer Pointer to a function
PMQGMO Pointer Pointer to a data structure of type MQGMO
PMQHCONFIG Pointer Pointer to data of type MQHCONFIG
PMQHCONN Pointer Pointer to data of type MQHCONN
PMQHMSG Pointer Pointer to data of type MQHMSG
PMQHOBJ Pointer Pointer to data of type MQHOBJ
PMQIIH Pointer Pointer to a data structure of type MQIIH
PMQIMPO Pointer Pointer to a data structure of type MQIMPO
PMQINT8 Pointer Pointer to data of type MQINT8
PMQINT16 Pointer Pointer to data of type MQINT16
PMQINT32 Pointer Pointer to data of type MQINT32
PMQINT64 Pointer Pointer to data of type MQINT64
PMQLONG Pointer Pointer to data of type MQLONG
PMQMD Pointer Pointer to structure of type MQMD
PMQMDE Pointer Pointer to a data structure of type MQMDE
PMQMD1 Pointer Pointer to a data structure of type MQMD1
PMQMD2 Pointer Pointer to a data structure of type MQMD2
PMQMHBO Pointer Pointer to a data structure of type MQMHBO
PMQOD Pointer Pointer to a data structure of type MQOD
PMQOR Pointer Pointer to a data structure of type MQOR
PMQPD Pointer Pointer to a data structure of type MQPD
PMQPID Pointer Pointer to a process identifier
PMQMD Pointer Pointer to a data structure of type MQMD
PMQPMO Pointer Pointer to a data structure of type MQPMO
PMQPTR Pointer Pointer to data of type MQPTR
PMQRFH Pointer Pointer to a data structure of type MQRFH
PMQRFH2 Pointer Pointer to a data structure of type MQRFH2
PMQRMH Pointer Pointer to a data structure of type MQRMH
PMQRR Pointer Pointer to a data structure of type MQRR
PMQSCO Pointer Pointer to a data structure of type MQSCO
PMQSD Pointer Pointer to a data structure of type MQSD
PMQSMPO Pointer Pointer to a data structure of type MQSMPO
PMQSRO Pointer Pointer to a data structure of type MQSRO
PMSSTS Pointer Pointer to a data structure of type MQSTS
PMQTID Pointer Pointer to a thread ID
PMQTM Pointer Pointer to a data structure of type MQTM
PMQTMC2 Pointer Pointer to a data structure of type MQTMC2
PMQUINT8 Pointer Pointer to a data type of MQUINT8
PMQUINT16 Pointer Pointer to a data type of MQUINT16
PMQUINT32 Pointer Pointer to a data type of MQUINT32
PMQUINT64 Pointer Pointer to a data type of MQUINT64
PMQULONG Pointer Pointer to a data type of MQULONG
PMQVOID Pointer  
PMQWIH Pointer Pointer to a data structure of type MQWIH
PMQXQH Pointer Pointer to a data structure of type MQXQH

Parent topic: Introducing data types used in the MQI