Using a DJMessage Object with a Map
This topic provides an example to use DJMessage object with a map. It involves creating a process that uses a DJMessage object as a target to read data from an XML file and transforms the data in a map.
The steps are:
Creating Map File
1. Create a map with source as ASCII connector and target as XML-DMS connector
2. Specify the associated connector properties.
3. Validate, run, and save the map.
Creating DJMessage Object Global Variable
For this example, declare the DJMessage objects by creating a global variable. You can also add a DIM statement to the Script step.
To create a DJMessage object global variable
1. Create a new process file and open it in the Process Editor.
2. On the Configuration tab > Global Variables section, add a new variable and select the Variable Type as DJMessage.
3. Save the process.
Intializing a DJMessage Object
The following are the steps to initialize a DJMessage object variable using a Script step. You can also set the variable in the Start step of a process using a Dim statement. See
DJMessage Object Type.
To initialize a DJMessage object variable using Script step
1. Drag the Script step to the canvas.
2. Add the following to initialize the DJMessage object:
• Set msgobject = new DJMessage msgobject
where msgobject is the name of the DJMessage object you created.
• msgobject.body = FileRead("filename"), -3)
where filename is the name of the DJMessage file.
Note: The -3 after the filename sets the encoding for file to UTF-8, the only acceptable encoding when using a DJMessage. This setting does not affect the encoding for the string or the message body.
3. Save the process.
Adding a Transformation Step to a Process
You can add a Transformation step to a process and modify the associated map to specify the DJMessage object URI as the target of the transformation.
To add a Transformation step to a process, see
Transformation Step. In the associated map, replace the path to the XML file with a reference to the DJMessage object in the URI format:
DJMessage:///msgobject, where
msgobject is the name of the DJMessage object you created.
Note: You cannot establish a connection to the data source when referencing a DJMessage object because the Actian DataConnect Runtime Engine is unable to connect directly to the message object. You can save the map with the DJMessage URI reference or specify the DJMessage URL with a macro that points to the DJMessage object file. If you use a macro, you must change the macro value to the DJMessage URL in the run-time configuration. See
DJMessage Object Type for more information.
Linking Steps in a Process
1. Click the Link icon and add a link between the Start and Script steps.
2. Create a link between the Script and Transformation steps.
3. Create a link between the Transformation and Stop steps.
4. Validate and save the process.
Creating a Configuration and Running a Process
1. Run the process to create an auto-generated run-time configuration that is saved in the project.
2. Validate and run the process.
Last modified date: 10/22/2024