RSLTDATA.TXT,
@HDR,
@HANDLE.ARGS,
@TRLR,
END;

HDR
"<?xml version="_D(34)_1.0_D(34)_" ?>"^!,
           "<ReplyMessage>"^!,
           "<TransactionId>"_1234_"</TransactionId>"^!,
           "<Status>Success</Status>"^!,
           "<Payload>"^!

HANDLE.ARGS
1^nr,
DO{nr</ARGC 1,
   /ARGV[nr]^arg,
   @HANDLE.ARG,
   nr+1^nr}

HANDLE.ARG
K(/T.INFO),
K(/T.REC),
arg$1^prefix,
arg'$1^mnemonic,
IF{prefix="N" %PK.NURNDATA(prefix,mnemonic);
   prefix="D" %PK.DEPTDATA(prefix,mnemonic)},
@SEND.TEST,
K(/T.INFO),
K(/T.REC)

SEND.TEST
"<Document>"^!,
"<Display><![CDATA["_(/T.INFO["TESTNAME"])_"]]></Display>"^!,
"<EventMnemonic></EventMnemonic>"^!,
"<EventCode><Mnemonic></Mnemonic></EventCode>"^!,
"<PersonMnemonic>"_(/T.INFO["MRN"])_"</PersonMnemonic>"^!,
"<EncounterMnemonic>"_(/T.INFO["ACCT"])_"</EncounterMnemonic>"^!,
"<EventEndDateTime>"_(/T.INFO["TESTDATE"])_"</EventEndDateTime>"^!,
"<InstanceMnemonic>"_prefix_mnemonic_"</InstanceMnemonic>"^!,
"append x to key to ensure that its not empty",
"<Key>"_"x"_(/T.INFO["UPDATENODE"])_"</Key>"^!,
"<EventSetMnemonic>"_(/T.INFO["TESTTYPE"])_"</EventSetMnemonic>"^!,
"<ResultStatus>"^!,
"<Display>"^!,
IF{/T.INFO["STATUS"]="ORD" "Ordered";
   /T.INFO["STATUS"]="COLB" "Collection Batch";
   /T.INFO["STATUS"]="RECD" "Received";
   /T.INFO["STATUS"]="UNV" "Unverified Results";
   /T.INFO["STATUS"]="RES" "Resulted";
   /T.INFO["STATUS"]="COMP" "Completed";
   /T.INFO["STATUS"]="CAN" "Cancelled";
   /T.INFO["STATUS"]="SOUT" "Signed";
   /T.INFO["STATUS"]="ENT" "Entered";
   /T.INFO["STATUS"]}^!,
"</Display>"^!,
"<Meaning>"_(/T.INFO["STATUS"])_"</Meaning>"^!,
"<Value></Value>"^!,
"</ResultStatus>"^!,
IF{/T.INFO["AUTHOR"] "<EventPrsnlActions>"^!,
"<EventPrsnlAction>"^!,
"<ActionPrsnl><FullName>"_(/T.INFO["AUTHOR"])_"</FullName></ActionPrsnl>"^!,
"<ActionType><Meaning>AUTHOR</Meaning></ActionType>"^!,
"</EventPrsnlAction>"^!,
"</EventPrsnlActions>"^!},
"<DocumentComponents><Body><![CDATA["^!,
""^T,
DO{+(/T.REC[T],XX)^T XX_D(10)^!},
"]]></Body></DocumentComponents></Document>"^!

TRLR
"</Payload>"^!,
"</ReplyMessage>"^!
