Search code examples
messagemessagebrokeribm-integration-busextended-sql

How to write CHARACTER variable to file in ESQL?


I'm trying to implement simple message flow, which reads text file (SWIFT message) and replaces one field value, then I need to put it back to file. Flow reads file as blob, then I cast message as CHARACTER and doing replacement. As result I get a CHARACTER variable, which I want write to file.


Solution

  • Cast the variable back to BLOB, make it the message root, then send it into a FileOutput node with default settings. Assuming that you are doing the character replacement with ESQL in a Compute node (with its Compute Mode set to change Message), then the subsequent ESQL would be:

    SET OutputRoot.BLOB.BLOB = CAST(yourCharVar AS BLOB);