Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: DBTSROLL

DBTSROLL.m

Go to the documentation of this file.
  1. DBTSROLL ;BAO/DMH roll back the patient log to where it [ 02/05/1999 11:13 AM ]
  1. ; was prior to the beginning of the load
  1. ;
  1. ;
  1. ; is called from the DBTS ADD PATIENT ROLLBACK remote proc.
  1. ; if error was encountered in the middle of the SQL load this
  1. ; procedure is called to reset the log to where is was before
  1. ; the load was started
  1. ;
  1. ;
  1. START ;
  1. ;
  1. ROL(DBTSRET,DBTSP) ;dbtsret is return value, dbtsp input value of patient ien
  1. ;
  1. ;
  1. TEST ;
  1. S ARRAY=0
  1. ;S DBTSP=12016 ;uncomment if want to test with call to TEST directly
  1. ;
  1. S DBTSRET(1)="-1" ;just incase stops prematurely
  1. D ^XBKVAR
  1. I DUZ(2)=4526 S DUZ(2)=2348
  1. S DBTS("LOC")=$P($G(^AUTTLOC(DUZ(2),0)),"^",10)
  1. I DBTS("LOC")="" S DBTSRET(1)="-1" Q
  1. S DBTS("ID")=DBTS("LOC")_"|1419200ROL|"_DBTSP
  1. ;
  1. ; if nothing in tmp returns -1
  1. ;
  1. ;I '$D(^DBTS("TMP",DBTSP)) S DBTSRET(1)="-1" Q
  1. ; put the temp patient log information back to dbts patient file
  1. S DA=DBTSP,DIK="^DBTSPAT(" D ^DIK
  1. S NODE=""
  1. F S NODE=$O(^DBTS("TMP",DBTSP,NODE)) Q:NODE="" D
  1. .S ^DBTSPAT(DBTSP,NODE)=^DBTS("TMP",DBTSP,NODE)
  1. .Q
  1. S DBTSRET(1)=DBTS("ID")_U_DBTS("LOC")_U_DBTSP_U_"ROLLBACK"
  1. K ^DBTS("TMP",DBTSP)
  1. Q