Hi all! I've got some code that identifies subtrees in a XML-message that contain only empty elements. It's a recursive procedure using dynamic REFERENCE variables. Here's a snippet of my code: <snip> CREATE PROCEDURE RemoveEmptySegments (INOUT root REFERENCE) BEGIN DECLARE DCntCursor REFERENCE TO root; DECLARE DataCount INTEGER; DECLARE ClimbThisNode BOOLEAN; SET ClimbThisNode = TRUE; IF LENGTH(TRIM(FIELDNAME(root))) = 3 THEN -- This must be a segment name SET DataCount = 0; CALL FindSegmentData(DCntCursor, DataCount); IF DataCount = 0 THEN SET ClimbThisNode = FALSE; SET root = NULL; -- <<<<<<<<<<<<<<<<<<< This won't work! END IF; END IF;
IF ClimbThisNode THEN DECLARE cursor REFERENCE TO root; MOVE cursor FIRSTCHILD; WHILE LASTMOVE(cursor) DO CALL RemoveEmptySegments(cursor); MOVE cursor NEXTSIBLING; END WHILE; END IF; END; </snip> Now, since the root variable only references a subtree in the message-tree, setting it to NULL only dereferences root (I'd presume, haven't verified it). The message-tree, however, is not affected. I have verified that the logic finds empty subtrees, because replacing SET root = NULL with SET root = 'nod data' will show up in a trace node as expected. I've tried DETACH root, but to no avail. So, how do I remove a subtree from my message-tree, given a REFERENCE-variable pointing to the subtree? TIA! /Martin Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com Archive: http://vm.akh-wien.ac.at/MQSeries.archive