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

QAN2P35.m

Go to the documentation of this file.
  1. QAN2P35 ;ALB/MJB - Incident Reporting Package Decommission ;07/02/2024
  1. ;;2.0;Incident Reporting ;**35**; JUL 13, 1995;Build 5
  1. ;
  1. ; The Incident Reporting package is being retired.
  1. ; This routine will remove the Incident Reporting files and data.
  1. ;
  1. Q
  1. ;
  1. TASK ;task the file deletion
  1. ;
  1. N ZTRTN,ZTDESC,ZTIO,ZTDTH
  1. D MES^XPDUTL(" ")
  1. D MES^XPDUTL("A background job will be tasked to delete all Incident Reporting files and data.")
  1. D MES^XPDUTL("A Mailman message will be generated and sent to the installer when the job")
  1. D MES^XPDUTL("is completed.")
  1. S ZTRTN="BEGDEL^QAN2P35",ZTDESC="Incident Reporting Package File & Data Removal"
  1. S ZTIO="",ZTDTH=$H
  1. D ^%ZTLOAD
  1. Q
  1. ;
  1. BEGDEL ;background job entry point to remove all files and data
  1. ;
  1. N DIU,QANCNT,QANNODE,QANLOOP,QANTXT,QANFILE,QANFLG,QANSTART,QANEND,QANSTR
  1. S (QANCNT,QANFLG)=0,QANSTART=$$FMTE^XLFDT($$NOW^XLFDT,1)
  1. K ^TMP($J,"QANP35")
  1. F QANLOOP=1:1 S QANTXT=$P($T(MSGTXT+QANLOOP),";;",2) Q:QANTXT="QUIT" D LINE(QANTXT)
  1. ;build beginning of mail message
  1. S DIU(0)="DST" ;flags to delete data, subfile and templates
  1. F QANFILE=742,742.1,742.13,742.14,742.4,742.5,742.6 D
  1. .;loop through known Incident Reporting files
  1. .S DIU=$$ROOT^DILFD(QANFILE),QANNODE=$$CREF^DILF(DIU)
  1. .;set diu=file root and QANnode=closed file root
  1. .I '$$VFILE^DILFD(QANFILE) Q ;verify file exists
  1. .;delete file and data in diu
  1. .D EN^DIU2
  1. .;check if DD and data is removed
  1. .I '$D(@QANNODE),'$$VFILE^DILFD(QANFILE) D Q ;file successfully deleted
  1. ..S QANSTR=DIU_" successfully removed" D LINE(QANSTR) Q
  1. .S QANSTR=DIU_" was not successfully removed",QANFLG=1 D LINE(QANSTR) ;fall through if file not deleted
  1. I QANFLG D
  1. .D LINE("")
  1. .S QANSTR="A file was not removed successfully. Please have your IRM re-run"
  1. .S QANSTR=QANSTR_" the background job" D LINE(QANSTR)
  1. .S QANSTR="by entering this command at the programmer's prompt" D LINE(QANSTR)
  1. .S QANSTR=" D BEGDEL^QAN2P35"
  1. D LINE("")
  1. S QANSTART="Start Time: "_QANSTART D LINE(QANSTART)
  1. S QANEND=$$FMTE^XLFDT($$NOW^XLFDT,1)
  1. S QANEND="End Time: "_QANEND D LINE(QANEND)
  1. D MAIL ;send mail message
  1. K ^TMP($J,"QANP35")
  1. Q
  1. ;
  1. MSGTXT ;message into
  1. ;; The Social Work package is being retired and all data and data
  1. ;; dictionary entries will be removed from the system. This
  1. ;; message shows a list of files that were removed.
  1. ;;
  1. ;;QUIT
  1. Q
  1. LINE(TEXT) ;add line to tmp global stored for mail message
  1. ;
  1. S QANCNT=QANCNT+1,^TMP($J,"QANP35",QANCNT)=TEXT
  1. Q
  1. ;
  1. MAIL ;send message
  1. ;
  1. N XMDUZ,XMY,XMTEXT,XMSUB
  1. S XMY(DUZ)="",XMDUZ=.5
  1. S XMSUB="Incident Reporting Package Data & Data Dictionary Removal"
  1. S XMTEXT="^TMP($J,""QANP35"","
  1. D ^XMD
  1. Q