Coding in PL/I (z/OS only)
Useful information when coding for IBM MQ in PL/I.
Structures
Structures are declared with the BASED attribute, and so do not occupy any storage unless the program declares one or more instances of a structure.
An instance of a structure can be declared using the like attribute, for example:dcl my_mqmd like MQMD; /* one instance */ dcl my_other_mqmd like MQMD; /* another one */
The structure fields are declared with the INITIAL attribute; when the like attribute is used to declare an instance of a structure, that instance inherits the initial values defined for that structure. Set only those fields where the value required is different from the initial value.
PL/I is not sensitive to case, and so the names of calls, structure fields, and constants can be coded in lowercase, uppercase, or mixed case.
Named constants
The named constants are declared as macro variables; as a result, named constants that are not referred to by the program do not occupy any storage in the compiled procedure.
However, the compiler option that causes the source to be processed by the macro preprocessor must be specified when the program is compiled.
All the macro variables are character variables, even the ones that represent numeric values. Although this might seem counter intuitive, it does not result in any data-type conflict after the macro variables have been substituted by the macro processor, for example:%dcl MQMD_STRUC_ID char; %MQMD_STRUC_ID = '''MD '''; %dcl MQMD_VERSION_1 char; %MQMD_VERSION_1 = '1';Parent topic: Developing MQI applications with IBM MQ