Was this helpful?
Creating and Using Message Variables
Use message variables in the scripting language to reference message objects. The message variables allow you to exchange data between steps in a processes.
The type name for message variables is DJMessage.
There are three ways to associate a message variable with a message object in a script:
Creating New DJMessage Variable
When a new DJMessage variable is created, a new message object is created and associated with the variable. If no name is specified for the message object when the message variable is created, a default name is generated. The generated names have the format '_MessageN' where N is a unique number for the new message object, starting with 1.
The following example shows how to create a new message variable with a default name for the message object:
dim m as djmessage
set m = new djmessage
This example shows how to create a new message variable and specify the name for the message object:
dim m as djmessage
set m = new djmessage "msg1"
After a message variable has been created, the name of the message object may be changed by using the Name property of the message variable:
m.Name = "msg2"
If an attempt is made to create a message variable with a name that is already used, or to change the name of a message object to a name that is already used, an error occurs.
Assigning Result of DJComponent GetMessage Function to Message Variable
The following example shows how to associate the message object returned by the GetMessage Function with a message variable:
dim m as djmessage
dim q as DJComponent
set q = new DJComponent "Websphere MQ"
q.connectstring = "queue=sourcequeue"
set m = q.GetMessage()
This example shows how to use an existing message object to store the result of the GetMessage function:
dim m as djmessage
set m = new djmessage "msg1"
dim q as DJComponent
set q = new DJComponent "Websphere MQ"
q.connectstring = "queue=sourcequeue"
set m = q.GetMessage("msg1")
Using FindMessage Function
The FindMessage function retrieves a message object by name and assigns it to a message variable. If the name specifies a message object that does not exist, the value of the message variable is Nothing. The following example shows how to use the FindMessage function to retrieve a message object by name and assign it to a message variable:
dim m as djmessage
set m = FindMessage("msg1")
Last modified date: 12/03/2024