mqPad

The mqPad call pads a null-terminated string with blanks.


Syntax for mqPad

    mqPad (String, BufferLength, Buffer, CompCode, Reason)


Parameters for mqPad

    String (PMQCHAR) - input
    Null-terminated string. The null pointer is valid for the address of the String parameter, and denotes a string of zero length.

    BufferLength (MQLONG) - input
    Length in bytes of the buffer to receive the string padded with blanks. Must be zero or greater.

    Buffer (MQCHAR x BufferLength) - output
    Buffer to receive the blank-padded string. The length is given by the BufferLength parameter. If zero is specified for BufferLength, the null pointer can be specified for the address of the Buffer parameter; in all other cases, a valid (nonnull) address must be specified for the Buffer parameter.

    If the number of characters preceding the first null in the String parameter is greater than the BufferLength parameter, the excess characters are omitted and MQRC_DATA_TRUNCATED results.

    CompCode (MQLONG) - output
    Completion code.

    Reason (MQLONG) - output
    Reason code qualifying CompCode. The following reason codes indicating error and warning conditions can be returned from the mqPad call:

      MQRC_BUFFER_ERROR
      Buffer parameter not valid (invalid parameter address or buffer not completely accessible).

      MQRC_BUFFER_LENGTH_ERROR
      Buffer length not valid.

      MQRC_STRING_ERROR
      String parameter not valid (invalid parameter address or buffer not completely accessible).

      MQRC_STRING_TRUNCATED
      Data too long for output buffer and has been truncated.


Usage notes for mqPad

  1. If the buffer pointers are the same, the padding is done in place. If not, at most BufferLength characters are copied into the second buffer; any space remaining, including the null-termination character, is overwritten with spaces.
  2. If the String and Buffer parameters partially overlap, the result is undefined.


C language invocation for mqPad

mqPad (String, BufferLength, Buffer, &CompCode, &Reason);
Declare the parameters as follows:
MQCHAR   String;           /* String to be padded */
MQLONG   BufferLength;     /* Buffer length */
PMQCHAR  Buffer            /* Buffer to contain padded string */
MQLONG   CompCode;         /* Completion code */
MQLONG   Reason;           /* Reason code qualifying CompCode */
Note: This call is not supported in Visual Basic. Parent topic: MQAI calls