Accessing the MQCFH header

Code ESQL statements to access the fields of the MQCFH header (root name MQPCF).

About this task

Messages that are of PCF format (MQPCF, MQADMIN, and MQEVENT) include the MQCFH header. You can process the contents of the MQCFH header, accessing parameters, parameter lists, strings, and groups.

The ParameterCount field is hidden from view to keep the value synchronized with the true number of parameters. As a result, you cannot directly view, access, or edit the ParameterCount field and this applies when you are using:
  • ESQL
  • The Mapping Node
  • Trace, or debugging code.

You can implement your own ParameterCount field with a specific value, but this value will be overwritten by the actual number of parameters on the flow exit.

  • To access or to construct parameters in the header, use the following syntax:
    SET OutputRoot.MQPCF.Parameter[nn] = 
     Integer parameter ID
    If you access a 64-bit parameter, use the following syntax to differentiate from 32-bit parameters:
    SET OutputRoot.MQPCF.Parameter64[nn] = 
    	Integer parameter ID
    For example:
    SET OutputRoot.MQPCF.Parameter[1] = 
    	MQCACF_AUTH_PROFILE_NAME;
  • For parameter lists, use the following syntax:
    SET OutputRoot.MQPCF.ParameterList64[nn] = 
    	Integer parameter ID
    SET OutputRoot.MQPCF.ParameterList64[nn].*[xx] = 
    	Integer parameter values
    For example:
    SET OutputRoot.MQPCF.ParameterList[1] = 
    	MQIACF_AUTH_ADD_AUTHS;
    SET OutputRoot.MQPCF.ParameterList[1].*[1] = 
    	MQAUTH_SET;
    SET OutputRoot.MQPCF.ParameterList[1].*[2] = 
    	MQAUTH_SET_ALL_CONTEXT;
  • A byte string is a byte array data type, and is supported with this syntax:
    SET OutputRoot.MQPCF.Parameter[nn] =  
    	Integer parameter ID
    SET OutputRoot.MQPCF.Parameter[nn].* = 
    	Integer, String or ByteArray Parameter value
  • A group is implemented as a folder containing more PCF, and requires the following syntax:
    SET OutputRoot.MQPCF.Group[xx] = 
    	Group Parameter ID
    For example:
    SET OutputRoot.MQPCF.Group[1] = 
    	MQGACF_Q_ACCOUNTING_DATA;
    SET OutputRoot.MQPCF.Group[1].Parameter[1] = 
    	MQCA_CREATION_DATE;
    SET OutputRoot.MQPCF.Group[1].Parameter[1].* = 
    	'2007-02-05';
    You can also use nested groups; for example;
    SET OutputRoot.MQPCF.Group[1].Group[1] = 
    	MQGACF_Q_ACCOUNTING_DATA;
    SET OutputRoot.MQPCF.Group[1].Group[1].Parameter[1] = 
    	MQCA_CREATION_DATE;
    SET OutputRoot.MQPCF.Group[1].Group[1].Parameter[1].* = 
    	'2007-02-05';
  • A filter is almost identical to a parameter, but it also includes an operator. Therefore the syntax is a tree with named values:
    SET OutputRoot.MQPCF.Filter[xx] = 
    	Integer parameter ID
    SET OutputRoot.MQPCF.Filter[xx].Operator = 
    	Integer Filter name
    SET OutputRoot.MQPCF.Filter[xx].Value = 
    	Byte, Integer or String Filter Value
  • The following is sample code that can be used as an example to create an MQPCF message in a Compute node:
    CREATE NEXTSIBLING OF OutputRoot.Properties DOMAIN 'MQMD';
    CREATE NEXTSIBLING OF OutputRoot.MQMD DOMAIN 'MQADMIN'
    NAME 'MQPCF';
    CREATE FIELD OutputRoot.MQPCF;
    SET OutputRoot.MQMD.MsgType = MQMT_REQUEST;
    SET OutputRoot.MQMD.ReplyToQ = 'REPLYQ';
    DECLARE refRequest REFERENCE TO OutputRoot.MQPCF;
    SET refRequest.Type = 16; --MQCFT_COMMAND_XR z/OS
    SET refRequest.StrucLength = MQCFH_STRUC_LENGTH;
    SET refRequest.Version = 3; -- required for z/OS
    SET refRequest.Command = MQCMD_INQUIRE_Q;
    SET refRequest.MsgSeqNumber = 1;
    SET refRequest.Control = MQCFC_LAST;
    /* First parameter: Queue Name. */
    SET refRequest.Parameter[1] = MQCA_Q_NAME;
    SET refRequest.Parameter[1].* = 'QUEUENAME.*';
    SET refRequest.ParameterList[1] = MQIACF_Q_ATTRS;
    SET refRequest.ParameterList[1].*  = MQIACF_ALL;