AccountingToken (MQBYTE32)

This is the accounting token, part of the identity context of the message. For more information about message context, see Overview for MQMD ; also see Message context.

AccountingToken allows an application to charge appropriately for work done as a result of the message. The queue manager treats this information as a string of bits and does not check its content.

The queue manager generates this information as follows:

  • The first byte of the field is set to the length of the accounting information present in the bytes that follow; this length is in the range zero through 30, and is stored in the first byte as a binary integer.
  • The second and subsequent bytes (as specified by the length field) are set to the accounting information appropriate to the environment.

    • On z/OS the accounting information is set to:

      • For z/OS batch, the accounting information from the JES JOB card or from a JES ACCT statement in the EXEC card (comma separators are changed to X'FF'). This information is truncated, if necessary, to 31 bytes.
      • For TSO, the user's account number.
      • For CICS, the LU 6.2 unit of work identifier (UEPUOWDS) (26 bytes).
      • For IMS, the 8-character PSB name concatenated with the 16-character IMS recovery token.

    • On IBM i, the accounting information is set to the accounting code for the job.
    • On UNIX, the accounting information is set to the numeric user identifier, in ASCII characters.
    • On Windows, the accounting information is set to a Windows security identifier (SID) in a compressed format. The SID uniquely identifies the user identifier stored in the UserIdentifier field. When the SID is stored in the AccountingToken field, the 6-byte Identifier Authority (located in the third and subsequent bytes of the SID) is omitted. For example, if the Windows SID is 28 bytes long, 22 bytes of SID information are stored in the AccountingToken field.

  • The last byte (byte 32) of the accounting field is set to the accounting token type (in this case MQACTT_NT_SECURITY_ID, x '0b'):

      MQACTT_CICS_LUOW_ID
      CICS LUOW identifier.

      MQACTT_NT_SECURITY_ID
      Windows security identifier.

      MQACTT_OS400_ACCOUNT_TOKEN
      IBM i accounting token.

      MQACTT_UNIX_NUMERIC_ID
      UNIX numeric identifier.

      MQACTT_USER
      User-defined accounting token.

      MQACTT_UNKNOWN
      Unknown accounting-token type.

    The accounting-token type is set to an explicit value only in the following environments:

    • AIX
    • IBM i
    • Linux
    • Windows

    and for IBM MQ MQI clients connected to these systems. In other environments, the accounting-token type is set to the value MQACTT_UNKNOWN. In these environments use the PutApplType field to deduce the type of accounting token received.

  • All other bytes are set to binary zero.

For the MQPUT and MQPUT1 calls, this is an input/output field if MQPMO_SET_IDENTITY_CONTEXT or MQPMO_SET_ALL_CONTEXT is specified in the PutMsgOpts parameter. If neither MQPMO_SET_IDENTITY_CONTEXT nor MQPMO_SET_ALL_CONTEXT is specified, this field is ignored on input and is an output-only field. For more information about message context, see Message context.

After the successful completion of an MQPUT or MQPUT1 call, this field contains the AccountingToken that was transmitted with the message if it was put to a queue. This will be the value of AccountingToken that is kept with the message if it is retained (see description of MQPMO_RETAIN in MQPMO options (MQLONG) for more details about retained publications) but is not used as the AccountingToken when the message is sent as a publication to subscribers since they provide a value to override AccountingToken in all publications sent to them. If the message has no context, the field is entirely binary zero.

This is an output field for the MQGET call.

This field is not subject to any translation based on the character set of the queue manager; the field is treated as a string of bits, and not as a string of characters.

The queue manager does nothing with the information in this field. The application must interpret the information if it wants to use the information for accounting purposes.

We can use the following special value for the AccountingToken field:

    MQACT_NONE
    No accounting token is specified.

    The value is binary zero for the length of the field.

    For the C programming language, the constant MQACT_NONE_ARRAY is also defined; this has the same value as MQACT_NONE, but is an array of characters instead of a string.

The length of this field is given by MQ_ACCOUNTING_TOKEN_LENGTH. The initial value of this field is MQACT_NONE.

Parent topic: Fields for MQMD