Coding in pTAL (HP Integrity NonStop Server only)

Note the information in the following section when coding IBM MQ programs in pTAL, for use with HP Integrity NonStop Server.


Defining and initializing IBM MQ structures

pTAL structure definitions for IBM MQ structures are provided with names that end with ^DEF. For example, the following pTAL declarations would be coded to create a IBM MQ Message Descriptor (MQMD) structure and a IBM MQ Put Message Options (MQPMO) structure.
STRUCT MYMD(MQMD^DEF);    ! Declare an MQMD structure
STRUCT MYPMO(MQPMO^DEF);   ! Declare an MQPMO structure
IBM MQ provides pTAL DEFINE with names that end with ^DEFAULT to initialize IBM MQ structures with default values. The following pTAL statements are coded to assign default values to the declared MQMD and the MQPMO structures:
MQMD^DEFAULT(MYMD);      ! Assign default values to an MQMD structure
MQPMO^DEFAULT(MYPMO);     ! Assign default values to an MQPMO structure

We can declare and initialize other IBM MQ structures by using similar code.


pTAL and the CRE

pTAL programs cannot initialize the Common Runtime Environment and therefore they must be used with a C-language or COBOL main routine.

The pTAL samples that are provided with IBM MQ use a C-language mainline routine that is called AMQSPTM0.C


Parameters with MQCHAR data type

The MQGET, MQPUT, and MQPUT1 procedures each have a Buffer parameter that has an MQCHAR .EXT data type. This parameter is used to send and receive the application's message data.

Parameters of this sort are shown in the pTAL samples as arrays of string. We can declare the parameters in this way, but it is typically more convenient to declare them as the structure that describes the layout of the data in the message. The procedure parameter is declared as an MQCHAR .EXT, but the address of any data can be specified as the parameter on the procedure invocation.


Manipulating character strings

When the queue manager returns character data to the application, the queue manager always pads the character data with blanks to the defined length of the field. The queue manager does not return null-terminated strings, but we can use them in your input.

Parent topic: Developing MQI applications with IBM MQ