Test Message:-
<dates>
<datemodify>
<date>31-01-2016</date>
<date>31-02-2016</date>
<date>31-03-2016</date>
<date>31-04-2016</date>
</datemodify>
</dates>
CREATE COMPUTE MODULE DateModify_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL DateModifyMove();
-- CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
RETURN TRUE;
END;
CREATE PROCEDURE DateModifyWhile()BEGIN
DECLARE I INTEGER 1;
DECLARE COUNT INTEGER;
DECLARE DATEREFIN REFERENCE TO InputRoot.XMLNSC.Dates.DateModify;
SET COUNT=CARDINALITY(DATEREFIN.Date[]);
WHILE I <= COUNT DO
SET OutputRoot.XMLNSC.Dates.DateModify.Date[I]=REPLACE(DATEREFIN.Date[I],'2016','2017');
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE DateModifyMove()BEGIN
DECLARE DATEREFIN REFERENCE TO InputRoot.XMLNSC.Dates.DateModify.Date;
CREATE FIELD OutputRoot.XMLNSC.Dates.DateModify.Date;
DECLARE DATEREFOUT REFERENCE TO OutputRoot.XMLNSC.Dates.DateModify.Date;
WHILE LASTMOVE(DATEREFIN) DO
SET DATEREFOUT = REPLACE(DATEREFIN,'2016','2017');
CREATE NEXTSIBLING OF DATEREFOUT AS DATEREFOUT REPEAT;
MOVE DATEREFIN NEXTSIBLING REPEAT TYPE NAME;
END WHILE;
if LASTMOVE(DATEREFOUT) then
DELETE LASTCHILD OF OutputRoot.XMLNSC.Dates.DateModify;
end if;
END;
END MODULE;
<dates>
<datemodify>
<date>31-01-2016</date>
<date>31-02-2016</date>
<date>31-03-2016</date>
<date>31-04-2016</date>
</datemodify>
</dates>
CREATE COMPUTE MODULE DateModify_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL DateModifyMove();
-- CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
RETURN TRUE;
END;
CREATE PROCEDURE DateModifyWhile()BEGIN
DECLARE I INTEGER 1;
DECLARE COUNT INTEGER;
DECLARE DATEREFIN REFERENCE TO InputRoot.XMLNSC.Dates.DateModify;
SET COUNT=CARDINALITY(DATEREFIN.Date[]);
WHILE I <= COUNT DO
SET OutputRoot.XMLNSC.Dates.DateModify.Date[I]=REPLACE(DATEREFIN.Date[I],'2016','2017');
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE DateModifyMove()BEGIN
DECLARE DATEREFIN REFERENCE TO InputRoot.XMLNSC.Dates.DateModify.Date;
CREATE FIELD OutputRoot.XMLNSC.Dates.DateModify.Date;
DECLARE DATEREFOUT REFERENCE TO OutputRoot.XMLNSC.Dates.DateModify.Date;
WHILE LASTMOVE(DATEREFIN) DO
SET DATEREFOUT = REPLACE(DATEREFIN,'2016','2017');
CREATE NEXTSIBLING OF DATEREFOUT AS DATEREFOUT REPEAT;
MOVE DATEREFIN NEXTSIBLING REPEAT TYPE NAME;
END WHILE;
if LASTMOVE(DATEREFOUT) then
DELETE LASTCHILD OF OutputRoot.XMLNSC.Dates.DateModify;
end if;
END;
END MODULE;
No comments:
Post a Comment