Author |
Message
|
ashrain |
Posted: Wed Oct 17, 2012 12:45 am Post subject: Using File Output Node Broker 7.0.0.4 |
|
|
Novice
Joined: 16 Mar 2011 Posts: 12
|
Hello,
I need to read a message from an input queue ,extract the cdata from the message and sftp the file to the server.
My code currently sftp the file successfully to the server but cannot extract the cdata.It appends the whole message to the file.
Can you please help how to extract the cdata from the message and append to the file .
Thank you |
|
Back to top |
|
 |
vmcgloin |
Posted: Wed Oct 17, 2012 1:08 am Post subject: |
|
|
Knight
Joined: 04 Apr 2002 Posts: 560 Location: Scotland
|
what is going wrong when you try to extract the cdata section? Have you tried to debug your own efforts? Are you using ESQL or another coding method?
You may get more help if you post your code here and demonstrate that you have searched the documentation and forum for information. |
|
Back to top |
|
 |
ashrain |
Posted: Wed Oct 17, 2012 1:19 am Post subject: |
|
|
Novice
Joined: 16 Mar 2011 Posts: 12
|
Hello,
Yes I am using esql and as a example this is input message
<IBIS version="2.0"><SH><SID>test</SID><TO></TO><FM></FM><MG>N</MG><MS>1</MS><LG>Y</LG><IT>2012-10-15 10:42:13</IT><OT>2012-10-15 10:42:14</OT><PR>1</PR><GID/><C3ID/></SH><AD><![CDATA[100000666 200905251042TC 20090525 000001000001000000174534KPN ENTERCOM MANAGEMLEIDSCHENDAM ]]><AH><TO/><FM/><DP/><MK/><RF/></AH></AD></IBIS>
expected output message is extracted the cdata only:
100000666 200905251042TC 20090525 000001000001000000174534KPN ENTERCOM MANAGEMLEIDSCHENDAM
written to a text file.
The code is simple :
SET outfile = 'workfile.txt';
-- Ensure the properties header is copied for CCSID and encoding
SET OutputRoot.Properties = InputRoot.Properties;
SET OutputRoot = InputRoot.XMLNSC.IBIS.AD;
SET OutputLocalEnvironment.Destination.File.Name = outfile;
Currently this is the output message:
<IBIS version="2.0"><SH><SID>test</SID><TO></TO><FM></FM><MG>N</MG><MS>1</MS><LG>Y</LG><IT>2012-10-15 10:42:13</IT><OT>2012-10-15 10:42:14</OT><PR>1</PR><GID/><C3ID/></SH><AD><![CDATA[100000666 200905251042TC 20090525 000001000001000000174534KPN ENTERCOM MANAGEMLEIDSCHENDAM ]]><AH><TO/><FM/><DP/><MK/><RF/></AH></AD></IBIS> |
|
Back to top |
|
 |
marko.pitkanen |
Posted: Wed Oct 17, 2012 1:59 am Post subject: |
|
|
 Chevalier
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
|
Hi,
You should perhaps investigate if following line does what you think it does
Quote: |
SET OutputRoot = InputRoot.XMLNSC.IBIS.AD; |
--
Marko |
|
Back to top |
|
 |
nathanw |
Posted: Wed Oct 17, 2012 2:07 am Post subject: |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
you are not extracting the CDATA portion correctly.
check your code and also check other flows that are similar where a CDATA section is extraced _________________ Who is General Failure and why is he reading my hard drive?
Artificial Intelligence stands no chance against Natural Stupidity.
Only the User Trace Speaks The Truth  |
|
Back to top |
|
 |
ashrain |
Posted: Wed Oct 17, 2012 2:07 am Post subject: |
|
|
Novice
Joined: 16 Mar 2011 Posts: 12
|
I have not set it to SET OutputRoot.BLOB.BLOB = CAST(InputRoot.XMLNSC.IBIS.AD.(XMLNSC.CDataValue) AS BLOB CCSID 1208);
but getting error : The following error messages will give specific details of the location and nature of the error. Check and correct the syntax of the SQL statements and redeploy.
BIP2401E: (.test_Compute.Main, 19.84) : Syntax error : expected 'AS' but found 'keyword Blob'.
The expected token was not found.
Correct the syntax of your ESQL expression in node '.test.Main', around line and column '19.84', then redeploy the message flow. |
|
Back to top |
|
 |
ashrain |
Posted: Wed Oct 17, 2012 2:23 am Post subject: |
|
|
Novice
Joined: 16 Mar 2011 Posts: 12
|
set it like this
DECLARE chrCDataVal CHAR InputRoot.XMLNSC.IBIS.AD.(XMLNSC.CDataValue);
SET OutputRoot.BLOB.BLOB = CAST(chrCDataVal as BLOB CCSID 1208);
works fine now..thank you again for the help ..now cdata is appending to the file..only issue is how to include newlinefeed after each message |
|
Back to top |
|
 |
ashrain |
Posted: Wed Oct 17, 2012 2:30 am Post subject: |
|
|
Novice
Joined: 16 Mar 2011 Posts: 12
|
got it SET OutputRoot.BLOB.BLOB = CAST(chrCDataVal as BLOB CCSID 1208)|| X'0D0A';
thanks again  |
|
Back to top |
|
 |
zpat |
Posted: Wed Oct 17, 2012 2:57 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
You are hard coding the Window form of line separator (CRLF), what happens if you send the file to a Unix server in the future?
Either way don't forget to use a configurable service for the FTP definitions, it will avoid a code change if the server moves or credentials change. |
|
Back to top |
|
 |
ashrain |
Posted: Wed Oct 17, 2012 3:05 am Post subject: |
|
|
Novice
Joined: 16 Mar 2011 Posts: 12
|
Currently the file is being sftp to a linux server... |
|
Back to top |
|
 |
McueMart |
Posted: Thu Oct 18, 2012 12:38 am Post subject: |
|
|
 Chevalier
Joined: 29 Nov 2011 Posts: 490 Location: UK...somewhere
|
Quote: |
You are hard coding the Window form of line separator (CRLF), what happens if you send the file to a Unix server in the future? |
If the OP has the ftp operation set up as a text transfer, wont the FTP operation deal with that conversion for them? Or will that only do char set conversions? |
|
Back to top |
|
 |
zpat |
Posted: Thu Oct 18, 2012 1:46 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
ashrain wrote: |
Currently the file is being sftp to a linux server... |
You should aim to make all WMQ and WMB implementations platform independent as a best practice.
Making the line end characters a UDP might be a good idea, then it could be changed without a code change.
FTP should convert the file line terminators, but SFTP should really be used and that only does binary. |
|
Back to top |
|
 |
ashrain |
Posted: Thu Oct 18, 2012 3:44 am Post subject: |
|
|
Novice
Joined: 16 Mar 2011 Posts: 12
|
Thank you for the suggestion, I will propose this to my seniors...  |
|
Back to top |
|
 |
|