This topic describes an example task that changes new line (NL) characters in a text message to carriage return (CR) and line feed (LF) character pairs.
This conversion might be useful if messages from an EBCDIC platform (for example, using CCSID 1047) are sent to an ASCII platform (for example, using CCSID 437). Problems can arise because the EBCDIC NL character hex '15' is converted to the undefined ASCII character hex '7F'. There is no corresponding code point for the NL character in the ASCII code page.
In this example, a message flow is created that interprets the input message as a message in the BLOB domain. This is passed into a ResetContentDescriptor node to reset the data to a message in the MRM domain. The message is called msg_nl (a set of repeating string elements delimited by EBCDIC NL characters). A Compute node is then used to create an output based on another message in the MRM domain called msg_crlf (a set of repeating string elements delimited by CR LF pairs). The message domain is then changed back to BLOB in another ResetContentDescriptor node. This message flow is illustrated below.
The following instructions show how to create the messages and configure the message flow.
-- Declare local working variables DECLARE I INTEGER 1; DECLARE J INTEGER CARDINALITY(InputRoot.*[]); -- Loop to copy all message headers from input to output message WHILE I < J DO SET OutputRoot.*[I] = InputRoot.*[I]; SET I=I+1; END WHILE; -- Set new output message type which uses CRLF delimiter SET OutputRoot.Properties.MessageType = 't_msg_crlf'; -- Loop to copy each instance of string1 child within message body SET I = 1; SET J = CARDINALITY("InputBody"."string1"[]); WHILE I <= J DO SET "OutputRoot"."MRM"."string1"[I] = "InputBody"."string1"[I]; SET I=I+1; END WHILE;
Note the use of a variable, J, initialized to the value of the cardinality of the existing headers in the message. This is more efficient than calculating the cardinality on each iteration of the loop, which happens if you code the following WHILE statement:
WHILE I < CARDINALITY(InputRoot.*[]) DO
Related concepts
Message flows
ESQL
Message modeling
Related tasks
Designing a message flow
Defining message flow content
Managing ESQL files
Related reference
National language support
Compute node
MQInput node
MQOutput node
ResetContentDescriptor node
ESQL
DECLARE statement
SET statement
WHILE statement
TDS Mnemonics
Notices |
Trademarks |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
ac11630_ |