Creating a message collection by using ESQL

A message collection can be constructed by using ESQL. Using a message collection is useful if messages must be grouped together for parsing, or if the message collection must be constructed to represent a particular data structure, such as a CICS® Transaction Server for z/OS® channel data structure.

Before you begin

  • Create an application, library, or integration project.
  • For background information, read Message collections.

About this task

A message collection is a message that consists of a Properties header and a single domain element named Collection. The Collection folder contains a number of child messages, each of which can contain a Properties folder, a number of headers (such as MQMD), and a body. A message collection can also have zero or more attributes that are name/value pairs. The name of an attribute must be unique within a message collection. A standard attribute for the message collection is an attribute called CollectionName.

The following figure shows an example of a message collection structure.
This is a diagram of the tree for a message collection. Its contents are described in the surrounding text.

You can create a message collection by using ESQL to group messages together for parsing, or create a message collection that must be constructed to represent a particular data structure, such as a CICS channel data structure.

To configure a message collection by using ESQL, complete the following steps:

Procedure

  1. Create a Properties folder for the collection by using the following ESQL statement:
    CREATE FIRSTCHILD of OutputRoot domain 'Properties' NAME 'Properties';
  2. Create the Collection domain element by using the following statement:
    CREATE LASTCHILD OF OutputRoot DOMAIN 'Collection';

    As with message folders, the domain element is always the last child of the message.

  3. Use the following statement to set an attribute in the collection called CollectionName:
    SET OutputRoot.Collection.CollectionName = 'myCollectionName';
  4. The following ESQL shows an example procedure to create a message within the collection:
    SET OutputRoot.Collection.foldername.Properties.MessageSet     = set;
    SET OutputRoot.Collection.foldername.Properties.MessageType    = type;
    SET OutputRoot.Collection.foldername.Properties.MessageFormat  = format;
    SET OutputRoot.Collection.foldername.Properties.Encoding       = encoding;
    SET OutputRoot.Collection.foldername.Properties.CodedCharSetId = ccsid;
    
    SET OutputRoot.Collection.foldername.domain.content=some data;