source: WorldVistAEHR/trunk/r/SAGG_PROJECT-A1B5-KMPS/KMPSUTL1.m@ 613

Last change on this file since 613 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.4 KB
Line 
1KMPSUTL1 ;OAK/KAK - SAGG Utilities ;5/1/07 10:30
2 ;;2.0;SAGG;;Jul 02, 2007
3 ;
4MPLTF() ;-- returns the type of M platform
5 ;---------------------------------------------------------------------
6 ; Returns: CVMS for Cache for OpenVMS platform
7 ; CWINNT for Cache for Windows NT platform
8 ;---------------------------------------------------------------------
9 ;
10 N MPLTF,ZV
11 ;
12 S ZV=$ZV
13 S MPLTF=$S(ZV["VMS":"CVMS",ZV["Windows":"CWINNT",1:"UNK")
14 Q MPLTF
15 ;
16TSKSTAT(OPT) ;-- status of scheduled task option
17 ;---------------------------------------------------------------------
18 ; input OPT = option name
19 ; output RTN = status code^literal condition
20 ; ...^scheduled date@time (day)^numeric day-of-week
21 ; ...^expanded scheduled frequency^short form frequency
22 ; ...^task id^queued by^user status
23 ;
24 ; where status code^condition:
25 ; = 0^SCHEDULED
26 ; = 1^NOT SCHEDULED and 'scheduled date@time' will
27 ; be UNKNOWN and 'numeric day of week' will be -1
28 ; = 2^NOT RESCHEDULED
29 ; = 3^MISSING when OPT does not exist
30 ; = 9^UNKNOWN
31 ;
32 ; where user status = ACTIVE or NOT ACTIVE
33 ;---------------------------------------------------------------------
34 ;
35 N ACTV,DA,DAY,DOW,FREQ,RTN,TSK,TSKINFO,USER,Y
36 ;
37 S (DOW,FREQ)=-1
38 S RTN="9^UNKNOWN^NO DATE^-1^UNKNOWN^^^UNKNOWN^NOT ACTIVE"
39 ;
40 I '$D(^DIC(19,"B",OPT)) S $P(RTN,U,1,2)="3^MISSING" Q RTN
41 S DA=$O(^DIC(19,"B",OPT,0)),DA=+$O(^DIC(19.2,"B",DA,0))
42 S TSKINFO=$G(^DIC(19.2,DA,0)),(DOW,Y)=$P(TSKINFO,U,2),FREQ=$P(TSKINFO,U,6)
43 S:+Y $P(TSKINFO,U,2)=$$FMTE^XLFDT(Y)
44 I DOW'="" S DAY=$$DOW^XLFDT(DOW),DOW=$$DOW^XLFDT(DOW,1)
45 S TSK=+$G(^DIC(19.2,+DA,1))
46 I (DOW="")!(TSK="") S $P(RTN,U,1,2)="1^NOT SCHEDULED"
47 E D
48 .S $P(RTN,U,1,2)="0^SCHEDULED"
49 .I FREQ="" S $P(RTN,U,1,2)="2^NOT RESCHEDULED"
50 .; queued to run at
51 .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
52 ; rescheduling frequency
53 I FREQ?1.3N1A D
54 .S $P(RTN,U,5,6)=+FREQ_" "_$S(FREQ["D":"day",FREQ["M":"month",1:FREQ)_$S(+FREQ>1:"s",1:"")_U_FREQ
55 E S $P(RTN,U,5,6)=$S(FREQ="":"UNKNOWN",1:FREQ)_U_FREQ
56 ; task id
57 S $P(RTN,U,7)=TSK
58 ; find if the user is active
59 I TSK D
60 .S TSKINFO=$G(^%ZTSK(TSK,0))
61 .S USER=+$P(TSKINFO,U,3)
62 .S ACTV=+$$ACTIVE^XUSER(USER)
63 .; queued by
64 .S $P(RTN,U,8)=$P($G(^VA(200,USER,0)),U)
65 I $G(ACTV) S $P(RTN,U,9)="ACTIVE"
66 Q RTN
Note: See TracBrowser for help on using the repository browser.