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

GMRC113P.m

Go to the documentation of this file.
  1. GMRC113P ;ABV/MKN - Post-Install routine for GMRC*3*113;8/18/2018 9:35
  1. ;;3.0;CONSULT/REQUEST TRACKING;**113**;DEC 27, 1997;Build 50
  1. ;
  1. ;;ICR Invoked
  1. ;;10063, ^%ZTLOAD - $$S
  1. ;;10141, ^XPDUTL - BMES, MES
  1. ;;10103, ^XLFDT - $$FMADD, $$NOW
  1. ;;10070, ^XMD - ENL, ENT1
  1. ;
  1. Q
  1. ;
  1. POST ;Updates the CSLT CANCELLED TO DISCONTINUED parameter to seed initial values
  1. N DIC,DLAYGO,NA,TSTAMP,X
  1. D BMES^XPDUTL("Updating the parameter CSLT CANCELLED TO DISCONTINUED with initial values:")
  1. D BMES^XPDUTL("Is the overnight cancelled to discontinued job active? = NO")
  1. D MES^XPDUTL("How many days back to start with? = 31")
  1. D MES^XPDUTL("How many days back to end with? = 365")
  1. D PUT^XPAR("PKG.CONSULT/REQUEST TRACKING","CSLT CANCELLED TO DISCONTINUED","Is the overnight cancelled to discontinued job active?","NO")
  1. D PUT^XPAR("PKG.CONSULT/REQUEST TRACKING","CSLT CANCELLED TO DISCONTINUED","How many days back to start with?",31)
  1. D PUT^XPAR("PKG.CONSULT/REQUEST TRACKING","CSLT CANCELLED TO DISCONTINUED","How many days back to end with?",365)
  1. D BMES^XPDUTL("CSLT CANCELLED TO DISCONTINUED parameter has been initialized")
  1. ;Kill old option GMRC CANCELLED TO DISCONTINUED, replaced by GMRC CHANGE STATUS X TO DC in test version 7
  1. S DIK="^DIC(19,",DA=$O(^DIC(19,"B","GMRC CANCELLED TO DISCONTINUED","")) D:DA ^DIK
  1. ;Add to file #19.2 (OPTION SCHEDULING)
  1. D BMES^XPDUTL("Set up schedule for GMRC CHANGE STATUS X TO DC")
  1. I $$FIND1^DIC(19.2,,"B","GMRC CHANGE STATUS X TO DC","B") D MES^XPDUTL("Already scheduled")
  1. E D
  1. .S (DLAYGO,DIC)=19.2,DIC(0)="L"
  1. .S X="GMRC CHANGE STATUS X TO DC"
  1. .S TSTAMP=$$FMADD^XLFDT($$NOW^XLFDT(),1),$P(TSTAMP,".",2)="23"
  1. .S DIC("DR")="2////"_TSTAMP_";6////D@11:00PM" D ^DIC
  1. ;
  1. D QUEUE
  1. Q
  1. ;
  1. QUEUE ;Create entries in new index ASTATUS, task entry point
  1. N ZTRTN,ZTDESC,ZTREQ,ZTIO,ZTDTH,ZTSK
  1. D BMES^XPDUTL("Calling TaskMan to create background job to create entries in new index ASTATUS")
  1. S ZTRTN="EN^GMRC113P",ZTDESC="Create entries in file #123 for new index ASTATUS",ZTIO="",ZTDTH=$H
  1. D ^%ZTLOAD I '$G(ZTSK) D BMES^XPDUTL("Unable to create TaskMan job - run EN^GMRC113P after install finishes") Q
  1. D BMES^XPDUTL("Post-install queued as task #"_$G(ZTSK))
  1. Q
  1. ;
  1. EN ;Create Consult record entries for new ASTATUS index
  1. N DA,DIK,HANGRECS,HANGSECS,IEN123,IEN12340,NUMRECS,X,ZTSTOP
  1. S HANGRECS=10000,HANGSECS=10 ;Hang every 10,000 records for 10 seconds
  1. S (NUMRECS,ZTSTOP)=0,IEN123=$G(^GMR(123,"ASTATUS",0),"@")
  1. F S IEN123=$O(^GMR(123,IEN123),-1) Q:'IEN123!(ZTSTOP) D
  1. .S ^GMR(123,"ASTATUS",0)=IEN123 ;This is to allow re-entrance of this function after being manually shut down
  1. .I $$S^%ZTLOAD D Q
  1. ..S ZTSTOP=1,X=$$S^%ZTLOAD("GMRC*3.0*113 post-install received a shutdown request")
  1. ..D MSG("GMRC*3.0*113 post-install received a shutdown request")
  1. .S IEN12340=$O(^GMR(123,IEN123,40,0)) D:IEN12340?1.N
  1. ..K DA S DA=IEN12340,DA(1)=IEN123
  1. ..S DIK="^GMR(123,"_DA(1)_",40,",DIK(1)=".01^ASTATUS" D ENALL^DIK
  1. ..S NUMRECS=NUMRECS+1
  1. .H:'(NUMRECS#HANGRECS) HANGSECS
  1. K:'ZTSTOP ^GMR(123,"ASTATUS",0)
  1. S ZTREQ="@"
  1. I 'ZTSTOP D MSG("GMRC*3.0*113 - the background job has finished setting up the new index ""ASTATUS""")
  1. E D
  1. .S X="GMRC*3.0*113 - the background job was stopped whilst adding records to the new index ""ASTATUS"". "
  1. .S X=X_"If you re-install the patch, it will continue where it left off."
  1. .D MSG(X)
  1. Q
  1. ;
  1. MSG(SUB) ;create and send message
  1. N XMDUZ,XMSUB,XMZ,XMTEXT,XMY
  1. N IEN,A,B,C,LNCNT S (IEN,A,B,C)=0,LNCNT=1
  1. S XMY(DUZ)=""
  1. S XMDUZ=DUZ
  1. S XMSUB=SUB
  1. D XMZ^XMA2 ; call Create Message Module
  1. S XMTEXT="XMTEXT"
  1. S XMTEXT(1)="GMRC*3.0*113 post-install background job received a shutdown request"
  1. S XMTEXT(2)="- update of ""ASTATUS"" index aborted. if the patch is re-installed, the"
  1. S XMTEXT(3)="update to the index will continue at the Consult IEN where it left off"
  1. S XMTEXT(4)="in this run."
  1. D ENL^XMD
  1. D ENT1^XMD
  1. Q
  1. ;