| 1 | ORB3ENV ; slc/CLA - OE/RR 3 Notifications/Order Check Environment Check Routine ;9/19/01  14:29
 | 
|---|
| 2 |  ;;3.0;ORDER ENTRY/RESULTS REPORTING;**105**;Dec 17, 1997
 | 
|---|
| 3 | EN ; main entry point
 | 
|---|
| 4 |  D ORMTIME
 | 
|---|
| 5 |  Q
 | 
|---|
| 6 | ORMTIME ; determine if ORMTIME is running
 | 
|---|
| 7 |  N I,J,STATUS,JOB,OK,LASTDT,NOWDT,DIFFDT,SCHDT,ORY,MSG
 | 
|---|
| 8 |  S OK=0
 | 
|---|
| 9 |  D BMES^XPDUTL("Checking to see if ORMTIME is running...")
 | 
|---|
| 10 |  ;
 | 
|---|
| 11 |  ;for loop that runs for 12 iterations (60 secs.) - quits if no lock
 | 
|---|
| 12 |  F I=1:1:12 Q:OK=1  D
 | 
|---|
| 13 |  .L +^OR(100,"AE"):5 I $T S OK=1 Q
 | 
|---|
| 14 |  .I I=1 D BMES^XPDUTL("Pausing because ORMTIME is running...")
 | 
|---|
| 15 |  .E  D MES^XPDUTL(".")
 | 
|---|
| 16 |  ;
 | 
|---|
| 17 |  I OK=1 LOCK  ;^OR(100,"AE"):0
 | 
|---|
| 18 |  ;
 | 
|---|
| 19 |  ;if ORMTIME is not currently running see if scheduled in near future:
 | 
|---|
| 20 |  I OK=1 D
 | 
|---|
| 21 |  .S LASTDT=$$GET^XPAR("SYS","ORM ORMTIME LAST RUN",1,"I")
 | 
|---|
| 22 |  .;
 | 
|---|
| 23 |  .D OPTSTAT^XUTMOPT("ORMTIME RUN",.ORY)  ;get option sch info IA# 1472
 | 
|---|
| 24 |  .F J=1:1:ORY Q:OK=2  D
 | 
|---|
| 25 |  ..S SCHDT=$P(ORY(J),U,2)  ;next scheduled ORMTIME run time
 | 
|---|
| 26 |  ..S NOWDT=$$NOW^XLFDT
 | 
|---|
| 27 |  ..S DIFFDT=$$FMDIFF^XLFDT(SCHDT,NOWDT,2)
 | 
|---|
| 28 |  ..I DIFFDT>0,DIFFDT<300 S OK=2  ;if sched to run in less than 5 minutes
 | 
|---|
| 29 |  ;
 | 
|---|
| 30 |  I OK=1 D  ;ORMTIME not running
 | 
|---|
| 31 |  .D BMES^XPDUTL("ORMTIME not running nor scheduled within 5 minutes. Okay to install.")
 | 
|---|
| 32 |  ;
 | 
|---|
| 33 |  I OK=0 D  ;ORMTIME still running
 | 
|---|
| 34 |  .D BMES^XPDUTL("ORMTIME is still running...")
 | 
|---|
| 35 |  .S JOB="",JOB=$O(^TMP("OCXORMTIME",JOB),-1)
 | 
|---|
| 36 |  .I +$G(JOB)>0,$D(^TMP("OCXORMTIME",JOB,"STATUS")) D
 | 
|---|
| 37 |  ..S STATUS=^TMP("OCXORMTIME",JOB,"STATUS")
 | 
|---|
| 38 |  ..D MES^XPDUTL(STATUS)
 | 
|---|
| 39 |  .D BMES^XPDUTL("*** ABORTING INSTALLATION *** - due to potential conflict with ORMTIME.")
 | 
|---|
| 40 |  .D MES^XPDUTL("Try installation again after ORMTIME run completes.")
 | 
|---|
| 41 |  .D MES^XPDUTL("(ORMTIME usually requires less than 10 mintues to run to completion.)")
 | 
|---|
| 42 |  .S XPDQUIT=2  ;abort installation but leave transport global in ^XTMP
 | 
|---|
| 43 |  ;
 | 
|---|
| 44 |  I OK=2 D  ;ORMTIME scheduled to run before patch install completes
 | 
|---|
| 45 |  .S MSG=$$FMTE^XLFDT(SCHDT)
 | 
|---|
| 46 |  .S MSG="ORMTIME scheduled at: "_MSG_" and may impact patch installation."
 | 
|---|
| 47 |  .D BMES^XPDUTL(MSG)
 | 
|---|
| 48 |  .D BMES^XPDUTL("*** ABORTING INSTALLATION *** - due to potential conflict with ORMTIME.")
 | 
|---|
| 49 |  .D MES^XPDUTL("Try installation again after ORMTIME run completes.")
 | 
|---|
| 50 |  .D MES^XPDUTL("(ORMTIME usually requires less than 10 mintues to run to completion.)")
 | 
|---|
| 51 |  .S XPDQUIT=2  ;abort installation but leave transport global in ^XTMP
 | 
|---|
| 52 |  ;
 | 
|---|
| 53 |  Q
 | 
|---|