Use 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; see attributes for the queue manager for details of this attribute.

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.

To ensure a smooth transition of the application name between queue managers, and to allow application resource monitoring through the resource monitoring topics, application names should contain only single-byte printable characters. Note: We should also avoid the use of forward slash and ampersand characters in application names. This limits the name to:

  • Alphanumeric characters: A-Z, a-z, and 0-9Note: We should not use the lowercase a-z characters in application names on systems using EBCDIC Katakana.
  • The space character
  • Printable characters that are invariant in EBCDIC: + < = > % * ' ( ) , _ - . : ; ?


How you set the characters

The following table summarizes the means by which the application name is chosen in the various languages IBM MQ supports. The means by which the name is chosen is in order of precedence, highest first.

  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
Note: The C bindings and client column applies to the following programming languages as well:

  • 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.

Connection optionsTwo new fields have been added to MQCNO, and the Version number has been increased to 7. For more information, see MQCNO.Note: Only applications using IBM MQ classes for JMS, or IBM MQ classes for Java, and client mode connections are allowed to set the application name when connecting to an IBM MQ for z/OS queue manager.

  • MQCNONote: Only applications using IBM MQ classes for JMS, or IBM MQ classes for Java, and client mode connections are allowed to set the application name when connecting to an IBM MQ for z/OS queue manager.
  • MQCNO on IBM i

Environment variablesIf the you have not yet selected an application name, we can use the following environment variable, MQAPPLNAME, to identify the connection to the queue manager. For example:
export MQAPPLNAME=ExampleApplName
See Environment variables for more information. Note that the first 28 characters only are used, and these characters must not be all blanks or nulls. Note: The attribute applies to the supported programming languages, Unmanaged .NET, and Unmanaged XMS connections only.

Client configuration fileIf the you have not yet selected an application name, and the connection is a client connection, we can specify the following in the client configuration file ( for example mqclient.ini) to identify the connection to the queue manager.
Connection:
	ApplName=ExampleApplName
Notes:
  1. The first 28 characters only are used, and these characters must not be all blanks or nulls.
  2. The attribute applies only to client connections on the supported programming languages, Unmanaged .NET, and Unmanaged XMS connections only.

See Configure a client using a configuration file for an example configuration file.

Default name

If we 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. See PutApplName for more information.


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.

Connection property overrideWe can provide a connection details override file to applications in the following way:
<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.

Only the first 28 characters of the name are used. For example:
mqj.APPNAME=ExampleApplName

Overridden propertyA constant MQC.APPNAME_PROPERTY has been defined with the value APPNAME. We can now pass this property to the MQQueueManager constructor, using the first 28 characters only of the name. For example:
Hashtable properties = new Hashtable();
properties.Add( MQC.APPNAME_PROPERTY, "ExampleApplName" );
MQQueueManager qMgr = new MQQueueManager("qmgrname", properties);

See Managed and unmanaged operations in .NET for more information.

MQEnvironmentThe AppName property is added to the MQEnvironment class, and the first 28 characters only are used. For example:
MQEnvironment.AppName = "ExampleApplName";

Default name

If we have not provided the application name by any of the means 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.

Connection factory property

XMS applications can provide the application name on the connection factory using the XMSC.WMQ_APPLICATIONNAME property ("XMSC_WMQ_APPNAME”) similarly to JMS. We can specify up to 28 characters.

See Create administered objects and Properties of an XMS message for more information.

JMSAdmin

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.

Connection property overrideThe Application name property has been added to the list of connection properties that we can override. See Use IBM MQ connection property override for more information.Attention: The connection properties and the way to use the Connection Property Override file is the same for both IBM MQ classes for Java and .NET.

Overridden property

A constant MQC.APPNAME_PROPERTY has been defined with the value APPNAME. We can now pass this property to the MQQueueManager constructor, using the first 28 characters only of the name. See Use connection property override in IBM MQ classes for Java for more information.

MQEnvironment

The AppName property is added to the MQEnvironment class, and the first 28 characters only are used.

See Set up the IBM MQ environment for IBM MQ classes for Java for more information.

Java class name

If we 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.

See Set up the IBM MQ environment for IBM MQ classes for Java for more information.

Attention: On IBM i it is not possible to query the main class name, so IBM MQ client for Java is used instead.

Parent topic: Specify the application name in supported programming languages


Related concepts


Related information