MQ
MQ
Using C++
Version 7.0
SC34-6936-00
WebSphere MQ
Using C++
Version 7.0
SC34-6936-00
Note
Before using this information and the product it supports, be sure to read the general information under notices at the back
of this book.
Contents
Figures . . . . . . . . . . . . . . vii
Tables . . . . . . . . . . . . . . . ix
Chapter 1. Features of WebSphere MQ
C++ . . . . . . . . . . . . . . . . 1
Data types . . . . . . .
Elementary data types . .
Manipulating binary strings .
Manipulating character strings
Initial state of objects . . .
Using C from C++ . . . .
Notational conventions . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
32
32
32
32
32
33
33
ImqAuthenticationRecord. . .
Other relevant classes . . .
Object attributes . . . . .
Constructors . . . . . .
Object methods (public) . .
Object methods (protected) .
ImqBinary . . . . . . . .
Other relevant classes . . .
Object attributes . . . . .
Constructors . . . . . .
Overloaded ImqItem methods
Object methods (public) . .
Object methods (protected) .
Reason codes . . . . . .
ImqCache . . . . . . . .
Other relevant classes . . .
Object attributes . . . . .
Constructors . . . . . .
Object methods (public) . .
Reason codes . . . . . .
ImqChannel . . . . . . .
Other relevant classes . . .
Object attributes . . . . .
Constructors . . . . . .
Object methods (public) . .
Reason codes . . . . . .
ImqCICSBridgeHeader . . .
Other relevant classes . . .
Object attributes . . . . .
Constructors . . . . . .
Overloaded ImqItem methods
Object methods (public) . .
Object data (protected) . .
Reason codes . . . . . .
Return codes . . . . . .
ImqDeadLetterHeader . . . .
Other relevant classes . . .
Object attributes . . . . .
Constructors . . . . . .
Overloaded ImqItem methods
Object methods (public) . .
Object data (protected) . .
Reason codes . . . . . .
ImqDistributionList . . . . .
Other relevant classes . . .
.
.
.
.
19
20
20
20
.
.
.
.
22
22
22
23
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
25
25
25
25
26
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 31
. 31
. 31
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
37
37
37
38
38
39
40
40
40
40
40
41
41
41
42
42
42
43
43
44
45
45
45
47
47
50
51
51
51
54
54
54
57
57
57
58
58
58
59
59
59
60
60
61
61
iii
Object attributes . . . . .
Constructors . . . . . .
Object methods (public) . .
Object methods (protected) .
ImqError . . . . . . . .
Other relevant classes . . .
Object attributes . . . . .
Constructors . . . . . .
Object methods (public) . .
Object methods (protected) .
Reason codes . . . . . .
ImqGetMessageOptions . . .
Other relevant classes . . .
Object attributes . . . . .
Constructors . . . . . .
Object methods (public) . .
Object methods (protected) .
Object data (protected) . .
Reason codes . . . . . .
ImqHeader . . . . . . .
Other relevant classes . . .
Object attributes . . . . .
Constructors . . . . . .
Object methods (public) . .
ImqIMSBridgeHeader . . . .
Other relevant classes . . .
Object attributes . . . . .
Constructors . . . . . .
Overloaded ImqItem methods
Object methods (public) . .
Object data (protected) . .
Reason codes . . . . . .
ImqItem . . . . . . . .
Other relevant classes . . .
Object attributes . . . . .
Constructors . . . . . .
Class methods (public) . .
Object methods (public) . .
Reason codes . . . . . .
ImqMessage . . . . . . .
Other relevant classes . . .
Object attributes . . . . .
Constructors . . . . . .
Object methods (public) . .
Object methods (protected) .
Object data (protected) . .
ImqMessageTracker . . . . .
Other relevant classes . . .
Object attributes . . . . .
Constructors . . . . . .
Object methods (public) . .
Reason codes . . . . . .
ImqNamelist . . . . . . .
Other relevant classes . . .
Object attributes . . . . .
Constructors . . . . . .
Object methods (public) . .
Reason codes . . . . . .
ImqObject . . . . . . . .
Other relevant classes . . .
Class attributes . . . . .
iv
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
61
61
61
62
63
63
63
63
63
64
64
65
65
65
66
67
68
68
68
69
69
69
70
70
71
71
71
72
72
72
73
73
74
74
74
74
75
75
75
76
76
76
80
80
82
83
84
84
84
85
85
87
88
88
88
88
88
89
90
90
90
Object attributes . . . . . .
Constructors . . . . . . .
Class methods (public) . . .
Object methods (public) . . .
Object methods (protected) . .
Object data (protected) . . .
Reason codes . . . . . . .
ImqProcess . . . . . . . .
Other relevant classes . . . .
Object attributes . . . . . .
Constructors . . . . . . .
Object methods (public) . . .
ImqPutMessageOptions . . . .
Other relevant classes . . . .
Object attributes . . . . . .
Constructors . . . . . . .
Object methods (public) . . .
Object data (protected) . . .
Reason codes . . . . . .
ImqQueue . . . . . . . .
Other relevant classes . . .
Object attributes . . . . .
Constructors . . . . . . .
Object methods (public) . . .
Object methods (protected) . .
Reason codes . . . . . .
ImqQueueManager . . . . .
Other relevant classes . . .
Class attributes . . . . . .
Object attributes . . . . .
Constructors . . . . . . .
Destructors . . . . . . .
Class methods (public) . . .
Object methods (public) . . .
Object methods (protected) . .
Object data (protected) . . .
Reason codes . . . . . .
ImqReferenceHeader . . . . .
Other relevant classes . . .
Object attributes . . . . .
Constructors . . . . . . .
Overloaded ImqItem methods .
Object methods (public) . . .
Object data (protected) . . .
Reason codes . . . . . .
ImqString . . . . . . . .
Other relevant classes . . .
Object attributes . . . . .
Constructors . . . . . . .
Class methods (public) . . .
Overloaded ImqItem methods .
Object methods (public) . . .
Object methods (protected) . .
Reason codes . . . . . .
ImqTrigger . . . . . . . .
Other relevant classes . . .
Object attributes . . . . .
Constructors . . . . . . .
Overloaded ImqItem methods .
Object methods (public) . . .
Object data (protected) . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 90
. 92
. 92
. 92
. 94
. 95
. 96
. 97
. 97
. 97
. 97
. 97
. 99
. 99
. 99
. 100
. 100
. 101
. 101
. 102
. 102
. 102
. 106
. 106
. 114
. 114
. 115
. 115
. 115
. 116
. 122
. 122
. 122
. 122
. 133
. 134
. 134
. 135
. 135
. 135
. 136
. 136
. 136
. 137
. 137
. 138
. 138
. 138
. 138
. 139
. 139
. 139
. 143
. 143
. 144
. 144
. 144
. 145
. 145
. 145
. 146
Reason codes . . . . . .
ImqWorkHeader . . . . . .
Other relevant classes . . .
Object attributes . . . . .
Constructors . . . . . . .
Overloaded ImqItem methods .
Object methods (public) . . .
Object data (protected) . . .
Reason codes . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
146
147
147
147
147
148
148
148
148
149
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
z/OS
. .
.
.
.
.
.
.
.
.
.
.
.
149
149
150
152
152
154
155
156
156
157
158
ImqAuthenticationRecord
ImqCache . . . . .
ImqChannel . . . . .
ImqCICSBridgeHeader .
ImqDeadLetterHeader .
ImqError . . . . . .
ImqGetMessageOptions .
ImqHeader . . . . .
ImqIMSBridgeHeader .
ImqItem . . . . . .
ImqMessage . . . . .
ImqMessageTracker . .
ImqNamelist . . . .
ImqObject . . . . .
ImqProcess . . . . .
ImqPutMessageOptions .
ImqQueue . . . . .
ImqQueueManager . .
ImqReferenceHeader . .
ImqTrigger . . . . .
ImqWorkHeader . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
162
162
162
163
164
164
164
165
165
165
166
166
166
167
167
167
168
170
173
173
174
Notices . . . . . . . . . . . . . . 175
. 158
Index . . . . . . . . . . . . . . . 179
Chapter 15. MQI cross reference . . . 161
Data structure, class, and include-file cross
reference . . . . . . . . . . . .
Class attribute cross reference . . . . .
.
.
.
.
. 161
. 162
Contents
vi
Figures
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
.
.
.
.
.
.
.
.
.
.
.
. 2
37
40
42
45
51
58
61
63
65
69
71
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
ImqItem class . . . . . .
ImqMessage class . . . .
ImqMessageTracker class . .
ImqNamelist class . . . .
ImqObject class . . . . .
ImqProcess class . . . . .
ImqPutMessageOptions class .
ImqQueue class . . . . .
ImqQueueManager class . .
ImqReferenceHeader class .
ImqString class . . . . .
ImqTrigger class . . . .
ImqWorkHeader class . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 74
. 76
. 84
. 88
. 90
. 97
. 99
. 102
. 115
. 135
. 138
. 144
. 147
vii
viii
Tables
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
. 19
. 31
57
. 158
. 161
162
. 162
. 162
163
164
. 164
164
. 165
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
165
165
166
166
166
167
167
167
168
170
173
173
174
ix
Message
format : String
formatIs( )
readItem( )
writeItem( )
CICS
Bridge
Header
Item
copyOut( )
pasteIn( )
A
Header
character set : Integer
encoding : Integer
format : String
header flags : Integer
Trigger
A
Dead Letter
Header
Reference
Header
Work
Header
IMS
Bridge
Header
Cache
Namelist
Object
close( )
name : String
open( )
A
n
managed by
1
Queue Manager
MessageTracker
backout( )
begin( )
commit( )
connect( )
disconnect( )
correlation id : Binary
group id : Binary
message id : Binary
referenced by
1
Channel
channel name
connection name
transport type
Queue
n
get( )
put( )
queue manager name : String
Message
priority : Integer
referenced by
1
Distribution
List
Put Message
Options
Get Message
Options
wait interval : Integer
v The ImqString class (see ImqString on page 138), which encapsulates character
arrays such as MQCHAR64.
Entities with data structures are subsumed within appropriate object classes.
Individual data structure fields (see Chapter 15, MQI cross reference, on page
161) are accessed with methods.
Entities with handles come under the ImqObject class hierarchy (see ImqObject
on page 90) and provide encapsulated interfaces to the MQI. Objects of these
classes exhibit intelligent behavior that can reduce the number of method
invocations required relative to the procedural MQI. For example, you can
establish and discard queue manager connections as required, or you can open a
queue with appropriate options, then close it.
The ImqMessage class (see ImqMessage on page 76) encapsulates the MQMD
data structure and also acts as a holding point for user data and items (see
Chapter 3, Reading messages, on page 7) by providing cached buffer facilities.
You can provide fixed-length buffers for user data and use the buffer many times.
The amount of data present in the buffer can vary from one use to the next.
Alternatively, the system can provide and manage a buffer of flexible length. Both
the size of the buffer (the amount available for receipt of messages) and the
amount actually used (either the number of bytes for transmission or the number
of bytes actually received) become important considerations.
2. Use prepared data in a user-supplied buffer, where the buffer size exceeds the
data size
char szBuffer[ 24 ] = "Hello world" ;
msg.useEmptyBuffer( szBuffer, sizeof( szBuffer ) );
msg.setFormat( MQFMT_STRING );
msg.setMessageLength( 12 );
5. Copy data to a system-supplied buffer using objects (objects set the message
format as well as content)
ImqString strText( "Hello world" );
msg.writeItem( strText );
msg.readItem( header ) ) {
The dead-letter header has been extricated from the
buffer and transformed into a dead-letter object.
The encoding and character set of the dead-letter
object itself are MQENC_NATIVE and MQCCSI_Q_MGR.
The encoding and character set from the dead-letter
*/
*/
*/
*/
*/
*/
*/
UserClass is derived from the ImqItem class (see ImqItem on page 74), and
implements the virtual copyOut and pasteIn methods from that class.
The next two examples show code from the ImqDeadLetterHeader class (see
ImqDeadLetterHeader on page 58). The first example shows
custom-encapsulated message-writing code.
// Insert a dead-letter header.
// Return TRUE if successful.
ImqBoolean ImqDeadLetterHeader :: copyOut ( ImqMessage & msg ) {
ImqBoolean bSuccess ;
if ( msg.moreBytes( sizeof( omqdlh ) ) ) {
ImqCache cacheData( msg ); // Preserve original message content.
// Note original message attributes in the dead-letter header.
setEncoding( msg.encoding( ) );
setCharacterSet( msg.characterSet( ) );
setFormat( msg.format( ) );
// Set the message attributes to reflect the dead-letter header.
msg.setEncoding( MQENC_NATIVE );
msg.setCharacterSet( MQCCSI_Q_MGR );
msg.setFormat( MQFMT_DEAD_LETTER_HEADER );
// Replace the existing data with the dead-letter header.
msg.clearMessage( );
if ( msg.write( sizeof( omqdlh ), (char *) & omqdlh ) ) {
// Append the original message data.
bSuccess = msg.write( cacheData.messageLength( ),
cacheData.bufferPointer( ) );
} else {
bSuccess = FALSE ;
}
} else {
bSuccess = FALSE ;
}
// Reflect and cache error in this object.
if ( ! bSuccess ) {
setReasonCode( msg.reasonCode( ) );
setCompletionCode( msg.completionCode( ) );
}
return bSuccess ;
}
} else {
// Reflect the cache error in this object.
setReasonCode( msg.reasonCode( ) );
setCompletionCode( msg.completionCode( ) );
}
} else {
setReasonCode( MQRC_INCONSISTENT_FORMAT );
setCompletionCode( MQCC_FAILED );
}
} else {
setReasonCode( MQRC_ENCODING_ERROR );
setCompletionCode( MQCC_FAILED );
{
} else {
setReasonCode( MQRC_STRUC_ID_ERROR );
setCompletionCode( MQCC_FAILED );
}
return bSuccess ;
}
With an automatic buffer, the buffer storage is volatile. That is, buffer data might be
held at a different physical location after each get method invocation. Therefore,
each time buffer data is referenced, use the bufferPointer or dataPointer methods
to access message data.
You might want a program to set aside a fixed area for receiving message data. In
this case, invoke the useEmptyBuffer method before using the get method.
Using a fixed, nonautomatic area limits messages to a maximum size, so it is
important to consider the MQGMO_ACCEPT_TRUNCATED_MSG option of the
ImqGetMessageOptions object. If this option is not specified (the default), the
MQRC_TRUNCATED_MSG_FAILED reason code can be expected. If this option is
specified, the MQRC_TRUNCATED_MSG_ACCEPTED reason code might be
expected depending on the design of the application.
The next example shows how a fixed area of storage can be used to receive
messages:
char * pszBuffer = new char[ 100 ];
msg.useEmptyBuffer( pszBuffer, 100 );
gmo.setOptions( MQGMO_ACCEPT_TRUNCATED_MSG );
queue.get( msg, gmo );
delete [ ] pszBuffer ;
In this code fragment, the buffer can always be addressed directly, with pszBuffer,
as opposed to using the bufferPointer method. However, it is better to use the
dataPointer method for general-purpose access. The application (not the ImqCache
class object) must discard a user-defined (nonautomatic) buffer.
Attention: Specifying a null pointer and zero length with useEmptyBuffer does
not nominate a fixed length buffer of length zero as might be expected. This
combination is actually interpreted as a request to ignore any previous
user-defined buffer, and instead revert to the use of an automatic buffer.
10
//
//
//
//
//
11
12
mgr;
queueBridge;
msg;
header;
//
//
//
//
13
14
//
//
//
//
//
15
16
//
//
//
//
//
17
18
AIX
<mqmtop>/samp
<mqmtop>/samp/bin/ia
i5/OS
/QIBM/ProdData/mqm/samp/
(see note 1)
HP-UX
<mqmtop>/samp
<mqmtop>/samp/bin/ah
(see note 2)
z/OS
thlqual.SCSQCPPS
None
Solaris
<mqmtop>/samp
<mqmtop>/samp/bin/as
Linux
<mqmtop>/samp
<mqmtop>/samp/bin/
Windows
<mqmtop>\tools\cplus\samples
<mqmtop>\tools\cplus\
samples\bin\vn
(see note 3)
Notes:
1. Programs built using the ILE C++ compiler for i5/OS are in the library QMQM. The
include files are in /QIBM/ProdData/mqm/inc.
2. Programs built using the HP ANSI C++ compiler are found in directory
<mqmtop>/samp/bin/ah. For further information, see Compilers for WebSphere MQ
platforms on page 149.
3.
Programs built using the Microsoft Visual C++ .NET are found in
<mqmtop>\tools\cplus\samples\bin\vn. For further information about these
compilers, see Compilers for WebSphere MQ platforms on page 149.
19
On z/OS
Construct and run a batch job, using the sample JCL imqwrldr. See Running
sample programs on z/OS on page 158 for more information.
Sample code
Here is the code for the HELLO WORLD sample program.
extern "C" {
#include <stdio.h>
}
#include <imqi.hpp> // WebSphere MQ C++
#define EXISTING_QUEUE "SYSTEM.DEFAULT.LOCAL.QUEUE"
#define BUFFER_SIZE 12
static char gpszHello[ BUFFER_SIZE ] = "Hello world" ;
int main ( int argc, char * * argv ) {
ImqQueueManager manager ;
int iReturnCode = 0 ;
// Connect to the queue manager.
if ( argc > 2 ) {
manager.setName( argv[ 2 ] );
}
if ( manager.connect( ) ) {
ImqQueue * pqueue = new ImqQueue ;
ImqMessage * pmsg = new ImqMessage ;
// Identify the queue which will hold the message.
pqueue -> setConnectionReference( manager );
if ( argc > 1 ) {
pqueue -> setName( argv[ 1 ] );
//
//
//
//
20
}
// Prepare a message containing the text "Hello world".
pmsg -> useFullBuffer( gpszHello , BUFFER_SIZE );
pmsg -> setFormat( MQFMT_STRING );
//
//
//
if
21
return iReturnCode ;
}
On z/OS
1. Construct and run a batch job using the sample JCL imqsputr. The messages
are read from the SYSIN data set.
2. Construct and run a batch job using the sample JCL imqsgetr. The messages
are retrieved from the queue and sent to the SYSPRINT data set.
See Running sample programs on z/OS on page 158 for more information.
These samples show the use of the following classes:
v ImqError (see ImqError on page 63)
v ImqMessage (see ImqMessage on page 76)
v ImqObject (see ImqObject on page 90)
v ImqQueue (see ImqQueue on page 102)
v ImqQueueManager (see ImqQueueManager on page 115)
22
23
24
Connect
An ImqQueueManager object is connected automatically for any method that
results in any call to the MQI (see Chapter 15, MQI cross reference, on page 161).
Open
An ImqObject object is opened automatically for any method that results in an
MQGET, MQINQ, MQPUT, or MQSET call. Use the openFor method to specify
one or more relevant open option values.
Reopen
An ImqObject is reopened automatically for any method that results in an MQGET,
MQINQ, MQPUT, or MQSET call, where the object is already open, but the
existing open options are not adequate to allow the MQI call to be successful. The
object is temporarily closed using a temporary close options value of
MQCO_NONE. Use the openFor method to add a relevant open option.
Reopen can cause problems in specific circumstances:
v A temporary dynamic queue is destroyed when it is closed and can never be
reopened.
v A queue opened for exclusive input (either explicitly or by default) might be
accessed by others in the window of opportunity during closure and reopening.
v A browse cursor position is lost when a queue is closed. This situation does not
prevent closure and reopening, but prevents subsequent use of the cursor until
MQGMO_BROWSE_FIRST is used again.
v The context of the last message retrieved is lost when a queue is closed.
If any of these circumstances occur or can be foreseen, avoid reopens by explicitly
setting adequate open options before an object is opened (either explicitly or
implicitly).
Setting the open options explicitly for complex queue-handling situations results in
better performance and avoids the problems associated with the use of reopen.
Close
An ImqObject is closed automatically at any point where the object state would no
longer be viable, for example if an ImqObject connection reference is severed, or if
an ImqObject object is destroyed.
25
Disconnect
An ImqQueueManager is disconnected automatically at any point where the
connection would no longer be viable, for example if an ImqObject connection
reference is severed, or if an ImqQueueManager object is destroyed.
26
The ImqBinary class also provides support for comparison and copying.
27
28
29
30
Header files
Header files are provided as part of the definition of the MQI, to help you write
WebSphere MQ application programs in the C++ language. These header files are
summarized in the following table.
Table 2. C/C++ header files
Filename
Contents
IMQI.HPP
IMQTYPE.H
CMQC.H
To improve the portability of applications, code the name of the header file in
lowercase on the #include preprocessor directive:
#include <imqi.hpp> // C++ classes
Methods
Parameters that are const are for input only. Parameters whose signature includes a
pointer (*) or a reference (&) are passed by reference. Return values that do not
include a pointer or a reference are passed by value; in the case of returned objects,
these are new entities that become the responsibility of the caller.
Some method signatures include items that take a default if not specified. Such
items are always at the end of signatures and are denoted by an equal sign (=); the
value after the equal sign indicates the default value that applies if the item is
omitted.
All method names in these classes are mixed case, beginning with lowercase. Each
word, except the first within a method name, begins with a capital letter.
Abbreviations are not used unless their meaning is widely understood.
Abbreviations used include id (for identity) and sync (for synchronization).
Attributes
Object attributes are accessed using set and get methods. A set method begins with
the word set; a get method has no prefix. If an attribute is read-only, there is no set
method.
Attributes are initialized to valid states during object construction, and the state of
an object is always consistent.
31
Data types
All data types are defined by the C typedef statement. The type ImqBoolean is
defined as unsigned character in IMQTYPE.H and can have the values TRUE and
FALSE. You can use ImqBinary class objects in place of MQBYTE arrays, and
ImqString class objects in place of char *. Many methods return objects instead of
char or MQBYTE pointers to ease storage management. All return values become
the responsibility of the caller, and, in the case of a returned object, the storage can
be easily disposed of using delete.
32
Notational conventions
This shows how to invoke the methods and declare the parameters:
ImqBoolean ImqQueue::get( ImqMessage & msg )
Declare and use the parameters as follows:
ImqQueueManager * pmanager ;
ImqQueue * pqueue ;
ImqMessage msg ;
char szBuffer[ 100 ];
// Queue manager
// Message queue
// Message
// Buffer for message data
33
34
35
Note:
1. Objects of these classes are not thread-safe. This ensures optimal performance,
but take care not to access any given object from more than one thread.
2. It is recommended that, for a multithreaded program, a separate
ImqQueueManager object is used for each thread. Each manager object must
have its own independent collection of other objects, ensuring that objects in
different threads are isolated from one another.
The classes are:
v ImqAuthenticationRecord on page 37
v ImqBinary on page 40
v ImqCache on page 42
v
v
v
v
v
v
v
v
v
v
v
v
v
v
v
v
v
v
v
v
v
36
ImqChannel on page 45
ImqCICSBridgeHeader on page 51
ImqDeadLetterHeader on page 58
ImqDistributionList on page 61
ImqError on page 63
ImqGetMessageOptions on page 65
ImqHeader on page 69
ImqIMSBridgeHeader on page 71
ImqItem on page 74
ImqMessage on page 76
ImqMessageTracker on page 84
ImqNamelist on page 88
ImqObject on page 90
ImqProcess on page 97
ImqPutMessageOptions on page 99
ImqQueue on page 102
ImqQueueManager on page 115
ImqReferenceHeader on page 135
ImqString on page 138
ImqTrigger on page 144
ImqWorkHeader on page 147
ImqAuthenticationRecord
Error
A
Authentication
Record
Object attributes
connection name
The name of the connection to the LDAP CRL server. This is the IP address
or DNS name, followed optionally by the port number, in parentheses.
connection reference
A reference to an ImqQueueManager object that provides the required
connection to a (local) queue manager. The initial value is zero. Do not
confuse this with the queue manager name that identifies a queue manager
(possibly remote) for a named queue.
next authentication record
Next object of this class, in no particular order, having the same
connection reference as this object. The initial value is zero.
password
A password supplied for connection authentication to the LDAP CRL
server.
previous authentication record
Previous object of this class, in no particular order, having the same
connection reference as this object. The initial value is zero.
type
37
user name
A user identifier supplied for authorization to the LDAP CRL server.
Constructors
ImqAuthenticationRecord( );
The default constructor.
38
39
ImqBinary
Item
A
Binary
This class encapsulates a binary byte array that can be used for ImqMessage
accounting token, correlation id, and message id values. It allows easy
assignment, copying, and comparison.
Object attributes
data
data length
The number of bytes. The initial value is zero.
data pointer
The address of the first byte of the data. The initial value is zero.
Constructors
ImqBinary( );
The default constructor.
ImqBinary( const ImqBinary & binary );
The copy constructor.
ImqBinary( const void * data, const size_t length );
Copies length bytes from data.
40
Reason codes
v MQRC_NO_BUFFER
v MQRC_STORAGE_NOT_AVAILABLE
v MQRC_INCONSISTENT_FORMAT
41
ImqCache
Error
A
Cache
Use this class to hold or marshal data in memory. You can nominate a buffer of
memory of fixed size, or the system can provide a flexible amount of memory
automatically. This class relates to the MQI calls listed in Table 7 on page 162.
Object attributes
automatic buffer
Indicates whether buffer memory is managed automatically by the system
(TRUE) or is supplied by the user (FALSE). It is initially set to TRUE.
This attribute is not set directly. It is set indirectly using either the
useEmptyBuffer or the useFullBuffer method.
If user storage is supplied, this attribute is FALSE, buffer memory cannot
grow, and buffer overflow errors can occur. The address and length of the
buffer remain constant.
If user storage is not supplied, this attribute is TRUE, and buffer memory
can grow incrementally to accommodate an arbitrary amount of message
data. However, when the buffer grows, the address of the buffer might
change, so be careful when using the buffer pointer and data pointer.
buffer length
The number of bytes of memory in the buffer. The initial value is zero.
buffer pointer
The address of the buffer memory. The initial value is null.
data length
The number of bytes succeeding the data pointer. This must be equal to or
less than the message length. The initial value is zero.
data offset
The number of bytes preceding the data pointer. This must be equal to or
less than the message length. The initial value is zero.
42
data pointer
The address of the part of the buffer that is to be written to or read from
next. The initial value is null.
message length
The number of bytes of significant data in the buffer. The initial value is
zero.
Constructors
ImqCache( );
The default constructor.
ImqCache( const ImqCache & cache );
The copy constructor.
43
Reason codes
v
v
v
v
v
v
v
44
MQRC_BUFFER_NOT_AUTOMATIC
MQRC_DATA_TRUNCATED
MQRC_INSUFFICIENT_BUFFER
MQRC_INSUFFICIENT_DATA
MQRC_NULL_POINTER
MQRC_STORAGE_NOT_AVAILABLE
MQRC_ZERO_LENGTH
ImqChannel
Error
A
Channel
This class encapsulates a channel definition (MQCD) for use during execution of
the Manager::connect method, for custom client connections. See the description of
that method, and Sample program HELLO WORLD (imqwrld.cpp) on page 19,
for more details. Not all the listed methods are applicable to all platforms; see the
descriptions of the DEFINE CHANNEL and ALTER CHANNEL commands in
WebSphere MQ Script (MQSC) Command Reference for more details. The
ImqChannel class is not supported on z/OS.
Object attributes
List of object attributes for the ImqChannel class.
batch heart-beat
The number of milliseconds between checks that a remote channel is
active. The initial value is 0.
channel name
The name of the channel. The initial value is null.
connection name
The name of the connection. For example, the IP address of a host
computer. The initial value is null.
header compression
The list of header data compression techniques supported by the channel.
The initial values are all set to MQCOMPRESS_NOT_AVAILABLE.
heart-beat interval
The number of seconds between checks that a connection is still working.
The initial value is 300.
Chapter 13. WebSphere MQ C++ classes
45
46
user id
A user identifier supplied for authorization. The initial value is null.
Constructors
ImqChannel( ) ;
The default constructor.
ImqChannel( const ImqChannel & channel );
The copy constructor.
47
48
ImqString receiveUserData( );
Returns the first of the receive user data items, if any. If the receive exit
count is zero, returns an empty string.
ImqBoolean receiveUserData( const size_t count, ImqString * data [ ] );
Returns copies of the receive user data items in data. Sets any data in
excess of receive exit count to null strings. This method returns TRUE if
successful.
ImqBoolean setReceiveUserData( const char * data = 0 );
Sets the receive user data to the single item data. If data is not null, receive
exit count must be at least 1. This method returns TRUE if successful.
ImqBoolean setReceiveUserData( const size_t count, const char * data [ ] );
Sets the receive user data to data. count must be no greater than the receive
exit count. This method returns TRUE if successful.
ImqBoolean setReceiveUserData( const size_t count, const ImqString * data [ ] );
Sets the receive user data to data. count must be no greater than the receive
exit count. This method returns TRUE if successful.
ImqString securityExitName( ) const ;
Returns the security exit name.
ImqBoolean setSecurityExitName( const char * name = 0 );
Sets the security exit name. This method returns TRUE if successful.
ImqString securityUserData( ) const ;
Returns the security user data.
ImqBoolean setSecurityUserData( const char * data = 0 );
Sets the security user data. This method returns TRUE if successful.
size_t sendExitCount( ) const ;
Returns the send exit count.
ImqString sendExitName( );
Returns the first of the send exit names, if any. Returns an empty string if
the send exit count is zero.
ImqBoolean sendExitNames( const size_t count, ImqString * names [ ] );
Returns copies of the send exit names in names. Sets any names in excess of
send exit count to null strings. This method returns TRUE if successful.
ImqBoolean setSendExitName( const char * name = 0 );
Sets the send exit names to the single name. name can be blank or null. Sets
the send exit count to either 1 or zero. Clears the send user data. This
method returns TRUE if successful
ImqBoolean setSendExitNames( const size_t count, const char * names [ ] );
Sets the send exit names to names. Individual names values must not be
blank or null. Sets the send exit count to count. Clears the send user data.
This method returns TRUE if successful.
ImqBoolean setSendExitNames( const size_t count, const ImqString * names [ ] );
Sets the send exit names to names. Individual names values must not be
blank or null. Sets the send exit count to count. Clears the send user data.
This method returns TRUE if successful.
ImqString sendUserData( );
Returns the first of the send user data items, if any. , Returns an empty
string if the send exit count is zero.
49
Reason codes
v MQRC_DATA_LENGTH_ERROR
v MQRC_ITEM_COUNT_ERROR
v MQRC_NULL_POINTER
v MQRC_SOURCE_BUFFER_ERROR
50
ImqCICSBridgeHeader
Header
A
CICS
Bridge
Header
This class encapsulates specific features of the MQCIH data structure (see Table 9
on page 163). Objects of this class are used by applications that send messages to
the CICS bridge through WebSphere MQ for z/OS.
Object attributes
ADS descriptor
Send/receive ADS descriptor. This is set using MQCADSD_NONE. The
initial value is MQCADSD_NONE. The following additional values are
possible:
v MQCADSD_NONE
v MQCADSD_SEND
v MQCADSD_RECV
v MQCADSD_MSGFORMAT
attention identifier
AID key. The field must be of length MQ_ATTENTION_ID_LENGTH.
authenticator
RACF password or passticket. The initial value contains blanks, of length
MQ_AUTHENTICATOR_LENGTH.
bridge abend code
Bridge abend code, of length MQ_ABEND_CODE_LENGTH. The initial
value is four blank characters. The value returned in this field is dependent
on the return code. See Table 3 on page 57 for more details.
51
MQCFUNC_MQGET
MQCFUNC_MQINQ
MQCFUNC_NONE
MQCFUNC_MQOPEN
v MQCFUNC_PUT
v MQCFUNC_MQPUT1
get wait interval
Wait interval for an MQGET call issued by the CICS bridge task. The initial
52
53
v MQCUOWC_CONTINUE
version
The MQCIH version number. The initial value is MQCIH_VERSION_2. The
only other supported value is MQCIH_VERSION_1.
Constructors
ImqCICSBridgeHeader( );
The default constructor.
ImqCICSBridgeHeader( const ImqCICSBridgeHeader & header );
The copy constructor.
54
55
56
Reason codes
v MQRC_BINARY_DATA_LENGTH_ERROR
v MQRC_WRONG_VERSION
Return codes
Table 3. ImqCICSBridgeHeader class return codes
Return Code
Function
CompCode
Reason
Abend
Code
MQCRC_OK
MQCRC_BRIDGE_ERROR
MQFB_CICS
MQCRC_MQ_API_ERROR
WebSphere MQ
call name
WebSphere MQ
CompCode
WebSphere MQ
Reason
MQCRC_BRIDGE_TIMEOUT
WebSphere MQ
call name
WebSphere MQ
CompCode
WebSphere MQ
Reason
MQCRC_CICS_EXEC_ERROR
CICS EIBFN
CICS EIBRESP
CICS EIBRESP2
MQCRC_SECURITY_ERROR
CICS EIBFN
CICS EIBRESP
CICS EIBRESP2
MQCRC_PROGRAM_NOT_AVAILABLE
CICS EIBFN
CICS EIBRESP
CICS EIBRESP2
MQCRC_TRANSID_NOT_AVAILABLE
CICS EIBFN
CICS EIBRESP
CICS EIBRESP2
MQCRC_BRIDGE_ABEND
CICS
ABCODE
MQCRC_APPLICATION_ABEND
CICS
ABCODE
57
ImqDeadLetterHeader
Header
A
Dead Letter
Header
This class encapsulates features of the MQDLH data structure (see Table 10 on
page 164). Objects of this class are typically used by an application that encounters
an message that cannot be processed. A new message comprising a dead-letter
header and the message content is placed on the dead-letter queue, and the
message is discarded.
Object attributes
dead-letter reason code
The reason the message arrived on the dead-letter queue. The initial value
is MQRC_NONE.
destination queue manager name
The name of the original destination queue manager. The name is a string
of length MQ_Q_MGR_NAME_LENGTH. Its initial value is null.
destination queue name
The name of the original destination queue. The name is a string of length
MQ_Q_NAME_LENGTH. Its initial value is null.
put application name
The name of the application that put the message on the dead-letter queue.
The name is a string of length MQ_PUT_APPL_NAME_LENGTH. Its
initial value is null.
put application type
The type of application that put the message on the dead-letter queue. The
initial value is zero.
58
put date
The date when the message was put on the dead-letter queue. The date is
a string of length MQ_PUT_DATE_LENGTH. Its initial value is a null
string.
put time
The time when the message was put on the dead-letter queue. The time is
a string of length MQ_PUT_TIME_LENGTH. Its initial value is a null
string.
Constructors
ImqDeadLetterHeader( );
The default constructor.
ImqDeadLetterHeader( const ImqDeadLetterHeader & header );
The copy constructor.
59
Reason codes
v MQRC_INCONSISTENT_FORMAT
v MQRC_STRUC_ID_ERROR
v MQRC_ENCODING_ERROR
60
ImqDistributionList
Queue
n
distributed from
1
Distribution
List
This class encapsulates a dynamic distribution list that references one or more
queues for the purpose of sending a message or messages to multiple destinations.
Object attributes
first distributed queue
The first of one or more objects of class , in no particular order, in which
the distribution list reference addresses this object.
Initially there are no such objects. To open an ImqDistributionList
successfully, there must be at least one such object.
Note: When an ImqDistributionList object is opened, any open objects that
reference it are automatically closed.
Constructors
ImqDistributionList( );
The default constructor.
ImqDistributionList( const ImqDistributionList & list );
The copy constructor.
61
62
ImqError
Error
A
Figure 10. ImqError class
Object attributes
completion code
The most recent completion code. The initial value is zero. The following
additional values are possible:
v MQCC_OK
v MQCC_WARNING
v MQCC_FAILED
reason code
The most recent reason code. The initial value is zero.
Constructors
ImqError( );
The default constructor.
ImqError( const ImqError & error );
The copy constructor.
63
Reason codes
v MQRC_BUFFER_ERROR
64
ImqGetMessageOptions
Error
A
Get
Message
Options
This class encapsulates the MQGMO data structure (see Table 12 on page 164).
Object attributes
group status
Status of a message for a group of messages. The initial value is
MQGS_NOT_IN_GROUP. The following additional values are possible:
v MQGS_MSG_IN_GROUP
v MQGS_LAST_MSG_IN_GROUP
match options
Options for selecting incoming messages. The initial value is
MQMO_MATCH_MSG_ID | MQMO_MATCH_CORREL_ID. The
following additional values are possible:
v MQMO_GROUP_ID
v MQMO_MATCH_MSG_SEQ_NUMBER
v MQMO_MATCH_OFFSET
v MQMO_MSG_TOKEN
v MQMO_NONE
message token
Message token. A binary value (MQBYTE16) of length
MQ_MSG_TOKEN_LENGTH. The initial value is MQMTOK_NONE.
options
Options applicable to a message. The initial value is MQGMO_NO_WAIT.
The following additional values are possible:
v MQGMO_WAIT
v MQGMO_SYNCPOINT
v MQGMO_SYNCPOINT_IF_PERSISTENT
Chapter 13. WebSphere MQ C++ classes
65
v
v
v
v
v
v
v
MQGMO_NO_SYNCPOINT
MQGMO_MARK_SKIP_BACKOUT
MQGMO_BROWSE_FIRST
MQGMO_BROWSE_NEXT
MQGMO_BROWSE_MSG_UNDER_CURSOR
MQGMO_MSG_UNDER_CURSOR
MQGMO_LOCK
v
v
v
v
v
v
v
v
MQGMO_UNLOCK
MQGMO_ACCEPT_TRUNCATED_MSG
MQGMO_SET_SIGNAL
MQGMO_FAIL_IF_QUIESCING
MQGMO_CONVERT
MQGMO_LOGICAL_ORDER
MQGMO_COMPLETE_MSG
MQGMO_ALL_MSGS_AVAILABLE
v MQGMO_ALL_SEGMENTS_AVAILABLE
v MQGMO_NONE
resolved queue name
Resolved queue name. This attribute is read-only. Names are never longer
than 48 characters and can be padded to that length with nulls. The initial
value is a null string.
returned length
Returned length. The initial value is MQRL_UNDEFINED. This attribute is
read-only.
segmentation
The ability to segment a message. The initial value is MQSEG_INHIBITED.
The additional value, MQSEG_ALLOWED, is possible.
segment status
The segmentation status of a message. The initial value is
MQSS_NOT_A_SEGMENT. The following additional values are possible:
v MQSS_SEGMENT
v MQSS_LAST_SEGMENT
syncpoint participation
TRUE when messages are retrieved under syncpoint control.
wait interval
The length of time that the class get method pauses while waiting for a
suitable message to arrive, if one is not already available. The initial value
is zero, which effects an indefinite wait. The additional value,
MQWI_UNLIMITED, is possible. This attribute is ignored unless the
options include MQGMO_WAIT.
Constructors
ImqGetMessageOptions( );
The default constructor.
ImqGetMessageOptions( const ImqGetMessageOptions & gmo );
The copy constructor.
66
67
Reason codes
v MQRC_BINARY_DATA_LENGTH_ERROR
68
ImqHeader
Item
A
Header
A
Figure 12. ImqHeader class
This abstract class encapsulates common features of the MQDLH data structure
(see Table 13 on page 165).
Object attributes
character set
The original coded character set identifier. Initially MQCCSI_Q_MGR.
encoding
The original encoding. Initially MQENC_NATIVE.
format
The original format. Initially MQFMT_NONE.
header flags
The initial values are:
v Zero for objects of the ImqDeadLetterHeader class
v
v
v
v
69
Constructors
ImqHeader( );
The default constructor.
ImqHeader( const ImqHeader & header );
The copy constructor.
70
ImqIMSBridgeHeader
Header
A
IMS Bridge
Header
This class encapsulates features of the MQIIH data structure (see Table 14 on page
165). Objects of this class are used by applications that send messages to the IMS
bridge through WebSphere MQ for z/OS.
Note: The ImqHeader character set and encoding must have default values and
must not be set to any other values.
Object attributes
authenticator
RACF password or passticket, of length
MQ_AUTHENTICATOR_LENGTH. The initial value is MQIAUT_NONE.
commit mode
Commit mode. See the OTMA Users Guide for more information about IMS
commit modes. The initial value is MQICM_COMMIT_THEN_SEND. The
additional value, MQICM_SEND_THEN_COMMIT, is possible.
logical terminal override
Logical terminal override, of length MQ_LTERM_OVERRIDE_LENGTH.
The initial value is a null string.
message format services map name
MFS map name, of length MQ_MFS_MAP_NAME_LENGTH. The initial
value is a null string.
reply-to format
Format of any reply, of length MQ_FORMAT_LENGTH. The initial value is
MQFMT_NONE.
Chapter 13. WebSphere MQ C++ classes
71
security scope
Desired IMS security processing. The initial value is MQISS_CHECK. The
additional value, MQISS_FULL, is possible.
transaction instance id
Transaction instance identity, a binary (MQBYTE16) value of length
MQ_TRAN_INSTANCE_ID_LENGTH. The initial value is MQITII_NONE.
transaction state
State of the IMS conversation. The initial value is
MQITS_NOT_IN_CONVERSATION. The additional value,
MQITS_IN_CONVERSATION, is possible.
Constructors
ImqIMSBridgeHeader( );
The default constructor.
ImqIMSBridgeHeader( const ImqIMSBridgeHeader & header );
The copy constructor.
72
Reason codes
v
v
v
v
MQRC_BINARY_DATA_LENGTH_ERROR
MQRC_INCONSISTENT_FORMAT
MQRC_ENCODING_ERROR
MQRC_STRUC_ID_ERROR
73
ImqItem
Error
A
Item
A
Figure 14. ImqItem class
This abstract class represents an item, perhaps one of several, within a message.
Items are concatenated together in a message buffer. Each specialization is
associated with a particular data structure that begins with a structure id.
Polymorphic methods in this abstract class allow items to be copied to and from
messages. The ImqMessage class readItem and writeItem methods provide another
style of invoking these polymorphic methods that is more natural for application
programs.
This class relates to the MQI calls listed in Table 15 on page 165.
Object attributes
structure id
A string of four characters at the beginning of the data structure. This
attribute is read-only. This attribute is recommended for derived classes. It
is not included automatically.
Constructors
ImqItem( );
The default constructor.
ImqItem( const ImqItem & item );
The copy constructor.
74
Reason codes
v
v
v
v
MQRC_ENCODING_ERROR
MQRC_STRUC_ID_ERROR
MQRC_INCONSISTENT_FORMAT
MQRC_INSUFFICIENT_BUFFER
v MQRC_INSUFFICIENT_DATA
75
ImqMessage
Message
Tracker
Cache
Message
This class encapsulates an MQMD data structure (see Table 16 on page 166), and
also handles the construction and reconstruction of message data.
Object attributes
application id data
Identity information associated with a message. The initial value is a null
string.
application origin data
Origin information associated with a message. The initial value is a null
string.
backout count
The number of times that a message has been tentatively retrieved and
subsequently backed out. The initial value is zero. This attribute is
read-only.
character set
Coded Character Set Id. The initial value is MQCCSI_Q_MGR. The
following additional values are possible:
v MQCCSI_INHERIT
v MQCCSI_EMBEDDED
You can also use a Coded Character Set Id of your choice. For information
about this, see the code page conversion tables in the WebSphere MQ
Application Programming Reference.
76
encoding
The machine encoding of the message data. The initial value is
MQENC_NATIVE.
expiry A time-dependent quantity that controls how long WebSphere MQ retains
an unretrieved message before discarding it. The initial value is
MQEI_UNLIMITED.
format
The name of the format (template) that describes the layout of data in the
buffer. Names longer than eight characters are truncated to eight
characters. Names are always padded with blanks to eight characters. The
initial constant value is MQFMT_NONE. The following additional
constants are possible:
v MQFMT_ADMIN
v MQFMT_CICS
v MQFMT_COMMAND_1
v MQFMT_COMMAND_2
v MQFMT_DEAD_LETTER_HEADER
v MQFMT_DIST_HEADER
v MQFMT_EVENT
v
v
v
v
v
v
v
MQFMT_IMS
MQFMT_IMS_VAR_STRING
MQFMT_MD_EXTENSION
MQFMT_PCF
MQFMT_REF_MSG_HEADER
MQFMT_RF_HEADER
MQFMT_STRING
v MQFMT_TRIGGER
v MQFMT_WORK_INFO_HEADER
v MQFMT_XMIT_Q_HEADER
You can also use an application-specific string of your choice. For more
information about this, see the Format field of the message descriptor
(MQMD) in the WebSphere MQ Application Programming Reference.
message flags
Segmentation control information. The initial value is
MQMF_SEGMENTATION_INHIBITED. The following additional values
are possible:
v MQMF_SEGMENTATION_ALLOWED
v MQMF_MSG_IN_GROUP
v MQMF_LAST_MSG_IN_GROUP
v MQMF_SEGMENT
v MQMF_LAST_SEGMENT
v MQMF_NONE
message type
The broad categorization of a message. The initial value is
MQMT_DATAGRAM. The following additional values are possible:
v MQMT_SYSTEM_FIRST
v MQMT_SYSTEM_LAST
Chapter 13. WebSphere MQ C++ classes
77
v
v
v
v
v
v
MQMT_DATAGRAM
MQMT_REQUEST
MQMT_REPLY
MQMT_REPORT
MQMT_APPL_FIRST
MQMT_APPL_LAST
You can also use an application-specific value of your choice. For more
information about this, see the MsgType field of the message descriptor
(MQMD) in the WebSphere MQ Application Programming Reference.
offset
original length
The original length of a segmented message. The initial value is
MQOL_UNDEFINED.
persistence
Indicates that the message is important and must at all times be backed up
using persistent storage. This option implies a performance penalty. The
initial value is MQPER_PERSISTENCE_AS_Q_DEF. The following
additional values are possible:
v MQPER_PERSISTENT
v MQPER_NOT_PERSISTENT
priority
The relative priority for transmission and delivery. Messages of the same
priority are usually delivered in the same sequence as they were supplied
(although there are several criteria that must be satisfied to guarantee this).
The initial value is MQPRI_PRIORITY_AS_Q_DEF.
property validation
Specifies whether validation of properties should take place when a
property of the message is set. The initial value is
MQCMHO_DEFAULT_VALIDATION. The following additional values are
possible:
v MQCMHO_VALIDATE
v MQCMHO_NO_VALIDATION
The following methods act on property validation:
MQLONG propertyValidation( ) const ;
Returns the property validation option.
void setPropertyValidation( const MQLONG option );
Sets the property validation option.
put application name
The name of the application that put a message. The initial value is a null
string.
put application type
The type of application that put a message. The initial value is
MQAT_NO_CONTEXT. The following additional values are possible:
v MQAT_AIX
v MQAT_CICS
v MQAT_CICS_BRIDGE
v MQAT_DOS
78
v
v
v
v
v
v
v
MQAT_IMS
MQAT_IMS_BRIDGE
MQAT_MVS
MQAT_NOTES_AGENT
MQAT_OS2
MQAT_OS390
MQAT_OS400
v
v
v
v
v
v
v
v
MQAT_QMGR
MQAT_UNIX
MQAT_WINDOWS
MQAT_WINDOWS_NT
MQAT_XCF
MQAT_DEFAULT
MQAT_UNKNOWN
MQAT_USER_FIRST
v MQAT_USER_LAST
You can also use an application-specific string of your choice. For more
information about this, see the PutApplType field of the message descriptor
(MQMD) in the WebSphere MQ Application Programming Reference.
put date
The date on which a message was put. The initial value is a null string.
put time
The time at which a message was put. The initial value is a null string.
reply-to queue manager name
The name of the queue manager to which any reply should be sent. The
initial value is a null string.
reply-to queue name
The name of the queue to which any reply should be sent. The initial value
is a null string.
report Feedback information associated with a message. The initial value is
MQRO_NONE. The following additional values are possible:
v MQRO_EXCEPTION
v MQRO_EXCEPTION_WITH_DATA
v MQRO_EXCEPTION_WITH_FULL_DATA *
v MQRO_EXPIRATION
v MQRO_EXPIRATION_WITH_DATA
v MQRO_EXPIRATION_WITH_FULL_DATA *
v MQRO_COA
v MQRO_COA_WITH_DATA
v MQRO_COA_WITH_FULL_DATA *
v MQRO_COD
v MQRO_COD_WITH_DATA
v MQRO_COD_WITH_FULL_DATA *
v MQRO_PAN
v MQRO_NAN
Chapter 13. WebSphere MQ C++ classes
79
v
v
v
v
v
v
MQRO_NEW_MSG_ID
MQRO_NEW_CORREL_ID
MQRO_COPY_MSG_ID_TO_CORREL_ID
MQRO_PASS_CORREL_ID
MQRO_DEAD_LETTER_Q
MQRO_DISCARD_MSG
Constructors
ImqMessage( );
The default constructor.
ImqMessage( const ImqMessage & msg );
The copy constructor. See the operator = method for details.
80
81
82
83
ImqMessageTracker
Error
A
Message
Tracker
Object attributes
accounting token
A binary value (MQBYTE32) of length
MQ_ACCOUNTING_TOKEN_LENGTH. The initial value is
MQACT_NONE.
correlation id
A binary value (MQBYTE24) of length MQ_CORREL_ID_LENGTH that
you assign to correlate messages. The initial value is MQCI_NONE. The
additional value, MQCI_NEW_SESSION, is possible.
feedback
Feedback information to be sent with a message. The initial value is
MQFB_NONE. The following additional values are possible:
v MQFB_SYSTEM_FIRST
v
v
v
v
v
v
v
84
MQFB_SYSTEM_LAST
MQFB_APPL_FIRST
MQFB_APPL_LAST
MQFB_COA
MQFB_COD
MQFB_EXPIRATION
MQFB_PAN
v
v
v
v
v
v
v
MQFB_NAN
MQFB_QUIT
MQFB_DATA_LENGTH_ZERO
MQFB_DATA_LENGTH_NEGATIVE
MQFB_DATA_LENGTH_TOO_BIG
MQFB_BUFFER_OVERFLOW
MQFB_LENGTH_OFF_BY_ONE
v
v
v
v
v
v
v
v
MQFB_IIH_ERROR
MQFB_NOT_AUTHORIZED_FOR_IMS
MQFB_IMS_ERROR
MQFB_IMS_FIRST
MQFB_IMS_LAST
MQFB_CICS_APPL_ABENDED
MQFB_CICS_APPL_NOT_STARTED
MQFB_CICS_BRIDGE_FAILURE
v
v
v
v
v
v
v
MQFB_CICS_CCSID_ERROR
MQFB_CICS_CIH_ERROR
MQFB_CICS_COMMAREA_ERROR
MQFB_CICS_CORREL_ID_ERROR
MQFB_CICS_DLQ_ERROR
MQFB_CICS_ENCODING_ERROR
MQFB_CICS_INTERNAL_ERROR
v MQFB_CICS_NOT_AUTHORIZED
v MQFB_CICS_UOW_BACKED_OUT
v MQFB_CICS_UOW_ERROR
You can also use an application-specific string of your choice. For more
information about this, see the Feedback field of the message descriptor
(MQMD) in the WebSphere MQ Application Programming Reference.
group id
A binary value (MQBYTE24) of length MQ_GROUP_ID_LENGTH unique
within a queue. The initial value is MQGI_NONE.
message id
A binary value (MQBYTE24) of length MQ_MSG_ID_LENGTH unique
within a queue. The initial value is MQMI_NONE.
Constructors
ImqMessageTracker( );
The default constructor.
ImqMessageTracker( const ImqMessageTracker & tracker );
The copy constructor. See the operator = method for details.
85
86
Reason codes
v MQRC_BINARY_DATA_LENGTH_ERROR
87
ImqNamelist
Object
A
Namelist
This class encapsulates a namelist. It relates to the MQI calls listed in Table 18 on
page 166.
Object attributes
name count
The number of object names in namelist names. This attribute is read-only.
namelist names
Object names, the number of which is indicated by the name count. This
attribute is read-only.
Constructors
ImqNamelist( );
The default constructor.
ImqNamelist( const ImqNamelist & list );
The copy constructor. The ImqObject open status is false.
ImqNamelist( const char * name);
Sets the ImqObject name to name.
88
MQLONG nameCount ( );
Returns the name count without any indication of possible errors.
ImqBoolean namelistName ( const MQLONG index, ImqString & name );
Provides a copy of one the namelist names by zero based index. It returns
TRUE if successful.
ImqString namelistName ( const MQLONG index );
Returns one of the namelist names by zero-based index without any
indication of possible errors.
Reason codes
v MQRC_INDEX_ERROR
v MQRC_INDEX_NOT_PRESENT
89
ImqObject
Error
A
Object
A
Figure 18. ImqObject class
Class attributes
behavior
Controls the behavior of implicit opening.
IMQ_IMPL_OPEN (8L)
Implicit opening is allowed. This is the default.
Object attributes
alteration date
The alteration date. This attribute is read-only.
alteration time
The alteration time. This attribute is read-only.
alternate user id
The alternate user id, up to MQ_USER_ID_LENGTH characters. The initial
value is a null string.
alternate security id
The alternate security id. A binary value (MQBYTE40) of length
MQ_SECURITY_ID_LENGTH. The initial value is MQSID_NONE.
90
close options
Options that apply when an object is closed. The initial value is
MQCO_NONE. This attribute is ignored during implicit reopen operations,
where a value of MQCO_NONE is always used.
connection reference
A reference to an ImqQueueManager object that provides the required
connection to a (local) queue manager. For an ImqQueueManager object, it
is the object itself. The initial value is zero.
Note: Do not confuse this with the queue manager name that identifies a
queue manager (possibly remote) for a named queue.
description
The descriptive name (up to 64 characters) of the queue manager, queue,
namelist, or process. This attribute is read-only.
name
91
Constructors
ImqObject( );
The default constructor.
ImqObject( const ImqObject & object );
The copy constructor. The open status will be FALSE.
92
while the open status is FALSE. The data length of token must be either
zero or MQ_SECURITY_ID_LENGTH. It returns TRUE if successful.
ImqBoolean setAlternateSecurityId( const MQBYTE* token = 0);
Sets the alternate security id. token can be zero, which is the same as
specifying MQSID_NONE. If token is nonzero, it must address
MQ_SECURITY_ID_LENGTH bytes of binary data. When using predefined
values such as MQSID_NONE, you might need to make a cast to ensure
signature match; for example, (MQBYTE *)MQSID_NONE.
The alternate security id can be set only while the open status is TRUE. It
returns TRUE if successful.
ImqBoolean setAlternateSecurityId( const unsigned char * id = 0);
Sets the alternate security id.
ImqBoolean close( );
Sets the open status to FALSE. It returns TRUE if successful.
MQLONG closeOptions( ) const ;
Returns the close options.
void setCloseOptions( const MQLONG options );
Sets the close options.
ImqQueueManager * connectionReference( ) const ;
Returns the connection reference.
void setConnectionReference( ImqQueueManager & manager );
Sets the connection reference.
void setConnectionReference( ImqQueueManager * manager = 0 );
Sets the connection reference.
virtual ImqBoolean description( ImqString & description ) = 0 ;
Provides a copy of the description. It returns TRUE if successful.
ImqString description( );
Returns a copy of the description without any indication of possible errors.
virtual ImqBoolean name( ImqString & name );
Provides a copy of the name. It returns TRUE if successful.
ImqString name( );
Returns a copy of the name without any indication of possible errors.
ImqBoolean setName( const char * name = 0 );
Sets the name. The name can only be set while the open status is FALSE,
and, for an ImqQueueManager, while the connection status is FALSE. It
returns TRUE if successful.
ImqObject * nextManagedObject( ) const ;
Returns the next managed object.
ImqBoolean open( );
Changes the open status to TRUE by opening the object as necessary,
using amongst other attributes the open options and the name. This
method uses the connection reference information and the
ImqQueueManager connect method if necessary to ensure that the
ImqQueueManager connection status is TRUE. It returns the open status.
93
94
ImqBoolean inquire( const MQLONG char-attr, char * & buffer, const size_t
length );
Returns a character string, the index of which is an MQCA_* value.
Note: Both the above methods return only a single attribute value. If a
snapshot is required of more than one value, where the values are
consistent with each other for an instant, WebSphere MQ C++ does not
provide this facility and you must use the MQINQ call with appropriate
parameters.
virtual void openInformationDisperse( );
Disperses information from the variable section of the MQOD data
structure immediately after an MQOPEN call.
virtual ImqBoolean openInformationPrepare( );
Prepares information for the variable section of the MQOD data structure
immediately before an MQOPEN call, and returns TRUE if successful.
ImqBoolean set( const MQLONG int-attr, const MQLONG value );
Sets a WebSphere MQ integer attribute.
ImqBoolean set( const MQLONG char-attr, const char * buffer, const size_t
required-length );
Sets a WebSphere MQ character attribute.
void setNextManagedObject( const ImqObject * object = 0 );
Sets the next managed object.
Attention: Use this function only if you are sure it will not break the
managed object list.
void setPreviousManagedObject( const ImqObject * object = 0 );
Sets the previous managed object.
Attention: Use this function only if you are sure it will not break the
managed object list.
95
Reason codes
v
v
v
v
v
v
v
v
v
v
96
MQRC_ATTRIBUTE_LOCKED
MQRC_INCONSISTENT_OBJECT_STATE
MQRC_NO_CONNECTION_REFERENCE
MQRC_STORAGE_NOT_AVAILABLE
MQRC_REOPEN_SAVED_CONTEXT_ERR
(reason codes from MQCLOSE)
(reason codes from MQCONN)
(reason codes from MQINQ)
(reason codes from MQOPEN)
(reason codes from MQSET)
ImqProcess
Object
A
Process
Object attributes
application id
The identity of the application process. This attribute is read-only.
application type
The type of the application process. This attribute is read-only.
environment data
The environment information for the process. This attribute is read-only.
user data
User data for the process. This attribute is read-only.
Constructors
ImqProcess( );
The default constructor.
ImqProcess( const ImqProcess & process );
The copy constructor. The ImqObject open status is FALSE.
ImqProcess( const char * name );
Sets the ImqObject name.
97
98
ImqPutMessageOptions
Error
A
Put
Message
Options
This class encapsulates the MQPMO data structure (see Table 21 on page 167).
Object attributes
context reference
An ImqQueue that provides a context for messages. Initially there is no
reference.
options
The put message options. The initial value is MQPMO_NONE. The
following additional values are possible:
v MQPMO_SYNCPOINT
v MQPMO_NO_SYNCPOINT
v MQPMO_NEW_MSG_ID
v
v
v
v
MQPMO_NEW_CORREL_ID
MQPMO_LOGICAL_ORDER
MQPMO_NO_CONTEXT
MQPMO_DEFAULT_CONTEXT
v
v
v
v
v
v
MQPMO_PASS_IDENTITY_CONTEXT
MQPMO_PASS_ALL_CONTEXT
MQPMO_SET_IDENTITY_CONTEXT
MQPMO_SET_ALL_CONTEXT
MQPMO_ALTERNATE_USER_AUTHORITY
MQPMO_FAIL_IF_QUIESCING
99
record fields
The flags that control the inclusion of put message records when a message
is put. The initial value is MQPMRF_NONE. The following additional
values are possible:
v MQPMRF_MSG_ID
v MQPMRF_CORREL_ID
v MQPMRF_GROUP_ID
v MQPMRF_FEEDBACK
v MQPMRF_ACCOUNTING_TOKEN
ImqMessageTracker attributes are taken from the object for any field that is
specified. ImqMessageTracker attributes are taken from the ImqMessage
object for any field that is not specified.
resolved queue manager name
Name of a destination queue manager determined during a put. The initial
value is null. This attribute is read-only.
resolved queue name
Name of a destination queue determined during a put. The initial value is
null. This attribute is read-only.
syncpoint participation
TRUE when messages are put under syncpoint control.
Constructors
ImqPutMessageOptions( );
The default constructor.
ImqPutMessageOptions( const ImqPutMessageOptions & pmo );
The copy constructor.
100
Reason codes
v MQRC_STORAGE_NOT_AVAILABLE
101
ImqQueue
Message
Tracker
Object
A
Queue
Object attributes
backout requeue name
Excessive backout requeue name. This attribute is read-only.
backout threshold
Backout threshold. This attribute is read-only.
base queue name
Name of the queue that the alias resolves to. This attribute is read-only.
cluster name
Cluster name. This attribute is read-only.
cluster namelist name
Cluster namelist name. This attribute is read-only.
cluster workload rank
Cluster workload rank. This attribute is read-only.
cluster workload priority
Cluster workload priority. This attribute is read-only.
102
103
inhibit get
Whether get operations are allowed. The initial value is dependent on the
queue definition. This attribute is valid for an alias or local queue only.
inhibit put
Whether put operations are allowed. The initial value is dependent on the
queue definition.
initiation queue name
Name of the initiation queue. This attribute is read-only.
maximum depth
Maximum number of messages allowed on the queue. This attribute is
read-only.
maximum message length
Maximum length for any message on this queue, which can be less than
the maximum for any queue managed by the associated queue manager.
This attribute is read-only.
message delivery sequence
Whether message priority is relevant. This attribute is read-only.
next distributed queue
Next object of this class, in no particular order, having the same
distribution list reference as this object. The initial value is zero.
If an object in a chain is deleted, the previous object and next object are
updated so that their distributed queue links no longer point to the deleted
object.
non-persistent message class
Level of reliability for non-persistent messages put to this queue. This
attribute is read-only.
open input count
Number of ImqQueue objects that are open for input. This attribute is
read-only.
open output count
Number of ImqQueue objects that are open for output. This attribute is
read-only.
previous distributed queue
Previous object of this class, in no particular order, having the same
distribution list reference as this object. The initial value is zero.
If an object in a chain is deleted, the previous object and next object are
updated so that their distributed queue links no longer point to the deleted
object.
process name
Name of the process definition. This attribute is read-only.
queue accounting
Level of accounting information for queues. This attribute is read-only.
queue manager name
Name of the queue manager (possibly remote) where the queue resides. Do
not confuse the queue manager named here with the ImqObject connection
reference, which references the (local) queue manager providing a
connection. The initial value is null.
104
queue monitoring
Level of monitoring data collection for the queue. This attribute is
read-only.
queue statistics
Level of statistics data for the queue. This attribute is read-only.
queue type
Queue type. This attribute is read-only.
remote queue manager name
Name of the remote queue manager. This attribute is read-only.
remote queue name
Name of the remote queue as known on the remote queue manager. This
attribute is read-only.
resolved queue manager name
Resolved queue manager name. This attribute is read-only.
resolved queue name
Resolved queue name. This attribute is read-only.
retention interval
Queue retention interval. This attribute is read-only.
scope
service interval
Service interval. This attribute is read-only.
service interval event
Control attribute for service interval events. This attribute is read-only.
shareability
Whether the queue can be shared. This attribute is read-only.
storage class
Storage class. This attribute is read-only.
transmission queue name
Name of the transmission queue. This attribute is read-only.
trigger control
Trigger control. The initial value depends on the queue definition. This
attribute is valid for a local queue only.
trigger data
Trigger data. The initial value depends on the queue definition. This
attribute is valid for a local queue only.
trigger depth
Trigger depth. The initial value depends on the queue definition. This
attribute is valid for a local queue only.
trigger message priority
Threshold message priority for triggers. The initial value depends on the
queue definition. This attribute is valid for a local queue only.
trigger type
Trigger type. The initial value depends on the queue definition. This
attribute is valid for a local queue only.
usage Usage. This attribute is read-only.
105
Constructors
ImqQueue( );
The default constructor.
ImqQueue( const ImqQueue & queue );
The copy constructor. The ImqObject open status will be FALSE.
ImqQueue( const char * name );
Sets the ImqObject name.
106
MQLONG clusterWorkLoadRank ( );
Returns the cluster workload rank value without any indication of possible
errors.
ImqBoolean clusterWorkLoadUseQ ( MQLONG & useq );
Provides a copy of the cluster workload use queue value. It returns TRUE
if successful.
MQLONG clusterWorkLoadUseQ ( );
Returns the cluster workload use queue value without any indication of
possible errors.
ImqBoolean creationDate( ImqString & date );
Provides a copy of the creation date. It returns TRUE if successful.
ImqString creationDate( );
Returns the creation date without any indication of possible errors.
ImqBoolean creationTime( ImqString & time );
Provides a copy of the creation time. It returns TRUE if successful.
ImqString creationTime( );
Returns the creation time without any indication of possible errors.
ImqBoolean currentDepth( MQLONG & depth );
Provides a copy of the current depth. It returns TRUE if successful.
MQLONG currentDepth( );
Returns the current depth without any indication of possible errors.
ImqBoolean defaultInputOpenOption( MQLONG & option );
Provides a copy of the default input open option. It returns TRUE if
successful.
MQLONG defaultInputOpenOption( );
Returns the default input open option without any indication of possible
errors.
ImqBoolean defaultPersistence( MQLONG & persistence );
Provides a copy of the default persistence. It returns TRUE if successful.
MQLONG defaultPersistence( );
Returns the default persistence without any indication of possible errors.
ImqBoolean defaultPriority( MQLONG & priority );
Provides a copy of the default priority. It returns TRUE if successful.
MQLONG defaultPriority( );
Returns the default priority without any indication of possible errors.
ImqBoolean defaultBind( MQLONG & bind );
Provides a copy of the default bind. It returns TRUE if successful.
MQLONG defaultBind( );
Returns the default bind without any indication of possible errors.
ImqBoolean definitionType( MQLONG & type );
Provides a copy of the definition type. It returns TRUE if successful.
MQLONG definitionType( );
Returns the definition type without any indication of possible errors.
ImqBoolean depthHighEvent( MQLONG & event );
Provides a copy of the enablement state of the depth high event. It returns
TRUE if successful.
Chapter 13. WebSphere MQ C++ classes
107
MQLONG depthHighEvent( );
Returns the enablement state of the depth high event without any
indication of possible errors.
ImqBoolean depthHighLimit( MQLONG & limit );
Provides a copy of the depth high limit. It returns TRUE if successful.
MQLONG depthHighLimit( );
Returns the depth high limit value without any indication of possible
errors.
ImqBoolean depthLowEvent( MQLONG & event );
Provides a copy of the enablement state of the depth low event. It returns
TRUE if successful.
MQLONG depthLowEvent( );
Returns the enablement state of the depth low event without any
indication of possible errors.
ImqBoolean depthLowLimit( MQLONG & limit );
Provides a copy of the depth low limit. It returns TRUE if successful.
MQLONG depthLowLimit( );
Returns the depth low limit value without any indication of possible
errors.
ImqBoolean depthMaximumEvent( MQLONG & event );
Provides a copy of the enablement state of the depth maximum event. It
returns TRUE if successful.
MQLONG depthMaximumEvent( );
Returns the enablement state of the depth maximum event without any
indication of possible errors.
ImqDistributionList * distributionListReference( ) const ;
Returns the distribution list reference.
void setDistributionListReference( ImqDistributionList & list );
Sets the distribution list reference.
void setDistributionListReference( ImqDistributionList * list = 0 );
Sets the distribution list reference.
ImqBoolean distributionLists( MQLONG & support );
Provides a copy of the distribution lists value. It returns TRUE if
successful.
MQLONG distributionLists( );
Returns the distribution lists value without any indication of possible
errors.
ImqBoolean setDistributionLists( const MQLONG support );
Sets the distribution lists value. It returns TRUE if successful.
ImqString dynamicQueueName( ) const ;
Returns a copy of the dynamic queue name.
ImqBoolean setDynamicQueueName( const char * name );
Sets the dynamic queue name. The dynamic queue name can be set only
while the ImqObject open status is FALSE. It returns TRUE if successful.
ImqBoolean get( ImqMessage & msg, ImqGetMessageOptions & options );
Retrieves a message from the queue, using the specified options. Invokes
the ImqObject openFor method if necessary to ensure that the ImqObject
108
109
110
111
ImqString remoteQueueName( );
Returns the remote queue name without any indication of possible errors.
ImqBoolean resolvedQueueManagerName( ImqString & name );
Provides a copy of the resolved queue manager name. It returns TRUE if
successful.
Note: This method fails unless MQOO_RESOLVE_NAMES is among the
ImqObject open options.
ImqString resolvedQueueManagerName( ) ;
Returns the resolved queue manager name, without any indication of
possible errors.
ImqBoolean resolvedQueueName( ImqString & name );
Provides a copy of the resolved queue name. It returns TRUE if successful.
Note: This method fails unless MQOO_RESOLVE_NAMES is among the
ImqObject open options.
ImqString resolvedQueueName( ) ;
Returns the resolved queue name, without any indication of possible
errors.
ImqBoolean retentionInterval( MQLONG & interval );
Provides a copy of the retention interval. It returns TRUE if successful.
MQLONG retentionInterval( );
Returns the retention interval without any indication of possible errors.
ImqBoolean scope( MQLONG & scope );
Provides a copy of the scope. It returns TRUE if successful.
MQLONG scope( );
Returns the scope without any indication of possible errors.
ImqBoolean serviceInterval( MQLONG & interval );
Provides a copy of the service interval. It returns TRUE if successful.
MQLONG serviceInterval( );
Returns the service interval without any indication of possible errors.
ImqBoolean serviceIntervalEvent( MQLONG & event );
Provides a copy of the enablement state of the service interval event. It
returns TRUE if successful.
MQLONG serviceIntervalEvent( );
Returns the enablement state of the service interval event without any
indication of possible errors.
ImqBoolean shareability( MQLONG & shareability );
Provides a copy of the shareability value. It returns TRUE if successful.
MQLONG shareability( );
Returns the shareability value without any indication of possible errors.
ImqBoolean storageClass( ImqString & class );
Provides a copy of the storage class. It returns TRUE if successful.
ImqString storageClass( );
Returns the storage class without any indication of possible errors.
112
113
Reason codes
v MQRC_ATTRIBUTE_LOCKED
v
v
v
v
v
v
v
v
v
114
MQRC_CONTEXT_OBJECT_NOT_VALID
MQRC_CONTEXT_OPEN_ERROR
MQRC_CURSOR_NOT_VALID
MQRC_NO_BUFFER
MQRC_REOPEN_EXCL_INPUT_ERROR
MQRC_REOPEN_INQUIRE_ERROR
MQRC_REOPEN_TEMPORARY_Q_ERROR
(reason codes from MQGET)
(reason codes from MQPUT)
ImqQueueManager
Object
A
n
managed by
1
Queue
Manager
Class attributes
behavior
Controls the behavior of implicit connection and disconnection.
IMQ_EXPL_DISC_BACKOUT (0L)
An explicit call to the disconnect method implies backout. This
attribute is mutually exclusive with IMQ_EXPL_DISC_COMMIT.
IMQ_EXPL_DISC_COMMIT (1L)
An explicit call to the disconnect method implies commit (the
default). This attribute is mutually exclusive with
IMQ_EXPL_DISC_BACKOUT.
IMQ_IMPL_CONN (2L)
Implicit connection is allowed (the default).
IMQ_IMPL_DISC_BACKOUT (0L)
An implicit call to the disconnect method, which can occur during
object destruction, implies backout. This attribute is mutually
exclusive with the IMQ_IMPL_DISC_COMMIT.
IMQ_IMPL_DISC_COMMIT (4L)
An implicit call to the disconnect method, which can occur during
Chapter 13. WebSphere MQ C++ classes
115
Object attributes
accounting connections override
Allows applications to override the setting of the MQI accounting and
queue accounting values.This attribute is read-only.
accounting interval
How long before intermediate accounting records are written (in seconds).
This attribute is read-only.
activity recording
Controls the generation of activity reports. This attribute is read-only.
adopt new mca check
The elements checked to determine if an MCA should be adopted when a
new inbound channel is detected that has the same name as an MCA that
is already active. This attribute is read-only.
adopt new mca type
Whether an orphaned instance of an MCA of a given channel type should
be restarted automatically when a new inbound channel request matching
the adopt new mca check parameters is detected. This attribute is
read-only.
authentication type
Indicates the type of authentication which is being performed.
authority event
Controls authority events. This attribute is read-only.
begin options
Options that apply to the begin method. The initial value is
MQBO_NONE.
bridge event
Whether IMS Bridge events are generated. This attribute is read-only.
channel auto definition
Channel auto definition value. This attribute is read-only.
channel auto definition event
Channel auto definition event value. This attribute is read-only.
channel auto definition exit
Channel auto definition exit name. This attribute is read-only.
channel event
Whether channel events are generated. This attribute is read-only.
channel initiator adapters
The number of adapter subtasks to use for processing WebSphere MQ
calls. This attribute is read-only.
channel initiator control
Whether the Channel Initiator should be started automatically when the
Queue Manager is started. This attribute is read-only.
channel initiator dispatchers
The number of dispatchers to use for the channel initiator. This attribute is
read-only.
116
117
connect options
Options that apply to the connect method. The initial value is
MQCNO_NONE. The following additional values may be possible,
depending on platform:
v MQCNO_STANDARD_BINDING
v MQCNO_FASTPATH_BINDING
v MQCNO_HANDLE_SHARE_NONE
v MQCNO_HANDLE_SHARE_BLOCK
v MQCNO_HANDLE_SHARE_NO_BLOCK
v MQCNO_SERIALIZE_CONN_TAG_Q_MGR
v MQCNO_SERIALIZE_CONN_TAG_QSG
v MQCNO_RESTRICT_CONN_TAG_Q_MGR
v MQCNO_RESTRICT_CONN_TAG_QSG
connection id
A unique identifier that allows MQ to reliably identify an application.
connection status
TRUE when connected to the queue manager. This attribute is read-only.
connection tag
A tag to be associated with a connection. This attribute can only be set
when not connected. The initial value is null.
cryptographic hardware
Configuration details for cryptographic hardware. For MQ client
connections.
dead-letter queue name
Name of the dead-letter queue. This attribute is read-only.
default transmission queue name
Default transmission queue name. This attribute is read-only.
distribution lists
Capability of the queue manager to support distribution lists.
dns group
The name of the group that the TCP listener that handles inbound
transmissions for the queue-sharing group should join when using
Workload Manager Dynamic Domain Name Services support. This
attribute is read-only.
dns wlm
Whether the TCP listener that handles inbound transmissions for the
queue-sharing group should register with Workload Manager for Dynamic
Domain Name Services. This attribute is read-only.
first authentication record
The first of one or more objects of class ImqAuthenticationRecord, in no
particular order, in which the ImqAuthenticationRecord connection
reference addresses this object. For MQ client connections.
first managed object
The first of one or more objects of class ImqObject, in no particular order,
in which the ImqObject connection reference addresses this object. The
initial value is zero.
inhibit event
Controls inhibit events. This attribute is read-only.
118
ip address version
Which IP protocol (IPv4 or IPv6) to use for a channel connection. This
attribute is read-only.
key repository
Location of the key database file in which keys and certificates are stored.
For WebSphere MQ client connections.
key reset count
The number of unencrypted bytes sent and received within an SSL
conversation before the secret key is renegotiated. This attribute applies
only to client connections using MQCONNX. See also ssl key reset count.
listener timer
The time interval (in seconds) between attempts by WebSphere MQ to
restart the listener if there has been an APPC or TCP/IP failure. This
attribute is read-only.
local event
Controls local events. This attribute is read-only.
logger event
Controls whether recovery log events are generated. This attribute is
read-only.
lu group name
The generic LU name that the LU 6.2 listener that handles inbound
transmissions for the queue-sharing group should use. This attribute is
read-only.
lu name
The name of the LU to use for outbound LU 6.2 transmissions. This
attribute is read-only.
lu62 arm suffix
The suffix of the SYS1.PARMLIB member APPCPMxx, that nominates the
LUADD for this channel initiator. This attribute is read-only.
lu62 channels
The maximum number of channels that can be current or clients that can
be connected, that use the LU 6.2 transmission protocol. This attribute is
read-only.
maximum active channels
The maximum number of channels that can be active at any time. This
attribute is read-only.
maximum channels
The maximum number of channels that can be current (including
server-connection channels with connected clients). This attribute is
read-only.
maximum handles
Maximum number of handles. This attribute is read-only.
maximum message length
Maximum possible length for any message on any queue managed by this
queue manager. This attribute is read-only.
maximum priority
Maximum message priority. This attribute is read-only.
119
120
121
user id
On UNIX platforms, the applications real user ID. On Windows
platforms, the applications user ID.
Constructors
ImqQueueManager( );
The default constructor.
ImqQueueManager( const ImqQueueManager & manager );
The copy constructor. The connection status will be FALSE.
ImqQueueManager( const char * name );
Sets the ImqObject name to name.
Destructors
When an ImqQueueManager object is destroyed, it is automatically disconnected.
122
MQLONG adoptNewMCACheck ( );
Returns the adopt new MCA check value without any indication of
possible errors.
ImqBoolean adoptNewMCAType ( MQLONG & type );
Provides a copy of the adopt new MCA type. It returns TRUE if successful.
MQLONG adoptNewMCAType ( );
Returns the adopt new MCA type without any indication of possible
errors.
QLONG authenticationType ( ) const;
Returns the authentication type.
void setAuthenticationType ( const MQLONG type = MQCSP_AUTH_NONE );
Sets the authentication type.
ImqBoolean authorityEvent( MQLONG & event );
Provides a copy of the enablement state of the authority event. It returns
TRUE if successful.
MQLONG authorityEvent( );
Returns the enablement state of the authority event without any indication
of possible errors.
ImqBoolean backout( );
Backs out uncommitted changes. It returns TRUE if successful.
ImqBoolean begin( );
Begins a unit of work. The begin options affect the behavior of this
method. It returns TRUE if successful, but it also returns TRUE even if the
underlying MQBEGIN call returns
MQRC_NO_EXTERNAL_PARTICIPANTS or
MQRC_PARTICIPANT_NOT_AVAILABLE (which are both associated with
MQCC_WARNING).
MQLONG beginOptions( ) const ;
Returns the begin options.
void setBeginOptions( const MQLONG options = MQBO_NONE );
Sets the begin options.
ImqBoolean bridgeEvent ( MQLONG & event);
Provides a copy of the bridge event value. It returns TRUE if successful.
MQLONG bridgeEvent ( );
Returns the bridge event value without any indication of possible errors.
ImqBoolean channelAutoDefinition( MQLONG & value );
Provides a copy of the channel auto definition value. It returns TRUE if
successful.
MQLONG channelAutoDefinition( );
Returns the channel auto definition value without any indication of
possible errors.
ImqBoolean channelAutoDefinitionEvent( MQLONG & value );
Provides a copy of the channel auto definition event value. It returns
TRUE if successful.
MQLONG channelAutoDefinitionEvent( );
Returns the channel auto definition event value without any indication of
possible errors.
123
124
125
ImqString clusterWorkloadExit( );
Returns the cluster workload exit name without any indication of possible
errors.
ImqBoolean clusterWorkloadLength( MQLONG & length );
Provides a copy of the cluster workload length. It returns TRUE if
successful.
MQLONG clusterWorkloadLength( );
Returns the cluster workload length without any indication of possible
errors.
ImqBoolean clusterWorkLoadMRU ( MQLONG & mru );
Provides a copy of the cluster workload most recently used channels value.
It returns TRUE if successful.
MQLONG clusterWorkLoadMRU ( );
Returns the cluster workload most recently used channels value without
any indication of possible errors.
ImqBoolean clusterWorkLoadUseQ ( MQLONG & useq );
Provides a copy of the cluster workload use queue value. It returns TRUE
if successful.
MQLONG clusterWorkLoadUseQ ( );
Returns the cluster workload use queue value without any indication of
possible errors.
ImqBoolean commandEvent ( MQLONG & event );
Provides a copy of the command event value. It returns TRUE if
successful.
MQLONG commandEvent ( );
Returns the command event value without any indication of possible
errors.
ImqBoolean commandInputQueueName( ImqString & name );
Provides a copy of the command input queue name. It returns TRUE if
successful.
ImqString commandInputQueueName( );
Returns the command input queue name without any indication of
possible errors.
ImqBoolean commandLevel( MQLONG & level );
Provides a copy of the command level. It returns TRUE if successful.
MQLONG commandLevel( );
Returns the command level without any indication of possible errors.
MQLONG commandServerControl ( );
Returns the command server startup value without any indication of
possible errors.
ImqBoolean commandServerControl ( MQLONG & server );
Provides a copy of the command server control startup value. It returns
TRUE if successful.
ImqBoolean commit( );
Commits uncommitted changes. It returns TRUE if successful.
ImqBoolean connect( );
Connects to the queue manager with the given ImqObject name, the
default being the local queue manager. If you want to connect to a specific
126
127
ImqString defaultTransmissionQueueName( );
Returns the default transmission queue name without any indication of
possible errors.
ImqBoolean disconnect( );
Disconnects from the queue manager and sets the connection status to
FALSE. Closes all ImqProcess and ImqQueue objects associated with this
object, and severs their connection reference before disconnection. If more
than one ImqQueueManager object is connected to the same queue
manager, only the last to disconnect performs a physical disconnection;
others perform a logical disconnection. Uncommitted changes are
committed on physical disconnection only.
This method returns TRUE if successful. If it is called when there is no
existing connection, the return code is also true.
ImqBoolean distributionLists( MQLONG & support );
Provides a copy of the distribution lists value. It returns TRUE if
successful.
MQLONG distributionLists( );
Returns the distribution lists value without any indication of possible
errors.
ImqBoolean dnsGroup ( ImqString & group );
Provides a copy of the DNS group name. It returns TRUE if successful.
ImqString dnsGroup ( );
Returns the DNS group name without any indication of possible errors.
ImqBoolean dnsWlm ( MQLONG & wlm );
Provides a copy of the DNS WLM value. It returns TRUE if successful.
MQLONG dnsWlm ( );
Returns the DNS WLM value without any indication of possible errors.
ImqAuthenticationRecord * firstAuthenticationRecord ( ) const ;
Returns the first authentication record.
void setFirstAuthenticationRecord ( const ImqAuthenticationRecord * air = 0 );
Sets the first authentication record.
ImqObject * firstManagedObject( ) const ;
Returns the first managed object.
ImqBoolean inhibitEvent( MQLONG & event );
Provides a copy of the enablement state of the inhibit event. It returns
TRUE if successful.
MQLONG inhibitEvent( );
Returns the enablement state of the inhibit event without any indication of
possible errors.
ImqBoolean ipAddressVersion ( MQLONG & version );
Provides a copy of the IP address version value. It returns TRUE if
successful.
MQLONG ipAddressVersion ( );
Returns the IP address version value without any indication of possible
errors.
ImqBoolean keepAlive ( MQLONG & keepalive );
Provides a copy of the keep alive value. It returns TRUE if successful.
128
MQLONG keepAlive ( );
Returns the keep alive value without any indication of possible errors.
ImqString keyRepository ( );
Returns the key repository.
ImqBoolean setKeyRepository ( const char * repository = 0 );
Sets the key repository. It returns TRUE if successful.
ImqBoolean listenerTimer ( MQLONG & timer );
Provides a copy of the listener timer value. It returns TRUE if successful.
MQLONG listenerTimer ( );
Returns the listener timer value without any indication of possible errors.
ImqBoolean localEvent( MQLONG & event );
Provides a copy of the enablement state of the local event. It returns TRUE
if successful.
MQLONG localEvent( );
Returns the enablement state of the local event without any indication of
possible errors.
ImqBoolean loggerEvent ( MQLONG & count );
Provides a copy of the logger event value. It returns TRUE if successful.
MQLONG loggerEvent ( );
Returns the logger event value without any indication of possible errors.
ImqBoolean luGroupName ( ImqString & name );.
Provides a copy of the LU group name. It returns TRUE if successful
ImqString luGroupName ( );
Returns the LU group name without any indication of possible errors.
ImqBoolean lu62ARMSuffix ( ImqString & suffix );
Provides a copy of the LU62 ARM suffix. It returns TRUE if successful.
ImqString lu62ARMSuffix ( );
Returns the LU62 ARM suffix without any indication of possible errors
ImqBoolean luName ( ImqString & name );
Provides a copy of the LU name. It returns TRUE if successful.
ImqString luName ( );
Returns the LU name without any indication of possible errors.
ImqBoolean maximumActiveChannels ( MQLONG & channels);
Provides a copy of the maximum active channels value. It returns TRUE if
successful.
MQLONG maximumActiveChannels ( );
Returns the maximum active channels value without any indication of
possible errors.
ImqBoolean maximumCurrentChannels ( MQLONG & channels );
Provides a copy of the maximum current channels value. It returns TRUE
if successful.
MQLONG maximumCurrentChannels ( );
Returns the maximum current channels value without any indication of
possible errors.
ImqBoolean maximumHandles( MQLONG & number );
Provides a copy of the maximum handles. It returns TRUE if successful.
Chapter 13. WebSphere MQ C++ classes
129
MQLONG maximumHandles( );
Returns the maximum handles without any indication of possible errors.
ImqBoolean maximumLu62Channels ( MQLONG & channels );
Provides a copy of the maximum LU62 channels value. It returns TRUE if
successful.
MQLONG maximumLu62Channels ( );.
Returns the maximum LU62 channels value without any indication of
possible errors
ImqBoolean maximumMessageLength( MQLONG & length );
Provides a copy of the maximum message length. It returns TRUE if
successful.
MQLONG maximumMessageLength( );
Returns the maximum message length without any indication of possible
errors.
ImqBoolean maximumPriority( MQLONG & priority );
Provides a copy of the maximum priority. It returns TRUE if successful.
MQLONG maximumPriority( );
Returns a copy of the maximum priority, without any indication of
possible errors.
ImqBoolean maximumTcpChannels ( MQLONG & channels );
Provides a copy of the maximum TCP channels value. It returns TRUE if
successful.
MQLONG maximumTcpChannels ( );
Returns the maximum TCP channels value without any indication of
possible errors.
ImqBoolean maximumUncommittedMessages( MQLONG & number );
Provides a copy of the maximum uncommitted messages. It returns TRUE
if successful.
MQLONG maximumUncommittedMessages( );
Returns the maximum uncommitted messages without any indication of
possible errors.
ImqBoolean mqiAccounting ( MQLONG & statint );
Provides a copy of the MQI accounting value. It returns TRUE if
successful.
MQLONG mqiAccounting ( );
Returns the MQI accounting value without any indication of possible
errors.
ImqBoolean mqiStatistics ( MQLONG & statmqi );
Provides a copy of the MQI statistics value. It returns TRUE if successful.
MQLONG mqiStatistics ( );
Returns the MQI statistics value without any indication of possible errors.
ImqBoolean outboundPortMax ( MQLONG & max );
Provides a copy of the maximum outbound port value. It returns TRUE if
successful.
MQLONG outboundPortMax ( );
Returns the maximum outbound port value without any indication of
possible errors.
130
131
MQLONG receiveTimeoutMin ( );
Returns the minimum receive timeout value without any indication of
possible errors.
ImqBoolean receiveTimeoutType ( MQLONG & type );
Provides a copy of the receive timeout type. It returns TRUE if successful.
MQLONG receiveTimeoutType ( );
Returns the receive timeout type without any indication of possible errors.
ImqBoolean remoteEvent( MQLONG & event );
Provides a copy of the enablement state of the remote event. It returns
TRUE if successful.
MQLONG remoteEvent( );
Returns the enablement state of the remote event without any indication of
possible errors.
ImqBoolean repositoryName( ImqString & name );
Provides a copy of the repository name. It returns TRUE if successful.
ImqString repositoryName( );
Returns the repository name without any indication of possible errors.
ImqBoolean repositoryNamelistName( ImqString & name );
Provides a copy of the repository namelist name. It returns TRUE if
successful.
ImqString repositoryNamelistName( );
Returns a copy of the repository namelist name without any indication of
possible errors.
ImqBoolean sharedQueueQueueManagerName ( MQLONG & name );
Provides a copy of the shared queue queue manager name value. It returns
TRUE if successful.
MQLONG sharedQueueQueueManagerName ( );
Returns the shared queue queue manager name value without any
indication of possible errors.
ImqBoolean sslEvent ( MQLONG & event );
Provides a copy of the SSL event value. It returns TRUE if successful.
MQLONG sslEvent ( );
Returns the SSL event value without any indication of possible errors.
ImqBoolean sslFips ( MQLONG & sslfips );
Provides a copy of the SSL FIPS value. It returns TRUE if successful.
MQLONG sslFips ( );
Returns the SSL FIPS value without any indication of possible errors.
ImqBoolean sslKeyResetCount ( MQLONG & count );
Provides a copy of the SSL key reset count value. It returns TRUE if
successful.
MQLONG sslKeyResetCount ( );
Returns the SSL key reset count value without any indication of possible
errors.
ImqBoolean startStopEvent( MQLONG & event );
Provides a copy of the enablement state of the start-stop event. It returns
TRUE if successful.
132
MQLONG startStopEvent( );
Returns the enablement state of the start-stop event without any indication
of possible errors.
ImqBoolean statisticsInterval ( MQLONG & statint );
Provides a copy of the statistics interval value. It returns TRUE if
successful.
MQLONG statisticsInterval ( );
Returns the statistics interval value without any indication of possible
errors.
ImqBoolean syncPointAvailability( MQLONG & sync );
Provides a copy of the syncpoint availability value. It returns TRUE if
successful.
MQLONG syncPointAvailability( );
Returns a copy of the syncpoint availability value, without any indication
of possible errors.
ImqBoolean tcpName ( ImqString & name );
Provides a copy of the TCP system name. It returns TRUE if successful.
ImqString tcpName ( );
Returns the TCP system name without any indication of possible errors.
ImqBoolean tcpStackType ( MQLONG & type );
Provides a copy of the TCP stack type. It returns TRUE if successful.
MQLONG tcpStackType ( );
Returns the TCP stack type without any indication of possible errors.
ImqBoolean traceRouteRecording ( MQLONG & routerec );
Provides a copy of the trace route recording value. It returns TRUE if
successful.
MQLONG traceRouteRecording ( );
Returns the trace route recording value without any indication of possible
errors.
ImqBoolean triggerInterval( MQLONG & interval );
Provides a copy of the trigger interval. It returns TRUE if successful.
MQLONG triggerInterval( );
Returns the trigger interval without any indication of possible errors.
ImqBinary userId ( ) const;
Returns the user ID used on client connections.
ImqBoolean setUserId ( const ImqString & id );
Sets the user ID used on client connections.
ImqBoolean setUserId ( const char * = 0 id );
Sets the user ID used on client connections.
ImqBoolean setUserId ( const ImqBinary & id );
Sets the user ID used on client connections.
133
Reason codes
134
v
v
v
v
v
v
MQRC_ATTRIBUTE_LOCKED
MQRC_ENVIRONMENT_ERROR
MQRC_FUNCTION_NOT_SUPPORTED
MQRC_REFERENCE_ERROR
(reason codes for MQBACK)
(reason codes for MQBEGIN)
v
v
v
v
(reason
(reason
(reason
(reason
codes
codes
codes
codes
for
for
for
for
MQCMIT)
MQCONNX)
MQDISC)
MQCONN)
ImqReferenceHeader
Header
A
Reference
Header
This class encapsulates features of the MQRMH data structure. It relates to the
MQI calls listed in Table 24 on page 173.
Object attributes
destination environment
Environment for the destination. The initial value is a null string.
destination name
Name of the data destination. The initial value is a null string.
instance id
Instance identifier. A binary value (MQBYTE24) of length
MQ_OBJECT_INSTANCE_ID_LENGTH. The initial value is
MQOII_NONE.
logical length
Logical, or intended, length of message data that follows this header. The
initial value is zero.
logical offset
Logical offset for the message data that follows, to be interpreted in the
context of the data as a whole, at the ultimate destination. The initial value
is zero.
logical offset 2
High-order extension to the logical offset. The initial value is zero.
reference type
Reference type. The initial value is a null string.
Chapter 13. WebSphere MQ C++ classes
135
source environment
Environment for the source. The initial value is a null string.
source name
Name of the data source. The initial value is a null string.
Constructors
ImqReferenceHeader( );
The default constructor.
ImqReferenceHeader( const ImqReferenceHeader & header );
The copy constructor.
136
Reason codes
v MQRC_BINARY_DATA_LENGTH_ERROR
v MQRC_STRUC_LENGTH_ERROR
v
v
v
v
MQRC_STRUC_ID_ERROR
MQRC_INSUFFICIENT_DATA
MQRC_INCONSISTENT_FORMAT
MQRC_ENCODING_ERROR
137
ImqString
Item
A
String
This class provides character string storage and manipulation for null-terminated
strings. Use an ImqString in place of a char * in most situations where a parameter
calls for a char *.
Object attributes
characters
Characters in the storage that precede a trailing null.
length Number of bytes in the characters. If there is no storage, the length is zero.
The initial value is zero.
storage
A volatile array of bytes of arbitrary size. A trailing null must always be
present in the storage after the characters, so that the end of the characters
can be detected. Methods ensure that this situation is maintained, but
ensure, when setting bytes in the array directly, that a trailing null exists
after modification. Initially, there is no storage attribute.
Constructors
ImqString( );
The default constructor.
ImqString( const ImqString & string );
The copy constructor.
ImqString( const char c );
The characters comprise c.
ImqString( const char * text );
The characters are copied from text.
138
139
140
+55 ;
141
// strDrive becomes C.
// strFile becomes OS2, then BITMAP,
// then OS2LOGO.BMP leaving strPath empty.
142
Reason codes
v
v
v
v
v
MQRC_DATA_TRUNCATED
MQRC_NULL_POINTER
MQRC_STORAGE_NOT_AVAILABLE
MQRC_BUFFER_ERROR
MQRC_INCONSISTENT_FORMAT
143
ImqTrigger
Item
A
Trigger
This class encapsulates the MQTM data structure (see Table 25 on page 173).
Objects of this class are typically used by a trigger monitor program, whose task is
to wait for these particular messages and act on them to ensure that other
WebSphere MQ applications are started when messages are waiting for them.
See the IMQSTRG sample program for a usage example.
Object attributes
application id
Identity of the application that sent the message. The initial value is a null
string.
application type
Type of application that sent the message. The initial value is zero. The
following additional values are possible:
v MQAT_AIX
v MQAT_CICS
v MQAT_DOS
v
v
v
v
v
v
v
144
MQAT_IMS
MQAT_MVS
MQAT_NOTES_AGENT
MQAT_OS2
MQAT_OS390
MQAT_OS400
MQAT_UNIX
v
v
v
v
MQAT_WINDOWS
MQAT_WINDOWS_NT
MQAT_USER_FIRST
MQAT_USER_LAST
environment data
Environment data for the process. The initial value is a null string.
process name
Process name. The initial value is a null string.
queue name
Name of the queue to be started. The initial value is a null string.
trigger data
Trigger data for the process. The initial value is a null string.
user data
User data for the process. The initial value is a null string.
Constructors
ImqTrigger( );
The default constructor.
ImqTrigger( const ImqTrigger & trigger );
The copy constructor.
145
Reason codes
v MQRC_NULL_POINTER
v MQRC_INCONSISTENT_FORMAT
v MQRC_ENCODING_ERROR
v MQRC_STRUC_ID_ERROR
146
ImqWorkHeader
Header
A
Work
Header
This class encapsulates specific features of the MQWIH data structure (see Table 26
on page 174). 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.
147
Reason codes
v MQRC_BINARY_DATA_LENGTH_ERROR
148
AIX
If you are using the IBM VisualAge C++ Professional compiler, use one of the
following commands, as appropriate:
Client applications
32-bit unthreaded application
xlC -o imqsputc_32 imqsput.cpp -qchars=signed -I/usr/mqm/inc
-L/usr/mqm/lib -limqc23ia -limqb23ia -lmqic
Server applications
32-bit unthreaded application
xlC -o imqsput_32 imqsput.cpp -qchars=signed -I/usr/mqm/inc
-L/usr/mqm/lib -limqs23ia -limqb23ia -lmqm
149
HP-UX
The HP ANSI C++ compiler supports two distinct runtime environments for C++
applications, the Classic C++ runtime and the Standard C++ runtime.
On HP-UX (PA-RISC) MQ supports both the Classic and Standard runtimes.
v libimqi23ah.sl provides the WMQ C++ classes for the Classic runtime.
v libimqi23bh.sl provides the WMQ C++ classes for the Standard runtime.
On HP-UX Itanium MQ supports only the Standard runtime.
v libimqi23bh.sl provides the WMQ C++ classes for the Standard runtime.
v For compatability with earlier releases, a symlink is provided for libimqi23ah.sl
to libimqi23bh.sl.
Use the following lines for which system you are using:
Server applications
32-bit unthreaded application
aCC -Wl,+b,: -D_HPUX_SOURCE -o imqsput_32 imqsput.cpp -I/opt/mqm/inc
-L/opt/mqm/lib -L/usr/lib -limqi23ah -lmqm
150
Server applications
32-bit unthreaded application
aCC -Wl,+b,: -D_HPUX_SOURCE -o imqsput_32 imqsput.cpp -I/opt/mqm/inc
-L/opt/mqm/lib -L/usr/lib -limqi23bh -lmqm
151
Server applications
32-bit unthreaded application
aCC -Wl,+b,: +e -D_HPUX_SOURCE -o imqsput_32 imqsput.cpp -I/opt/mqm/inc
-L/opt/mqm/lib -L/usr/lib/hpux32 -limqi23bh -lmqm
i5/OS
If you are using the IBM ILE C++ for i5/OS compiler, use the following switches
and libraries:
Switches
DFTCHAR*(SIGNED)
Libraries
BNDSRVPGM(QMQM/IMQB23I4[_R] QMQM/IMQS23I4[_R])
Note: To build a threaded application you need to link with the libraries ending in
_R.
Linux
If you are using the GNU g++ compiler, use one of the following commands, as
appropriate:
POWER platform
Client applications
32-bit unthreaded application
g++ -m32 -o imqsputc_32 imqsput.cpp -fsigned-char -I/opt/mqm/inc
-L/opt/mqm/lib -Wl,-rpath=/opt/mqm/lib -Wl,-rpath=/usr/lib -limqc23gl
-limqb23gl -lmqic
152
Server applications
32-bit unthreaded application
g++ -m32 -o imqsput_32 imqsput.cpp -fsigned-char -I/opt/mqm/inc
-L/opt/mqm/lib -Wl,-rpath=/opt/mqm/lib -Wl,-rpath=/usr/lib -limqs23gl
-limqb23gl -lmqm
Server applications
32-bit unthreaded application
g++ -m31 -fsigned-char -o imqsput_32 imqsput.cpp -I/opt/mqm/inc
-L/opt/mqm/lib -Wl,-rpath=/opt/mqm/lib -Wl,-rpath=/usr/lib
-limqs23gl -limqb23gl -lmqm
153
x86 platform
Client applications
32-bit unthreaded application
g++ -m32 -fsigned-char -o imqsputc_32 imqsput.cpp -I/opt/mqm/inc
-L/opt/mqm/lib -Wl, -rpath=/opt/mqm/lib -L/opt/mqm/lib -Wl,
-rpath=/opt/mqm/lib -Wl,-rpath=/usr/lib -limqc23gl -limqb23gl -lmqic
Server applications
32-bit unthreaded application
g++ -m32 -fsigned-char -o imqsput_32 imqsput.cpp -I/opt/mqm/inc
-L/opt/mqm/lib -Wl,-rpath=/opt/mqm/lib -L/opt/mqm/lib
-Wl,-rpath=/opt/mqm/lib -Wl,-rpath=/usr/lib -limqs23gl -limqb23gl -lmqm
Solaris
If you are using the Sun ONE Studio compiler, use one of the following
commands, as appropriate:
154
SPARC platform
Client applications
32-bit application
CC -xarch=v8plus -mt -o imqsputc_32 imqsput.cpp -I/opt/mqm/inc
-L/opt/mqm/lib -R/opt/mqm/lib -R/usr/lib/32 -limqc23as -limqb23as
-lmqic -lmqmcs -lmqmzse -lsocket -lnsl -ldl
64-bit application
CC -xarch=v9 -mt -o imqsputc_64 imqsput.cpp -I/opt/mqm/inc
-L/opt/mqm/lib64 -R/opt/mqm/lib64 -R/usr/lib/64 -limqc23as -limqb23as
-lmqic -lmqmcs -lmqmzse -lsocket -lnsl -ldl
Server applications
32-bit application
CC -xarch=v8plus -mt -o imqsput_32 imqsput.cpp -I/opt/mqm/inc
-L/opt/mqm/lib -R/opt/mqm/lib -R/usr/lib/32 -limqs23as -limqb23as
-lmqm -lmqmcs -lmqmzse -lsocket -lnsl -ldl
64-bit application
CC -xarch=v9 -mt -o imqsput_64 imqsput.cpp -I/opt/mqm/inc
-L/opt/mqm/lib64 -R/opt/mqm/lib64 -R/usr/lib/64 -limqs23as -limqb23as
-lmqm -lmqmcs -lmqmzse -lsocket -lnsl -ldl
x86 platform
Client applications
32-bit application
CC -xarch=386 -mt -o imqsputc_32 imqsput.cpp -I/opt/mqm/inc
-L/opt/mqm/lib -R/opt/mqm/lib -R/usr/lib/32 -limqc23as -limqb23as
-lmqic -lmqmcs -lmqmzse -lsocket -lnsl -ldl
64-bit application
CC -xarch=amd64 -mt -o imqsputc_64 imqsput.cpp -I/opt/mqm/inc
-L/opt/mqm/lib64 -R/opt/mqm/lib64 -R/usr/lib/64 -limqc23as -limqb23as
-lmqic -lmqmcs -lmqmzse -lsocket -lnsl -ldl
Server applications
32-bit application
CC -xarch=386 -mt -o imqsput_32 imqsput.cpp -I/opt/mqm/inc
-L/opt/mqm/lib -R/opt/mqm/lib -R/usr/lib/32 -limqs23as -limqb23as
-lmqm -lmqmcs -lmqmzse -lsocket -lnsl -ldl
64-bit application
CC -xarch=amd64 -mt -o imqsput_64 imqsput.cpp -I/opt/mqm/inc
-L/opt/mqm/lib64 -R/opt/mqm/lib64 -R/usr/lib/64 -limqs23as -limqb23as
-lmqm -lmqmcs -lmqmzse -lsocket -lnsl -ldl
Windows Systems
If you are using the Microsoft Visual C++ .NET compiler, use one of the following
commands, as appropriate:
v Client applications
cl -MD imqsput.cpp /Feimqsputc.exe imqb23vn.lib imqc23vn.lib
v Server applications
cl -MD imqsput.cpp /Feimqsput.exe imqb23vn.lib imqs23vn.lib
Chapter 14. Compiling and linking
155
Library (.lib) files and dll files for use with 32-bit applications are installed in
install_location/Tools/Lib, files for use with 64-bit applications are installed in
install_location/Tools/Lib64.
z/OS
Use the following switches and libraries:
Switches
/cxx
Libraries
The side-decks are:
imqs23dm imqb23dm, or imqs23dr imqb23dr, or imqs23dc imqb23dc
See i5/OS on page 152 for alternative service programs that you can use.
c. Execute the HELLO WORLD sample program, using
SYSTEM.DEFAULT.LOCAL.QUEUE:
CALL PGM(MYLIB/IMQWRLD)
156
157
HELLO WORLD
imqwrld
imqwrldr
SPUT
imqsput
imqsputr
SGET
imqsget
imqsgetr
To run the samples, compile and link-edit them as with any C++ program (see
Building an application on z/OS on page 157). Use the supplied JCL to construct
and run a batch job. You must initially customize the JCL, by following the
commentary included with it.
4. Compile and link the sample program. The following command links the
program with the batch side-decks; the RRS batch side-decks can be used
instead. The \ character is used to split the command over more than one line.
Do not enter this character; enter the command as a single line:
/u/fred/sample:> c++ -o imqwrld -I "//thlqual.SCSQC370" \
-I "//thlqual.SCSQHPPS" imqwrld.cpp \
"//thlqual.SCSQDEFS(IMQS23DM)" "//thlqual.SCSQDEFS(IMQB23DM)"
For more information on the TSO oput command, refer to the z/OS UNIX System
Services Command Reference.
158
You can also use the make utility to simplify building C++ programs. Here is a
sample makefile to build the HELLO WORLD C++ sample program. It separates
the compile and link stages. Set up the environment as in step 3 on page 158 above
before running make.
flags = -I "//thlqual.SCSQC370" -I "//thlqual.SCSQHPPS"
decks = "//thlqual.SCSQDEFS(IMQS23DM)" "//thlqual.SCSQDEFS(IMQB23DM)"
imqwrld: imqwrld.o
c++ -o imqwrld imqwrld.o $(decks)
imqwrld.o: imqwrld.cpp
c++ -c -o imqwrld $(flags) imqwrld.cpp
Refer to z/OS UNIX System Services Programming Tools for more information on
using make.
159
160
Class
Include file
MQAIR
ImqAuthenticationRecord
imqair.hpp
ImqBinary
imqbin.hpp
ImqCache
imqcac.hpp
MQCD
ImqChannel
imqchl.hpp
MQCIH
ImqCICSBridgeHeader
imqcih.hpp
MQDLH
ImqDeadLetterHeader
imqdlh.hpp
MQOR
ImqDistributionList
imqdst.hpp
ImqError
imqerr.hpp
ImqGetMessageOptions
imqgmo.hpp
ImqHeader
imqhdr.hpp
ImqIMSBridgeHeader
imqiih.hpp
ImqItem
imqitm.hpp
ImqMessage
imqmsg.hpp
ImqMessageTracker
imqmtr.hpp
ImqNamelist
imqnml.hpp
MQOD, MQRR
ImqObject
imqobj.hpp
ImqPutMessageOptions
imqpmo.hpp
ImqProcess
imqpro.hpp
ImqQueue
imqque.hpp
ImqQueueManager
imqmgr.hpp
MQRMH
ImqReferenceHeader
imqrfh.hpp
ImqString
imqstr.hpp
ImqTrigger
imqtrg.hpp
ImqTrigger
imqtrg.hpp
ImqWorkHeader
imqwih.hpp
MQGMO
MQIIH
MQMD
MQTM
MQTMC
MQTMC2
MQXQH
MQWIH
161
ImqAuthenticationRecord
Table 6. ImqAuthenticationRecord cross reference
Attribute
Data structure
Field
Call
connection name
MQAIR
AuthInfoConnName
MQCONNX
password
MQAIR
LDAPPassword
MQCONNX
type
MQAIR
AuthInfoType
MQCONNX
user name
MQAIR
LDAPUserNamePtr
MQCONNX
MQAIR
LDAPUserNameOffset
MQCONNX
MQAIR
LDAPUserNameLength
MQCONNX
ImqCache
Table 7. ImqCache cross reference
Attribute
Call
automatic buffer
MQGET
buffer length
MQGET
buffer pointer
MQGET, MQPUT
data length
MQGET
data offset
MQGET
data pointer
MQGET
message length
MQGET, MQPUT
ImqChannel
Table 8. ImqChannel cross reference
Attribute
Data structure
Field
Call
batch heart-beat
MQCD
BatchHeartbeat
MQCONNX
channel name
MQCD
ChannelName
MQCONNX
connection name
MQCD
ConnectionName
MQCONNX
MQCD
ShortConnectionName
MQCONNX
header compression
MQCD
HdrCompList
MQCONNX
heart-beat interval
MQCD
HeartbeatInterval
MQCONNX
MQCD
KeepAliveInterval
MQCONNX
local address
MQCD
LocalAddress
MQCONNX
MQCD
MaxMsgLength
MQCONNX
message compression
MQCD
MsgCompList
MQCONNX
162
Data structure
Field
Call
mode name
MQCD
ModeName
MQCONNX
password
MQCD
Password
MQCONNX
MQCD
MQCD
ReceiveExit
MQCONNX
MQCD
ReceiveExitsDefined
MQCONNX
MQCD
ReceiveExitPtr
MQCONNX
MQCD
ReceiveUserData
MQCONNX
MQCD
ReceiveUserDataPtr
MQCONNX
MQCD
SecurityExit
MQCONNX
MQCD
SecurityUserData
MQCONNX
MQCD
MQCD
SendExit
MQCONNX
MQCD
SendExitsDefined
MQCONNX
MQCD
SendExitPtr
MQCONNX
MQCD
SendUserData
MQCONNX
MQCD
SendUserDataPtr
MQCONNX
SSL CipherSpec
MQCD
sslCipherSpecification
MQCONNX
MQCD
sslClientAuthentication
MQCONNX
MQCD
sslPeerName
MQCONNX
MQCD
TpName
MQCONNX
transport type
MQCD
TransportType
MQCONNX
user id
MQCD
UserIdentifier
MQCONNX
MQCONNX
MQCONNX
ImqCICSBridgeHeader
Table 9. ImqCICSBridgeHeader cross reference
Attribute
Data structure
Field
MQCIH
AbendCode
ADS descriptor
MQCIH
AdsDescriptor
attention identifier
MQCIH
AttentionId
authenticator
MQCIH
Authenticator
MQCIH
BridgeCompletionCode
MQCIH
ErrorOffset
MQCIH
BridgeReason
MQCIH
CancelCode
conversational task
MQCIH
ConversationalTask
cursor position
MQCIH
CursorPosition
facility token
MQCIH
Facility
MQCIH
FacilityKeepTime
facility like
MQCIH
FacilityLike
163
Data structure
Field
function
MQCIH
Function
MQCIH
GetWaitInterval
link type
MQCIH
LinkType
MQCIH
NextTransactionId
MQCIH
OutputDataLength
reply-to format
MQCIH
ReplyToFormat
MQCIH
ReturnCode
start code
MQCIH
StartCode
MQCIH
TaskEndStatus
transaction identifier
MQCIH
TransactionId
uow control
MQCIH
UowControl
version
MQCIH
Version
ImqDeadLetterHeader
Table 10. ImqDeadLetterHeader cross reference
Attribute
Data structure
Field
MQDLH
Reason
MQDLH
DestQMgrName
MQDLH
DestQName
MQDLH
PutApplName
MQDLH
PutApplType
put date
MQDLH
PutDate
put time
MQDLH
PutTime
ImqError
Table 11. ImqError cross reference
Attribute
Call
completion code
reason code
ImqGetMessageOptions
Table 12. ImqGetMessageOptions cross reference
Attribute
Data structure
Field
group status
MQGMO
GroupStatus
match options
MQGMO
MatchOptions
message token
MQGMO
MessageToken
options
MQGMO
Options
164
Data structure
Field
MQGMO
ResolvedQName
returned length
MQGMO
ReturnedLength
segmentation
MQGMO
Segmentation
segment status
MQGMO
SegmentStatus
MQGMO
Signal1
MQGMO
Signal2
syncpoint participation
MQGMO
Options
wait interval
MQGMO
WaitInterval
Attribute
Data structure
Field
character set
MQDLH, MQIIH
CodedCharSetId
encoding
MQDLH, MQIIH
Encoding
format
MQDLH, MQIIH
Format
header flags
MQIIH, MQRMH
Flags
ImqHeader
Table 13. ImqHeader cross reference
ImqIMSBridgeHeader
Table 14. ImqIMSBridgeHeader cross reference
Attribute
Data structure
Field
authenticator
MQIIH
Authenticator
commit mode
MQIIH
CommitMode
MQIIH
LTermOverride
MQIIH
MFSMapName
reply-to format
MQIIH
ReplyToFormat
security scope
MQIIH
SecurityScope
transaction instance id
MQIIH
TranInstanceId
transaction state
MQIIH
TranState
ImqItem
Table 15. ImqItem cross reference
Attribute
Call
structure id
MQGET
165
ImqMessage
Table 16. ImqMessage cross reference
Attribute
Data structure
Field
application id data
MQMD
ApplIdentityData
MQMD
ApplOriginData
backout count
MQMD
BackoutCount
character set
MQMD
CodedCharSetId
encoding
MQMD
Encoding
expiry
MQMD
Expiry
format
MQMD
Format
message flags
MQMD
MsgFlags
message type
MQMD
MsgType
offset
MQMD
Offset
original length
MQMD
OriginalLength
persistence
MQMD
Persistence
priority
MQMD
Priority
MQMD
PutApplName
MQMD
PutApplType
put date
MQMD
PutDate
put time
MQMD
PutTime
MQMD
ReplyToQMgr
MQMD
ReplyToQ
report
MQMD
Report
sequence number
MQMD
MsgSeqNumber
Call
DataLength
MQMD
MQGET
UserIdentifier
ImqMessageTracker
Table 17. ImqMessageTracker cross reference
Attribute
Data structure
Field
accounting token
MQMD
AccountingToken
correlation id
MQMD
CorrelId
feedback
MQMD
Feedback
group id
MQMD
GroupId
message id
MQMD
MsgId
ImqNamelist
Table 18. ImqNamelist cross reference
Attribute
Inquiry
Call
name count
MQIA_NAME_COUNT
MQINQ
166
Inquiry
Call
namelist name
MQCA_NAMELIST_NAME
MQINQ
ImqObject
Table 19. ImqObject cross reference
Attribute
Data
structure
Inquiry
Call
alteration date
MQCA_ALTERATION_DATE
MQINQ
alteration time
MQCA_ALTERATION_TIME
MQINQ
alternate user id
MQOD
Field
AlternateUserId
alternate security id
close options
MQCLOSE
description
name
MQOD
ObjectName
MQCA_Q_DESC,
MQCA_Q_MGR_DESC,
MQCA_PROCESS_DESC
MQINQ
MQCA_Q_MGR_NAME,
MQCQ_Q_NAME,
MQCA_PROCESS_NAME
MQINQ
open options
MQOPEN
open status
MQOPEN,
MQCLOSE
queue manager
identifier
queue
manager
identifier
MQCA_Q_MGR_IDENTIFIER
MQINQ
ImqProcess
Table 20. ImqProcess cross reference
Attribute
Inquiry
Call
application id
MQCA_APPL_ID
MQINQ
application type
MQIA_APPL_TYPE
MQINQ
environment data
MQCA_ENV_DATA
MQINQ
user data
MQCA_USER_DATA
MQINQ
ImqPutMessageOptions
Table 21. ImqPutMessageOptions cross reference
Attribute
Data structure
Field
context reference
MQPMO
Context
MQPMO
InvalidDestCount
MQPMO
KnownDestCount
options
MQPMO
Options
record fields
MQPMO
PutMsgRecFields
167
Data structure
Field
MQPMO
ResolvedQMgrName
MQPMO
ResolvedQName
MQPMO
Timeout
MQPMO
UnknownDestCount
MQPMO
Options
syncpoint participation
ImqQueue
Table 22. ImqQueue cross reference
Attribute
Inquiry
Call
MQCA_BACKOUT_REQ_Q_NAME
MQINQ
backout threshold
MQIA_BACKOUT_THRESHOLD
MQINQ
MQCA_BASE_Q_NAME
MQINQ
cluster name
MQCA_CLUSTER_NAME
MQINQ
MQCA_CLUSTER_NAMELIST
MQINQ
MQIA_CLWL_Q_RANK
MQINQ
cluster workload
priority
MQIA_CLWL_Q_PRIORITY
MQINQ
MQIA_CLWL_USEQ
MQINQ
creation date
MQCA_CREATION_DATE
MQINQ
creation time
MQCA_CREATION_TIME
MQINQ
current depth
MQIA_CURRENT_Q_DEPTH
MQINQ
default bind
MQIA_DEF_BIND
MQINQ
MQIA_DEF_INPUT_OPEN_OPTION
MQINQ
default persistence
MQIA_DEF_PERSISTENCE
MQINQ
default priority
MQIA_DEF_PRIORITY
MQINQ
definition type
MQIA_DEFINITION_TYPE
MQINQ
MQIA_Q_DEPTH_HIGH_EVENT
MQINQ
MQIA_Q_DEPTH_HIGH_LIMIT
MQINQ
MQIA_Q_DEPTH_LOW_EVENT
MQINQ
MQIA_Q_DEPTH_LOW_LIMIT
MQINQ
MQIA_Q_DEPTH_MAX_LIMIT
MQINQ
distribution lists
MQIA_DIST_LISTS
MQINQ,
MQSET
MQIA_HARDEN_GET_BACKOUT
MQINQ
index type
MQIA_INDEX_TYPE
MQINQ
inhibit get
MQIA_INHIBIT_GET
MQINQ,
MQSET
168
Data
structure
MQOD
Field
DynamicQName
Data
structure
Field
Inquiry
Call
inhibit put
MQIA_INHIBIT_PUT
MQINQ,
MQSET
MQCA_INITIATION_Q_NAME
MQINQ
maximum depth
MQIA_MAX_Q_DEPTH
MQINQ
maximum message
length
MQIA_MAX_MSG_LENGTH
MQINQ
message delivery
sequence
MQIA_MSG_DELIVERY_SEQUENCE
MQINQ
MQIA_NPM_CLASS
MQINQ
MQIA_OPEN_INPUT_COUNT
MQINQ
MQIA_OPEN_OUTPUT_COUNT
MQINQ
process name
MQCA_PROCESS_NAME
MQINQ
queue accounting
MQIA_ACCOUNTING_Q
MQINQ
queue monitoring
MQIA_MONITORING_Q
MQINQ
queue statistics
MQIA_STATISTICS_Q
MQINQ
queue type
MQIA_Q_TYPE
MQINQ
MQCA_REMOTE_Q_MGR_NAME
MQINQ
MQCA_REMOTE_Q_NAME
MQINQ
retention interval
MQIA_RETENTION_INTERVAL
MQINQ
scope
MQIA_SCOPE
MQINQ
service interval
MQIA_Q_SERVICE_INTERVAL
MQINQ
MQIA_Q_SERVICE_INTERVAL_EVENT MQINQ
shareability
MQIA_SHAREABILITY
MQINQ
storage class
MQCA_STORAGE_CLASS
MQINQ
transmission queue
name
MQCA_XMIT_Q_NAME
MQINQ
trigger control
MQIA_TRIGGER_CONTROL
MQINQ,
MQSET
trigger data
MQCA_TRIGGER_DATA
MQINQ,
MQSET
trigger depth
MQIA_TRIGGER_DEPTH
MQINQ,
MQSET
trigger message
priority
MQIA_TRIGGER_MSG_PRIORITY
MQINQ,
MQSET
previous distributed
queue
MQOD
ObjectQMgrName
resolved queue
manager name
MQOD
ResolvedQMgrName
MQOD
ResolvedQName
169
Data
structure
Field
Inquiry
Call
trigger type
MQIA_TRIGGER_TYPE
MQINQ,
MQSET
usage
MQIA_USAGE
MQINQ
ImqQueueManager
Table 23. ImqQueueManager cross reference
Attribute
Inquiry
Call
accounting
connections override
MQIA_ACCOUNTING_CONN_OVERRIDE
MQINQ
accounting interval
MQIA_ACCOUNTING_INTERVAL
MQINQ
activity recording
MQIA_ACTIVITY_RECORDING
MQINQ
MQIA_ADOPTNEWMCA_CHECK
MQINQ
MQIA_ADOPTNEWMCA_TYPE
MQINQ
authentication type
Data
structure
MQCSP
Field
AuthenticationType
authority event
begin options
MQCONNX
MQIA_AUTHORITY_EVENT
MQBO
Options
MQINQ
MQBEGIN
bridge event
MQIA_BRIDGE_EVENT
MQINQ
channel auto
definition
MQIA_CHANNEL_AUTO_DEF
MQINQ
channel auto
definition event
MQIA_CHANNEL_AUTO_EVENT
MQIA
channel auto
definition exit
MQIA_CHANNEL_AUTO_EXIT
MQIA
channel event
MQIA_CHANNEL_EVENT
MQINQ
channel initiator
adapters
MQIA_CHINIT_ADAPTERS
MQINQ
channel initiator
control
MQIA_CHINIT_CONTROL
MQINQ
channel initiator
dispatchers
MQIA_CHINIT_DISPATCHERS
MQINQ
channel initiator
trace auto start
MQIA_CHINIT_TRACE_AUTO_START
MQINQ
channel initiator
trace table size
MQIA_CHINIT_TRACE_TABLE_SIZE
MQINQ
channel monitoring
MQIA_MONITORING_CHANNEL
MQINQ
channel reference
MQCD
ChannelType
MQCONNX
channel statistics
MQIA_STATISTICS_CHANNEL
MQINQ
character set
MQIA_CODED_CHAR_SET_ID
MQINQ
cluster sender
monitoring
MQIA_MONITORING_AUTO_CLUSSDR
MQINQ
170
Data
structure
Field
Inquiry
Call
cluster sender
statistics
MQIA_STATISTICS_AUTO_CLUSSDR
MQINQ
cluster workload
data
MQCA_CLUSTER_WORKLOAD_DATA
MQINQ
cluster workload
exit
MQCA_CLUSTER_WORKLOAD_EXIT
MQINQ
cluster workload
length
MQIA_CLUSTER_WORKLOAD_LENGTH
MQINQ
cluster workload
mru
MQIA_CLWL_MRU_CHANNELS
MQINQ
cluster workload
use queue
MQIA_CLWL_USEQ
MQINQ
command event
MQIA_COMMAND_EVENT
MQINQ
command input
queue name
MQCA_COMMAND_INPUT_Q_NAME
MQINQ
command level
MQIA_COMMAND_LEVEL
MQINQ
command server
control
MQIA_CMD_SERVER_CONTROL
MQINQ
connect options
MQCNO
Options
MQCONN,
MQCONNX
connection id
MQCNO
ConnectionId
MQCONNX
connection status
MQCONN,
MQCONNX,
MQDISC
connection tag
MQCD
ConnTag
MQCONNX
cryptographic
hardware
MQSCO
CryptoHardware
MQCONNX
dead-letter queue
name
MQCA_DEAD_LETTER_Q_NAME
MQINQ
default transmission
queue name
MQCA_DEF_XMIT_Q_NAME
MQINQ
distribution lists
MQIA_DIST_LISTS
MQINQ
dns group
MQCA_DNS_GROUP
MQINQ
dns wlm
MQIA_DNS_WLM
MQINQ
first authentication
record
MQSCO
AuthInfoRecOffset
MQCONNX
MQSCO
AuthInfoRecPtr
MQCONNX
inhibit event
MQIA_INHIBIT_EVENT
MQINQ
ip address version
MQIA_IP_ADDRESS_VERSION
MQINQ
key repository
MQSCO
KeyRepository
MQCONNX
MQSCO
KeyResetCount
MQCONNX
listener timer
MQIA_LISTENER_TIMER
MQINQ
local event
MQIA_LOCAL_EVENT
MQINQ
logger event
MQIA_LOGGER_EVENT
MQINQ
171
Inquiry
Call
lu group name
MQCA_LU_GROUP_NAME
MQINQ
lu name
MQCA_LU_NAME
MQINQ
MQCA_LU62_ARM_SUFFIX
MQINQ
lu62 channels
MQIA_LU62_CHANNELS
MQINQ
maximum active
channels
MQIA_ACTIVE_CHANNELS
MQINQ
maximum channels
MQIA_MAX_CHANNELS
MQINQ
maximum handles
MQIA_MAX_HANDLES
MQINQ
maximum message
length
MQIA_MAX_MSG_LENGTH
MQINQ
maximum priority
MQIA_MAX_PRIORITY
MQINQ
maximum
uncommitted
messages
MQIA_MAX_UNCOMMITTED_MSGS
MQINQ
mqi accounting
MQIA_ACCOUNTING_MQI
MQINQ
mqi statistics
MQIA_STATISTICS_MQI
MQINQ
outbound port
maximum
MQIA_OUTBOUND_PORT_MAX
MQINQ
outbound port
minimum
MQIA_OUTBOUND_PORT_MIN
MQINQ
password
Data
structure
Field
MQCSP
CSPPasswordPtr
MQCONNX
MQCSP
CSPPasswordOffset
MQCONNX
MQCSP
CSPPasswordLength
MQCONNX
performance event
MQIA_PERFORMANCE_EVENT
MQINQ
platform
MQIA_PLATFORM
MQINQ
queue accounting
MQIA_ACCOUNTING_Q
MQINQ
queue monitoring
MQIA_MONITORING_Q
MQINQ
queue statistics
MQIA_STATISTICS_Q
MQINQ
receive timeout
MQIA_RECEIVE_TIMEOUT
MQINQ
receive timeout
minimum
MQIA_RECEIVE_TIMEOUT_MIN
MQINQ
MQIA_RECEIVE_TIMEOUT_TYPE
MQINQ
remote event
MQIA_REMOTE_EVENT
MQINQ
repository name
MQCA_REPOSITORY_NAME
MQINQ
repository namelist
MQCA_REPOSITORY_NAMELIST
MQINQ
MQIA_SHARED_Q_Q_MGR_NAME
MQINQ
ssl event
MQIA_SSL_EVENT
MQINQ
ssl fips
MQIA_SSL_FIPS_REQUIRED
MQINQ
MQIA_SSL_RESET_COUNT
MQINQ
start-stop event
MQIA_START_STOP_EVENT
MQINQ
statistics interval
MQIA_STATISTICS_INTERVAL
MQINQ
172
Data
structure
Inquiry
Call
syncpoint
availability
MQIA_SYNCPOINT
MQINQ
tcp channels
MQIA_TCP_CHANNELS
MQINQ
MQIA_TCP_KEEP_ALIVE
MQINQ
tcp name
MQCA_TCP_NAME
MQINQ
MQIA_TCP_STACK_TYPE
MQINQ
trace route
recording
MQIA_TRACE_ROUTE_RECORDING
MQINQ
trigger interval
MQIA_TRIGGER_INTERVAL
MQINQ
user id
Field
MQCSP
CSPUserIdPtr
MQCONNX
MQCSP
CSPUserIdOffset
MQCONNX
MQCSP
CSPUserIdLength
MQCONNX
ImqReferenceHeader
Table 24. ImqReferenceHeader
Attribute
Data structure
Field
destination environment
MQRMH
DestEnvLength, DestEnvOffset
destination name
MQRMH
DestNameLength, DestNameOffset
instance id
MQRMH
ObjectInstanceId
logical length
MQRMH
DataLogicalLength
logical offset
MQRMH
DataLogicalOffset
logical offset 2
MQRMH
DataLogicalOffset2
reference type
MQRMH
ObjectType
source environment
MQRMH
SrcEnvLength, SrcEnvOffset
source name
MQRMH
SrcNameLength, SrcNameOffset
Attribute
Data structure
Field
application id
MQTM
ApplId
application type
MQTM
ApplType
environment data
MQTM
EnvData
process name
MQTM
ProcessName
queue name
MQTM
QName
trigger data
MQTM
TriggerData
user data
MQTM
UserData
ImqTrigger
Table 25. ImqTrigger cross reference
173
ImqWorkHeader
Table 26. ImqWorkHeader cross reference
Attribute
Data structure
Field
message token
MQWIH
MessageToken
service name
MQWIH
ServiceName
service step
MQWIH
ServiceStep
174
Notices
This information was developed for products and services offered in the United
States. IBM may not offer the products, services, or features discussed in this
information in other countries. Consult your local IBM representative for
information on the products and services currently available in your area. Any
reference to an IBM product, program, or service is not intended to state or imply
that only that IBM product, program, or service may be used. Any functionally
equivalent product, program, or service that does not infringe any IBM intellectual
property right may be used instead. However, it is the users responsibility to
evaluate and verify the operation of any non-IBM product, program, or service.
IBM may have patents or pending patent applications covering subject matter
described in this information. The furnishing of this information does not give you
any license to these patents. You can send license inquiries, in writing, to:
IBM Director of Licensing,
IBM Corporation,
North Castle Drive,
Armonk, NY 10504-1785,
U.S.A.
For license inquiries regarding double-byte (DBCS) information, contact the IBM
Intellectual Property Department in your country or send inquiries, in writing, to:
IBM World Trade Asia Corporation,
Licensing,
2-31 Roppongi 3-chome, Minato-k,u
Tokyo 106, Japan
The following paragraph does not apply to the United Kingdom or any other
country where such provisions are inconsistent with local law:
INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS
PUBLICATION AS IS WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS
FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express or
implied warranties in certain transactions, therefore this statement may not apply
to you.
This information could include technical inaccuracies or typographical errors.
Changes are periodically made to the information herein; these changes will be
incorporated in new editions of the information. IBM may make improvements
and/or changes in the product(s) and/or the program(s) described in this
information at any time without notice.
Any references in this information to non-IBM Web sites are provided for
convenience only and do not in any manner serve as an endorsement of those Web
sites. The materials at those Web sites are not part of the materials for this IBM
product and use of those Web sites is at your own risk.
IBM may use or distribute any of the information you supply in any way it
believes appropriate without incurring any obligation to you.
Copyright IBM Corp. 1997, 2008
175
Licensees of this program who wish to have information about it for the purpose
of enabling: (i) the exchange of information between independently created
programs and other programs (including this one) and (ii) the mutual use of the
information which has been exchanged, should contact:
IBM United Kingdom Laboratories,
Mail Point 151,
Hursley Park,
Winchester,
Hampshire,
England
SO21 2JN.
Such information may be available, subject to appropriate terms and conditions,
including in some cases, payment of a fee.
The licensed program described in this information and all licensed material
available for it are provided by IBM under terms of the IBM Customer Agreement,
IBM International Programming License Agreement, or any equivalent agreement
between us.
Information concerning non-IBM products was obtained from the suppliers of
those products, their published announcements or other publicly available sources.
IBM has not tested those products and cannot confirm the accuracy of
performance, compatibility or any other claims related to non-IBM products.
Questions on the capabilities of non-IBM products should be addressed to the
suppliers of those products.
COPYRIGHT LICENSE:
This information contains sample application programs in source language, which
illustrate programming techniques on various operating platforms. You may copy,
modify, and distribute these sample programs in any form without payment to
IBM, for the purposes of developing, using, marketing or distributing application
programs conforming to the application programming interface for the operating
platform for which the sample programs are written. These examples have not
been thoroughly tested under all conditions. IBM, therefore, cannot guarantee or
imply reliability, serviceability, or function of these programs. You may copy,
modify, and distribute these sample programs in any form without payment to
IBM for the purposes of developing, using, marketing, or distributing application
programs conforming to IBMs application programming interfaces.
The following are trademarks of International Business Machines Corporation in
the United States, or other countries, or both:
CICS
i5/OS
IBM
IMS
RACF
VisualAge
WebSphere
z/OS
Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the
United States, other countries, or both.
176
Microsoft, Windows, Windows NT, and the Windows logo are trademarks of
Microsoft Corporation in the United States, other countries, or both.
Linux is a trademark of Linus Torvalds in the United States, other countries, or
both.
UNIX is a registered trademark of The Open Group in the United States and other
countries.
Other company, product, or service names may be trademarks or service marks of
others.
Notices
177
178
Index
A
attributes of objects
31
B
binary strings 27, 32
Booch class diagrams 1
bufferPointer method 10
buffers, message 5
building applications
z/OS 157
z/OS UNIX System Services
158
C
C Set++ 156
C, using from C++ 33
C++ language considerations 31
character strings 27, 32
CICS bridge, writing a message to 15
classes
Booch class diagrams 1
ImqAuthenticationRecord 37
ImqBinary 40
ImqCache 42
ImqChannel 45
ImqCICSBridgeHeader 51
ImqDeadLetterHeader 58
ImqDistributionList 61
ImqError 63
ImqGetMessageOptions 65
ImqHeader 69
ImqIMSBridgeHeader 71
ImqItem 74
ImqMessage 76
ImqMessageTracker 84
ImqNamelist 88
ImqObject 90
ImqProcess 97
ImqPutMessageOptions 99
ImqQueue 102
ImqQueueManager 115
ImqReferenceHeader 135
ImqString 138
ImqTrigger 144
ImqWorkHeader 147
close, implicit operation 25
CMQC.H header file 31
compilers for WebSphere MQ platforms,
overview 149
compiling sample programs
i5/OS 156
z/OS 157
connect, implicit operation 25
connection, secondary 128
constants
MQCA_* 94
MQIA_* 94
MQIAV_UNDEFINED 94
constants (continued)
MQOO_*
BROWSE 108
INPUT_* 108
OUTPUT 111
PASS_ALL_CONTEXT 111
PASS_IDENTITY_CONTEXT 111
SET_ALL_CONTEXT 111
SET_IDENTITY_CONTEXT 111
MQPMO_*
PASS_ALL_CONTEXT 111
PASS_IDENTITY_CONTEXT 111
SET_ALL_CONTEXT 111
SET_IDENTITY_CONTEXT 111
MQRC_*
TRUNCATED_MSG_FAILED 108
conventions 33
copyOut method 9
D
data
preparation 5
structures 161
types 32
datagram, putting and getting 19
dataPointer method 10
dead-letter queue, writing a message
to 11
declaring parameters 35
disconnect, implicit operation 26
distribution list, putting messages to 23
DPUT sample program 23
E
elementary data types 32
examples
custom encapsulated message-writing
code 9
declaration and use conventions 33
headers 33
ImqDeadLetterHeader class 9
manipulating binary strings 32
preparing message data 5
retrieving items within a message 7
retrieving messages into a fixed area
of storage 10
sample programs 19
DPUT (imqdput.cpp) 23
HELLO WORLD
(imqwrld.cpp) 20
SGET (imqsget.cpp) 22
SPUT (imqsput.cpp) 22
writing a message to the CICS
bridge 15
writing a message to the dead-letter
queue 11
writing a message to the IMS
bridge 13
examples (continued)
writing a message to the work
header 17
F
features of WebSphere MQ C++
functions not supported 27
G
get method 10
getting a datagram, sample program 19
H
header example 33
header files
CMQC.H 31
IMQI.HPP 31, 35
IMQTYPE.H 31
HELLO WORLD sample program 19
I
i5/OS compilers
IBM ILE C++ 156
VisualAge C++ 156
i5/OS compiling 156
IBM ILE C++ 156
implicit operations 25
ImqAuthenticationRecord class 37
ImqBinary class 40
ImqCache class 42
ImqChannel class 45
ImqCICSBridgeHeader class 51
ImqDeadLetterHeader class 58
ImqDistributionList class 61
ImqError class 63
ImqGetMessageOptions class 65
ImqHeader class 69
IMQI.HPP header file 31, 35
ImqIMSBridgeHeader class 71
ImqItem class 74
ImqMessage class 76
ImqMessageTracker class 84
ImqNamelist class 88
ImqObject class 90
ImqProcess class 97
ImqPutMessageOptions class 99
ImqQueue class 102
ImqQueueManager class 115
ImqReferenceHeader class 135
ImqString class 138
ImqTrigger class 144
IMQTYPE.H header file 31
ImqWorkHeader class 147
IMS bridge, writing a message to 13
include-files 161
179
MQPMO_PASS_ALL_CONTEXT
constant 111
MQPMO_PASS_IDENTITY_CONTEXT
constant 111
MQPMO_SET_ALL_CONTEXT
constant 111
MQPMO_SET_IDENTITY_CONTEXT
constant 111
MQRC_TRUNCATED_MSG_FAILED
constant 108
multithreaded program 36
L
language considerations
attributes 31
binary strings 32
character strings 32
data types 32
header files 31
methods 31
notational conventions 33
using C from C++ 33
link libraries 149
linking 149
N
notational conventions, example
O
object attributes 31
objects, initial state 32
open options 25
open, implicit operation
openFor method 25
M
manipulating strings
example 32
introduction 27
message buffers
application (manual) 5
system (automatic) 5
message data preparation 5
message headers
CICS bridge header 15
dead-letter header 11
IMS bridge header 13
work header 17
message items
description 7
formats 81
identification 75
messages
placing on named queue, example
putting to a distribution list,
example 23
reading 7
retrieving from named queue,
example 22
writing
to the CICS bridge 15
to the dead-letter queue 11
to the IMS bridge 13
to the work header 17
method signatures 31
methods 5
MQCA_* constants 94
MQIA_* constants 94
MQIAV_UNDEFINED constant 94
MQOO_BROWSE constant 108
MQOO_INPUT_* constants 108
MQOO_OUTPUT constant 111
MQOO_PASS_ALL_CONTEXT
constant 111
MQOO_PASS_IDENTITY_CONTEXT
constant 111
MQOO_RESOLVE_NAMES 92
MQOO_SET_ALL_CONTEXT
constant 111
MQOO_SET_IDENTITY_CONTEXT
constant 111
180
33
sample programs
DPUT (imqdput) 23
HELLO WORLD (imqwrld)
SGET (imqsget) 22
SPUT (imqsput) 22
searching for a substring 142
secondary connection 128
setMessageLength method 5
SGET sample program 22
single header file 35
SPUT sample program 22
strings, manipulating 27
structure id 75
switches 149
syncpoint control 121
19
T
25
22
parameters
declaring 35
passing 31
passing parameters 31
pasteIn method 9
placing messages on named queue,
example 22
preparing message data
example 5
introduction 5
programming
z/OS 157
putting a datagram, sample program 19
putting messages to a distribution list,
example 23
Q
queue
putting messages on 22
retrieving messages from 22
queue management classes 1
queue manager name 91
queue name 91
R
RACF password 71
reading messages 7
reopen, implicit operation 25
retrieving items within a message,
example 7
retrieving messages from named queue,
example 22
return codes 57
running applications under z/OS UNIX
System Services 158
running samples on z/OS 158
threads
multiple 36
queue manager connections
127
U
unit of work
backout 123
begin 123
commit 126
i5/OS 121
syncpoint message retrieval 67
syncpoint message sending 101
uncommitted messages (maximum
number) 120
unsupported functions 27
useEmptyBuffer method 5, 10
useFullBuffer method 5
using C from C++ 33
V
Visual C++ 156
VisualAge C++ 156
W
WebSphere MQ
features 1
Object Model 1
work header, writing a message to
write method 5
writeItem method 5
writing messages
to the CICS bridge 15
to the dead-letter queue 11
to the IMS bridge 13
to the work header 17
Z
z/OS compiling
157
17
181
182
SC34-6936-00
Spine information:
WebSphere MQ
Using C++
Version 7.0