Using the application name in supported programming languages
Use this information to learn how the application name is selected in the various languages that IBM® MQ supports.
Recommended application name characters
Application names must be in the character set given by the CodedCharSetId attribute of the queue manager field. For more information on this attribute, see Attributes for the queue manager.
However, if the application is running as an IBM MQ MQI client, the application name must be in the character set and encoding of the client.
- You should also avoid the use of forward slash and ampersand characters in application names.
- You should avoid use of the ampersand character in application names. System topic STATAPP metrics for application names containing an ampersand will not be produced.
- Alphanumeric characters:
A-Z
,a-z
, and0-9
Note: You should not use the lowercasea-z
characters in application names on systems using EBCDIC Katakana. - The space character
- Printable characters that are invariant in EBCDIC:
+ < = > % * ' ( ) , _ - . : ; ?
- The / character. When subscribing to activity trace or STATAPP system topic metrics for an application whose name contains a forward slash, you must replace any forward slash characters with an ampersand character. For example, to receive STATAPP metrics for an application called "DEPT1/APPS/STOCKQUOTE" you must subscribe to the topic string "$SYS/MQ/INFO/QMGR/QMBASIC/Monitor/STATAPP/DEPT1&APPS&STOCKQUOTE/INSTANCE". The amqsact and amqsrua sample applications will automatically convert forward slash characters to ampersands when creating their subscriptions.
How you set the characters
C bindings and client | Java bindings and client | JMS bindings and client | Managed .NET client | Unmanaged .NET bindings and client | Managed XMS client | Unmanaged .XMS bindings and client | |
---|---|---|---|---|---|---|---|
Connection property override | Java connection property override | .NET connection property override | .NET connection property override | ||||
Overridden property | Java overridden property | .NET overridden property | .NET overridden property | ||||
MQEnvironment | Java MQEnvironment | .NET MQEnvironment | .NET MQEnvironment | ||||
Connection factory property | Connection factory property | Connection factory property | Connection factory property | ||||
JMSAdmin | JMSAdmin | JMSAdmin | JMSAdmin | ||||
MQCNO | Connection options | ||||||
Environment variable | Environment variables | Environment variables | Environment variables | ||||
mqclient.ini (Applicable to client connections only) |
Client connections | Client connections | Client connections | ||||
Java class name | Java class name | Java class name | |||||
Default name | Default name | .NET Default name | .NET Default name | .NET Default name | .NET Default name |
- COBOL
- Assembler
- Visual Basic
- RPG
Programming language connections
Applications resolving to the IBM MQ libraries in C, and other programming languages, can provide the application name in the following ways.
The methods of connection are listed in order of precedence, starting with the highest.
- MQCNONote: When connecting to an IBM MQ for z/OS® queue manager, you can only set the application name by using client mode connections, or by using IBM MQ classes for JMS or IBM MQ classes for Java applications.
- MQCNO on IBM i
export MQAPPLNAME=ExampleApplName
Connection:
ApplName=ExampleApplName
- The first 28 characters only are used, and these characters must not be all blanks or nulls.
- The attribute applies only to client connections on the supported programming languages, unmanaged .NET, and unmanaged XMS connections only.
If you have still not chosen the application name, the default name continues to be used, which contains as much of the path and executable name as the operating system displays. For more information, see PutApplName.
Managed .NET applications
Managed .NET applications can provide the application name in the following ways.
The methods of connection are listed in order of precedence, starting with the highest.
<appSettings>
<add key="overrideConnectionDetails" value="true" />
<add key="overrideConnectionDetailsFile" value="<location>" />
</appSettings>
The file specified by overrideConnectionDetailsFile contains
a list of properties prefixed by mqj
. Applications need to define the
mqj.APPNAME property where the value of the mqj.APPNAME
property specifies the name used to identify the connection to the queue manager.
mqj.APPNAME=ExampleApplName
Hashtable properties = new Hashtable();
properties.Add( MQC.APPNAME_PROPERTY, "ExampleApplName" );
MQQueueManager qMgr = new MQQueueManager("qmgrname", properties);
For more information, see Managed and unmanaged operations in .NET.
MQEnvironment.AppName = "ExampleApplName";
If you have not provided the application name by any of the means described in the preceding text, the application name is automatically set to be the executable name (and as much of the path that will fit).
XMS applications
The methods of connection are listed in order of precedence, starting with the highest.
XMS applications can provide the application name on the connection factory using the XMSC.WMQ_APPLICATIONNAME property ("XMSC_WMQ_APPNAME") in a similar way to JMS. You can specify up to 28 characters.
For more information, see XMS .NET creating administered objects and Properties of an XMS message.
In the administrative tooling the property is known as "APPLICATIONNAME" or "APPNAME" for short.
Java and JMS bindings applications
The methods of connection are listed in order of precedence, starting with the highest.
Java and JMS client applications can already specify an application name, and this has been extended on IBM MQ for Multiplatforms to bindings applications, by making use of the MQCNO ApplName field.
A constant MQC.APPNAME_PROPERTY has been defined with the value APPNAME. You can now pass this property to the MQQueueManager constructor, using the first 28 characters only of the name. For more information, see Using connection property override in IBM MQ classes for Java.
The AppName property is added to the MQEnvironment class, and the first 28 characters only are used.
For more information, see Setting up the IBM MQ environment for IBM MQ classes for Java.
If you have not provided the application name by any of the means in the preceding text, the application name is derived from the main class name.
For more information, see Setting up the IBM MQ environment for IBM MQ classes for Java.