PK.CLIN.NOTES,
A^prefix,
B^ID,
^$(A)^admdata,
^*(N2)^nurdata,
^&(N)^nurdict,
"FORMAT.NOTE",@1,
END;

[1]::FORMAT.NOTE
0^T,
ID#"0-"^aa,
ID#"1-"^note,
^[nurdata]NOTE[aa]N[note]^MAIN,
"NOTE.DATA",@2,
IF{[MAIN]|12="Y" "***CONFIDENTIAL***"^/T.REC[T+1^T];
   ""^NCL,
   DO{+([MAIN,"T",NCL],XX)^NCL XX^/T.REC[T+1^T]},
   "CHECK AMENDS",""^NCLA^NCLAT,
   DO{+([MAIN,"TA",NCLA],XX)^NCLA " "^/T.REC[T+1^T],
                                  "AMENDED: "_%Z.date.out(XX|0)_"-"_(XX|1)_"  BY "_(XX|3)^/T.REC[T+1^T],
                                  DO{+([MAIN,"TA",NCLA,"T",NCLAT],XX)^NCLAT XX^/T.REC[T+1^T]}},
   END};

[2]::NOTE.DATA
[admdata]AA[aa]|3^/T.INFO["MRN"],
[admdata]AA[aa]|0^/T.INFO["ACCT"],
[nurdict]NOC[[MAIN]|3]|1^/T.INFO["TESTNAME"],
IF{-([nurdata]NOTE[aa]N[NOTE]TA[""],YY)^AMEND YY|0_YY|1;XX|0_XX|1}^UPD,
UPD^/T.INFO["UPDATENODE"],
[MAIN]|0_[MAIN]|1^/T.INFO["TESTDATE"],
IF{[MAIN]|2^gu &(HU)HUU[gu]|4^/T.INFO["AUTHOR"]},
"NUR."_[MAIN]|3^/T.INFO["TESTTYPE"],
IF{AMEND "AMENDED";"ENTERED"}^/T.INFO["STATUS"];