The SET statement evaluates sourceexpression and assigns the resulting value to the entity identified by target.
The target can be either a declared variable or a field in a message tree that can be modified, for example Environment, InputLocalEnvironment, OutputLocalEnvironment, OutputRoot, or OutputExceptionList.
If the target is a declared variable, omit the TYPE, NAME, NAMESPACE, and VALUE clauses. The source expression must return a scalar value of a type that is the same as, or can be converted to, the declared data type of the variable. NULL values are handled in exactly the same way as any other value.
If the target is a field, it is navigated to (creating the fields if necessary) and its value is set according to a set of rules, which depend on the presence or absence of the TYPE, NAME, NAMESPACE, or VALUE clauses, and the data type returned by source expression.
SET OutputRoot.XML.Message.Structure[2].Field = ...at least one instance of Structure must already exist in the message. That is, the only fields in the tree that are created are ones on a direct path from the root to the field identified by the field reference.
If a TYPE clause is present, the type of the target field is changed to that returned by sourceexpression. An exception is thrown if the result is not scalar, is not of type INTEGER, or is NULL.
If a NAMESPACE clause is present, the namespace of the element is set. Setting the namespace of an element automatically sets its NAME flag.
If a NAME clause is present, the name of the target field is changed to that returned by sourceexpression. An exception is thrown if the result is not scalar, is not of type CHARACTER, or is NULL.
If a VALUE clause is present, the value of the target field is changed to that returned by sourceexpression. An exception is thrown if the result is not scalar.
SET OutputRoot = InputRoot; SET OutputRoot.XML.Order.Name = UPPER(InputRoot.XML.Order.Name);
This example puts one field in the message into uppercase. The first statement constructs an output message that is a complete copy of the input message. The second statement sets the value of the Order.Name field to a new value, as defined by the expression on the right.
If the Order.Name field does not exist in the original input message, it does not exist in the output message as generated by the first statement. The expression on the right of the second statement returns NULL (because the field referenced inside the UPPER function call does not exist). Assigning the NULL value to a field has the effect of deleting it if it already exists, and so the effect is that the second statement has no effect.
SET OutputRoot.XML.Order.Name VALUE = NULL;
Notices |
Trademarks |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
ak05140_ |