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

ORMTIME.m

Go to the documentation of this file.
  1. ORMTIME ; SLC/RJS - PROCESS TIME BASED EVENT ;Aug 26, 2021@13:15:12
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**40,253,243,377,571,405**;Dec 17, 1997;Build 211
  1. ;
  1. EN ; Main entry tag.
  1. ;
  1. N OCXPSDT,OCXZTSK,OCXERR,OCXORMTR,OCXSTDT,OCXLOCK,OCXPAR
  1. K ^TMP("OCXORMTIME",$J)
  1. S OCXLOCK=0
  1. S OCXORMTR="ORMTIME: Startup"
  1. S OCXSTDT=$$EDATE($$IDATE("NOW"))
  1. S ^TMP("OCXORMTIME",$J,"STATUS")="ORMTIME: Attempting to lock ^OR(100,""AE"") at "_OCXSTDT_"."
  1. L +^OR(100,"AE"):10
  1. I D
  1. .S OCXLOCK=1
  1. .D SCAN
  1. .L -^OR(100,"AE")
  1. .K ^TMP("OCXORMTIME")
  1. .S OCXPAR=$$IDATE2("NOW")
  1. .D PUT^XPAR("SYS","ORM ORMTIME LAST RUN",1,OCXPAR,.OCXERR)
  1. S:'OCXLOCK ^TMP("OCXORMTIME",$J,"STATUS")="ORMTIME: Unable to lock ^OR(100,""AE"") at "_OCXSTDT_" attempt."
  1. Q
  1. ;
  1. SCAN ; Call ORMTIM01 for order checking, etc. ORMTIM02 for misc time based tasks
  1. ;
  1. D SCAN^ORMTIM01
  1. D MISC^ORMTIM02
  1. D TASK^ORTSKLPS
  1. D GENERATE^ORBSMART
  1. D GENALRTS^ORB3UTL
  1. D CLEAN^ORWTIU ;Clean-up copy/paste ^XTMP entries that have expired
  1. Q
  1. ;
  1. EDATE(Y) X ^DD("DD") S:(Y["@") Y=$P(Y,"@",1)_" at "_$P(Y,"@",2) Q Y
  1. ;
  1. IDATE(X) N %DT,Y S %DT="F" D ^%DT Q Y
  1. ;
  1. IDATE2(X) N %DT,Y S %DT="TF" D ^%DT Q Y
  1. ;
  1. REQUEUE(ORMQT) ; Code formerly queued ORMTIME tasks in Taskman.
  1. ;
  1. ; (This tag kept for compatibility with outside calls.)
  1. ;
  1. Q
  1. ;
  1. STATUS ; Check status of last ORMTIME run.
  1. ;
  1. N ORMLAST
  1. ;
  1. ; Get date/time of last ORMTIME run:
  1. S ORMLAST=$$GET^XPAR("SYS","ORM ORMTIME LAST RUN",1,"I")
  1. S ORMLAST=$$EDATE(ORMLAST) ; Convert to external format for display.
  1. ;
  1. ; Present information to user:
  1. W !
  1. W !," ORMTIME last ran "_ORMLAST_"."
  1. W !
  1. ;
  1. Q
  1. ;
  1. BULL ; Send a bulletin if ORMTIME's last run is greater than 24 hours.
  1. ;
  1. N DIC,ORMMSG,X,XMSUB,XMTEXT,XMY,XMZ,Y,ORMLAST
  1. ;
  1. ; Don't send bulletin if ORMTIME STATUS mail group does not exist:
  1. S DIC=3.8,DIC(0)="",X="ORMTIME STATUS"
  1. D ^DIC Q:(+Y<0)
  1. ;
  1. S ORMLAST=$$GET^XPAR("SYS","ORM ORMTIME LAST RUN",1,"I")
  1. I $$FMDIFF^XLFDT($$IDATE2("NOW"),ORMLAST,2)>86400 D
  1. .S XMY("G.ORMTIME STATUS")=""
  1. .S XMSUB=" ORMTIME Warning"
  1. .S ORMMSG(1,0)=" "
  1. .S ORMMSG(2,0)=" The ORMTIME process last ran more than 24 hours ago. "
  1. .S ORMMSG(3,0)=" "
  1. .S ORMMSG(4,0)=" The ORMTIME background job handles activating and expiring orders,"
  1. .S ORMMSG(5,0)=" some time based notifications, as well as purging of temporary CPRS"
  1. .S ORMMSG(6,0)=" data. It is important that it runs regularly."
  1. .S ORMMSG(7,0)=" "
  1. .S ORMMSG(8,0)=" Assure that the scheduled option, ORMTIME RUN, is correctly implemented."
  1. .S ORMMSG(9,0)=" "
  1. .S XMTEXT="ORMMSG("
  1. .D ^XMD
  1. Q
  1. ;