Rational Developer for System z

Variables and field references in ESQL

This topic briefly describes the use of variables and field references in the subset of ESQL that is supported by the service flow project tools.
Important: To fully understand a feature described in this topic, you should read the complete description of the feature in the documentation for WebSphere® Message Broker (see Reference works describing ESQL).

Variables

In ESQL a variable is a data field within a message. For example, the variable CA_REQUEST_ID, which is a string variable intended to contain a request ID for a nonterminal application, is a field within a message such as msg_QUERYACC_DFHCOMMAREA.

Note: Do not be confused by the use of the terms variable and message element. A message element can be a complex structure, a single field, an array, or an array element. Two of these elements, a single field and an array, can also be called variables (see How messages are used in flows).

In ESQL you refer to a variable by means of a field reference consisting (in this instance) of the message name, followed by a period, followed by the field name: msg_QUERYACC_DFHCOMMAREA.CA_REQUEST_ID (see Field references).

The ESQL variables within a service flow project flow belong to a category of ESQL variables called shared variables. These variables exist for the lifetime of the flow (because the messages in which the variables are located exist for the lifetime of the flow) and they can be accessed from any node in the flow.

Thus within a flow you have global access to the structures, fields, arrays, and array elements contained in all the messages that are referenced in the flow, including:
  • The input message for the flow
  • The output message for the flow
  • The variable message

Variable names are case-sensitive, as are all names of messages and names of elements within messages.

Note: Because the service flow project tools support the use only of ESQL expressions (not ESQL statements, ESQL procedures, or ESQL modules) you cannot use the ESQL DECLARE statement to declare a variable.

Field references

Field references are references within ESQL expressions to existing messages or elements of messages (including variables) by name. Field references belong to the REFERENCE data type.

Field references are case-sensitive, because they use the names of messages and message elements, which are case-sensitive (see Case sensitivity).

A field reference consists of a correlation name followed by zero or more path elements separated by periods (see Figure 1). In the service flow project tools, a correlation name must be the name of a message that you have imported into the current flow. A path element can be the name of a structure, the name of a data field, the name of an array, or an array element. Together the correlation name and the path elements specify the path within the message to the data field that you want to refer to:
Figure 1. Field references
msg_QUERYACC_DFHCOMMAREA.CA_REQUEST_ID
msg_MY_PROGRAM_INFO.aiAccountInfo.userName
msg_JGAPPSCA_DFHCOMMAREA.INSEARCHCRITERIA.INFIRSTNAME
msg_MY_DATA.arrCustomerInfo[4].CustomerID

When you use an ESQL expression containing a field reference, the field reference must meet the criteria for being a valid ESQL identifiers (see Identifiers and keywords in ESQL).

Important: If the name of a message or a message element that is included in a field reference contains an ESQL operator or an ESQL keyword, then the name must enclosed in quotes. Examples:
Figure 2. Use quotes around operators and reserved names in field references
msg_MY_INFO."ORDER-NUMBER"         *** Minus sign 
msg_MY_INFO."NOT_NEEDED"           *** NOT
msg_MY_INFO."NULL_SENDER"          *** NULL
msg_MY_INFO."IS_VALID"             *** IS

See Operators in ESQL and Identifiers and keywords in ESQL.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)