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

KMPSUTL1.m

Go to the documentation of this file.
  1. KMPSUTL1 ;OAK/KAK - SAGG Utilities ;9/1/2015
  1. ;;2.0;SAGG PROJECT;**1**;Jul 02, 2007;Build 67
  1. ;
  1. MPLTF() ;-- returns the type of M platform
  1. ;---------------------------------------------------------------------
  1. ; Returns: CVMS for Cache for OpenVMS platform
  1. ; CWINNT for Cache for Windows NT platform
  1. ;---------------------------------------------------------------------
  1. ;
  1. N MPLTF,ZV
  1. ;
  1. S ZV=$$OS^%ZOSV ; IA# 10097
  1. S MPLTF=$S(ZV["VMS":"CVMS",ZV["UNIX":"CUNIX",ZV["NT":"CWINNT",1:"UNK")
  1. Q MPLTF
  1. ;
  1. TSKSTAT(OPT) ;-- status of scheduled task option
  1. ;---------------------------------------------------------------------
  1. ; input OPT = option name
  1. ; output RTN = status code^literal condition
  1. ; ...^scheduled date@time (day)^numeric day-of-week
  1. ; ...^expanded scheduled frequency^short form frequency
  1. ; ...^task id^queued by^user status
  1. ;
  1. ; where status code^condition:
  1. ; = 0^SCHEDULED
  1. ; = 1^NOT SCHEDULED and 'scheduled date@time' will
  1. ; be UNKNOWN and 'numeric day of week' will be -1
  1. ; = 2^NOT RESCHEDULED
  1. ; = 3^MISSING when OPT does not exist
  1. ; = 9^UNKNOWN
  1. ;
  1. ; where user status = ACTIVE or NOT ACTIVE
  1. ;---------------------------------------------------------------------
  1. ;
  1. N ACTV,DA,DAY,DOW,FREQ,RTN,TSK,TSKINFO,USER,Y
  1. ;
  1. S (DOW,FREQ)=-1
  1. S RTN="9^UNKNOWN^NO DATE^-1^UNKNOWN^^^UNKNOWN^NOT ACTIVE"
  1. ;
  1. I '$D(^DIC(19,"B",OPT)) S $P(RTN,U,1,2)="3^MISSING" Q RTN
  1. S DA=$O(^DIC(19,"B",OPT,0)),DA=+$O(^DIC(19.2,"B",DA,0))
  1. S TSKINFO=$G(^DIC(19.2,DA,0)),(DOW,Y)=$P(TSKINFO,U,2),FREQ=$P(TSKINFO,U,6)
  1. S:+Y $P(TSKINFO,U,2)=$$FMTE^XLFDT(Y)
  1. I DOW'="" S DAY=$$DOW^XLFDT(DOW),DOW=$$DOW^XLFDT(DOW,1)
  1. S TSK=+$G(^DIC(19.2,+DA,1))
  1. I (DOW="")!(TSK="") S $P(RTN,U,1,2)="1^NOT SCHEDULED"
  1. E D
  1. .S $P(RTN,U,1,2)="0^SCHEDULED"
  1. .I FREQ="" S $P(RTN,U,1,2)="2^NOT RESCHEDULED"
  1. .; queued to run at
  1. .S $P(RTN,U,3,4)=$S($P(TSKINFO,U,2)="":"NO DATE",1:$P(TSKINFO,U,2))_$S($D(DAY):" ("_DAY_")",1:"")_U_DOW
  1. ; rescheduling frequency
  1. I FREQ?1.3N1A D
  1. .S $P(RTN,U,5,6)=+FREQ_" "_$S(FREQ["D":"day",FREQ["M":"month",1:FREQ)_$S(+FREQ>1:"s",1:"")_U_FREQ
  1. E S $P(RTN,U,5,6)=$S(FREQ="":"UNKNOWN",1:FREQ)_U_FREQ
  1. ; task id
  1. S $P(RTN,U,7)=TSK
  1. ; find if the user is active
  1. I TSK D
  1. .S TSKINFO=$G(^%ZTSK(TSK,0))
  1. .S USER=+$P(TSKINFO,U,3)
  1. .S ACTV=+$$ACTIVE^XUSER(USER)
  1. .; queued by
  1. .S $P(RTN,U,8)=$P($G(^VA(200,USER,0)),U)
  1. I $G(ACTV) S $P(RTN,U,9)="ACTIVE"
  1. Q RTN