ImqWorkHeader C++ class

This class encapsulates specific features of the MQWIH data structure.

Figure 1. ImqWorkHeader class

Objects of this class are used by applications putting messages to the queue managed by the z/OS Workload Manager.


Object attributes

    message token
    Message token for the z/OS Workload Manager, of length MQ_MSG_TOKEN_LENGTH. The initial value is MQMTOK_NONE.

    service name
    The 32-character name of a process. The name is initially blanks.

    service step
    The 8-character name of a step within the process. The name is initially blanks.


Constructors

    ImqWorkHeader( );
    The default constructor.

    ImqWorkHeader( const ImqWorkHeader & header );
    The copy constructor.


Overloaded ImqItem methods

    virtual ImqBoolean copyOut( ImqMessage & msg );
    Inserts an MQWIH data structure into the beginning of the message buffer, moving the existing message data further along, and sets the msg format to MQFMT_WORK_INFO_HEADER.

    See the parent class method description for more details.

    virtual ImqBoolean pasteIn( ImqMessage & msg );
    Reads an MQWIH data structure from the message buffer.

    To be successful, the encoding of the msg object must be MQENC_NATIVE. Retrieve messages with MQGMO_CONVERT to MQENC_NATIVE.

    The ImqMessage format must be MQFMT_WORK_INFO_HEADER.

    See the parent class method description for more details.


Object methods (public)

    void operator = ( const ImqWorkHeader & header );
    Copies instance data from header, replacing the existing instance data.

    ImqBinary messageToken ( ) const;
    Returns the message token.

    ImqBoolean setMessageToken( const ImqBinary & token );
    Sets the message token. The data length of token must be either zero or MQ_MSG_TOKEN_LENGTH. It returns TRUE if successful.

    void setMessageToken( const MQBYTE16 token = 0 );
    Sets the message token. token can be zero, which is the same as specifying MQMTOK_NONE. If token is nonzero, it must address MQ_MSG_TOKEN_LENGTH bytes of binary data.

    When using predefined values such as MQMTOK_NONE, you might need make a cast to ensure a signature match; for example, (MQBYTE *)MQMTOK_NONE.

    ImqString serviceName ( ) const;
    Returns the service name, including trailing blanks.

    void setServiceName( const char * name );
    Sets the service name.

    ImqString serviceStep ( ) const;
    Returns the service step, including trailing blanks.

    void setServiceStep( const char * step );
    Sets the service step.


Object data (protected)

    MQWIH omqwih
    The MQWIH data structure.


Reason codes

  • MQRC_BINARY_DATA_LENGTH_ERROR

Parent topic: IBM MQ C++ classes