Posted: Wed Apr 30, 2003 1:34 pm Post subject: parsing XML
Newbie
Joined: 25 Oct 2002 Posts: 8
Hi--
I have been able to save my XML strings into the db as CLOBs. Now I am trying to retrieve it from the db and post it to a queue. Every record goes on the queue as a seperate message. Here is what I am doing and it does not work. Actually it does work for the first record and fails on the next one.
SET Environment.TMP.blob[] =
PASSTHRU('SELECT BLOB(T.MSGDATA) AS TX FROM MQ.BATCHWO AS T WHERE T.MSGID = ? AND (T.ACTIONIND = ? OR T.ACTIONIND= ? OR T.ACTIONIND= ? OR T.ACTIONIND= ?)', InputRoot.MQMD.CorrelId, '711', '712', '701', '708');
SET CARD=CARDINALITY(Environment.TMP.*[]);
SET j=1;
WHILE j<=CARD DO
CREATE FIRSTCHILD OF Environment.TMP.TRAN DOMAIN 'XML' PARSE(Environment.TMP.blob.*[j]);
SET OutputRoot.XML = Environment.TMP.TRAN.XML;
SET Environment.TMP = NULL;
SET OutputRoot.MQMD.CodedCharSetId = 819;
SET j=j+1;
PROPAGATE;
SET intTreeCount = 1;
WHILE intTreeCount < CARDINALITY(InputRoot.*[]) DO
SET OutputRoot.*[intTreeCount] = InputRoot.*[intTreeCount];
SET intTreeCount=intTreeCount+1;
END WHILE;
How do you know it doesn't work on the second time around? Does it give you an error message somewhere? What is that error message?
Also, you don't say what version and CSD level you're at. If you're using 2.1, your code would be more efficient if you used references rather than cardinality.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum