PK.LABNKEY
"HDR",@1,
"PATS",@2,
"TRLR",@6,
END;

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

[2]::PATS
/ARGV[1]^DT,
2^nr,
DO{nr</ARGC 1,
   /ARGV[nr]^ACT,
   ?(A)AAAI[ACT]^aa,
   "LAB",@3,
   nr+1^nr};

[3]::LAB
""^Q,
DO{"NEXT.SPEC",@4 "SEND",@5};

[4]::NEXT.SPEC
>(?(SL)SLSP[aa,Q],sls)^Q;

[5]::SEND
IF{$(SL)SLS[sls]|3<DT;
"<Component>"^!,
"<Specimen>"_sls_"</Specimen>"^!,
"<Key>"_"x"_$(SL)SLS[sls]|23_"</Key>"^!,
"</Component>"^!};

[6]::TRLR
"</Payload>"^!,
"</ReplyMessage>"^!;
