PK.USER,
"HDR",@1,
"USERS",@2,
"PROVIDERS",@3,
"TRLR",@5,
END;

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

[2]::USERS
"Y"^IS.USER,
""^gu,
DO{+&(G)GU[gu]^gu IF{&(G)GU[gu]|0'="Y";
&(G)GU[gu]|6^ggg,
IF{ggg ggg^/DOC[ggg]},
&(HU)HUU[gu]|4^FULLNAME,
gu^USERNAME,
IF{ggg &(G)GGG[ggg]UPD|0_.}_&(G)GU[gu]UPD|0^UPDKEY,
"PERSON",@4}};

[3]::PROVIDERS
"N"^IS.USER,
""^ggg,
DO{+&(G)GGG[ggg]^ggg IF{/DOC[ggg];
"Y"'=&(G)GGG[ggg]|0;
&(G)GGG[ggg]|1^FULLNAME,
"PROVIDER."_ggg^USERNAME,
&(G)GGG[ggg]UPD|0^UPDKEY,
"PERSON",@4}};

[4]::PERSON
"<Prsnl>"^!,
"<FullName><![CDATA["_FULLNAME_"]]></FullName>"^!,
"<UserNumber>"_ggg_"</UserNumber>"^!,
"<Username>"_USERNAME_"</Username>"^!,
"<Position>"^!,
"<Display>"_IF{ggg "Provider";"User"}_"</Display>"^!,
IF{"Y"'=IS.USER;
"<PrsnlReltnTypes>"^!,
"<PrsnlReltnType>"^!,
"<Display>PatientKeeper</Display>"^!,
"<Mnemonic>PATIENTKEEPERDOC</Mnemonic>"^!,
"</PrsnlReltnType>"^!,
"</PrsnlReltnTypes>"^!},
"</Position>"^!,
"<Groups>"^!,
IF{&(G)GGG[ggg]|14 "<Group>"^!,
"<Display><![CDATA["_&(G)GGH[&(G)GGG[ggg]|14]|1_"]]></Display>"^!,
"<Mnemonic><![CDATA[GRP."_&(G)GGG[ggg]|14_"]]></Mnemonic>"^!,
"</Group>"^!},
""^FAC,
DO{+&(G)GGG[ggg]FAC[FAC]^FAC IF{&(G)GGG[ggg]FAC[FAC]|12^Q 1,
"<Group>"^!,
"<Display><![CDATA["_&(G)GGH[Q]|1_"]]></Display>"^!,
"<Mnemonic><![CDATA[GRP."_Q_"]]></Mnemonic>"^!,
"</Group>"^!}},
""^GGH,
DO{+&(G)GGG[ggg]P[GGH]^GGH "<Group>"^!,
"<Display><![CDATA["_&(G)GGH[GGH]|1_"]]></Display>"^!,
"<Mnemonic><![CDATA[GRP."_GGH_"]]></Mnemonic>"^!,
"</Group>"^!},
"</Groups>"^!,
"<Key>"_UPDKEY_"</Key>"^!,
"</Prsnl>"^!;

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