source: WorldVistAEHR/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/XUTMTP.m@ 1578

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

initial load of WorldVistAEHR

File size: 4.4 KB
RevLine 
[613]1XUTMTP ;SEA/RDS - TaskMan: ToolKit, Print, Part 1 ;04/18/2006 16:19
2 ;;8.0;KERNEL;**20,86,169,242,381**;Jul 10, 1995;Build 2
3 ;
4EN(XUTSK,XUINX,FLAG) ;Print one task
5 I $D(XUTMUCI)_$D(ZTNAME)_$D(ZTFLAG)'="111" D ENV^XUTMUTL
6TASK ;Lookup Task File Data
7 N %,%D,%H,%M,%Y,%ZTT,X,Y,ZT,ZT1,ZT2,ZT3,ZTC,ZTD,ZTF,ZTI,ZTO
8 S FLAG=+$G(FLAG),ZTC=0
9 L +^%ZTSK(XUTSK):2 I '$T W !,"Task: ",XUTSK," entry locked." Q
10 ;Get current data
11 S XUTSK(0)=$G(^%ZTSK(XUTSK,0)),XUTSK(.03)=$G(^(.03)),XUTSK(.1)=$G(^(.1)),XUTSK(.2)=$G(^(.2)),XUTSK(.11)=$G(^(.11)),XUTSK(.26)=$G(^(.26))
12 I '$D(^%ZTSK(XUTSK)) D I 'XUTSK L -^%ZTSK(XUTSK) K XUTMT Q
13 . S X=$G(^%ZTSCH("TASK",XUTSK))
14 . I X="" W !,XUTSK,": No information available." S XUTSK=0 Q
15 . S XUTSK(0)=$P(X,U,1,2)_"^^"_$P(X,U,7,8)_U_$P(X,U,5)_"^^"_$P(X,U,3,4)_U_$P(X,U,9),XUTSK(.1)="5^"_$P(X,U,12),XUTSK(.2)=$P(X,U,6),XUTSK("TASK")=X
16 . S XUTSK(.03)="Task in running list, full information missing."
17 . Q
18 ;
19SCHED ;Lookup Task In Schedule File
20 S ZT1=0 F ZT=0:0 S ZT1=$O(^%ZTSCH(ZT1)) Q:'ZT1 I $D(^%ZTSCH(ZT1,XUTSK))#2 S XUTSK("A",ZT1,XUTSK)="",ZT2=^(XUTSK) I ZT2]"" S $P(XUTSK(.2),U)=ZT2
21 I XUTSK(.26)="" S ZT1="" F S ZT1=$O(^%ZTSCH("IO",ZT1)),ZT2="" Q:ZT1="" F S ZT2=$O(^%ZTSCH("IO",ZT1,ZT2)) Q:ZT2="" S:$D(^(ZT2,XUTSK))#2 XUTSK("IO",ZT1,ZT2,XUTSK)=""
22 S ZT1="" F S ZT1=$O(^%ZTSCH("JOB",ZT1)) Q:ZT1="" S:$D(^(ZT1,XUTSK))#2 XUTSK("JOB",ZT1,XUTSK)=""
23 S ZT1="" F S ZT1=$O(^%ZTSCH("LINK",ZT1)),ZT2="" Q:ZT1="" F S ZT2=$O(^%ZTSCH("LINK",ZT1,ZT2)) Q:ZT2="" S:$D(^(ZT2,XUTSK))#2 XUTSK("LINK",ZT1,ZT2,XUTSK)=""
24 S:$D(^%ZTSCH("TASK",XUTSK))#2 XUTSK("TASK")=^(XUTSK) S:$D(^%ZTSCH("TASK",XUTSK,1)) XUTSK("TASK1")=^(1)
25 L -^%ZTSK(XUTSK)
26 ;
27SCREEN ;Apply Screen, If Supplied
28 I $D(XUTMT("S"))#2 X XUTMT("S") E K XUTMT Q
29 ;
30 S ZT1=$G(^%ZTSK(XUTSK,.3,"XQSCH")) I ZT1 D ;Is it a scheduled task
31 . S ZT2=+$G(^DIC(19.2,ZT1,1.1)) Q:'ZT2
32 . S ZT2=$P($G(^VA(200,ZT2,0),"Unk"),"^") D ADD("Run under user: "_ZT2)
33 . Q
34STATUS ;Determine Status According To Lookup Data
35 S XUTSK("CS")="",XUTSK("UPDATE")=$$TIME($P(XUTSK(.1),U,2))
36 I $D(XUTSK("A")) S ZT1="" F ZT=0:0 S ZT1=$O(XUTSK("A",ZT1)) Q:ZT1="" D ADD("Scheduled for "_$$TIME(ZT1),1)
37 I XUTSK(.26)]"" D ADD("Waiting for hunt group"_$S(XUTSK(.26)[",":"s ",1:" ")_XUTSK(.26),"A")
38 I XUTSK(.26)="",$D(XUTSK("IO")) S ZT1="" F ZT=0:0 S ZT1=$O(XUTSK("IO",ZT1)) Q:ZT1="" D ADD("Waiting for device "_ZT1,"A"),IOQ:FLAG
39 I $D(XUTSK("JOB")) D ADD("Waiting for a partition.",3),JL:FLAG
40 I $D(XUTSK("LINK")) S ZT1="" F ZT=0:0 S ZT1=$O(XUTSK("LINK",ZT1)) Q:ZT1="" D ADD("Waiting for the link to "_ZT1_" to be restored.","G"),LL:FLAG
41 I $D(XUTSK("TASK")) D ADD("Started running "_XUTSK("UPDATE")_".",5)
42 I $E(XUTSK(.1),1)]"",$E(XUTSK(.1),1)'=XUTSK("CS") D STATUS^XUTMTP0 S ZTC=ZTC+1
43 ;
44PRINT ;Go To XUTMTP1 To Print Task And Quit
45 G ^XUTMTP1
46 ;
47TIME(%ZTT) ;Convert $H Time To A Readable Time
48 Q:%ZTT="" "??"
49 N %,%XT,%XD,%H,Y I %ZTT>99999 S %XD=(%ZTT\86400),%XT=%ZTT#86400
50 E S %XD=+%ZTT,%XT=$P(%ZTT,",",2)
51 S %H=$H,%=%XD-%H I %*%<2 S Y=$S(%<0:"Yesterday",'%:"Today",%>0:"Tomorrow",1:"")
52 I %*%>1 S Y=$$HTE^XLFDT(%XD_","_%XT,"5D") ;D 7^%DTC S Y=$E(X,4,5)_"/"_$E(X,6,7)_"/"_$E(X,2,3)
53 S Y=Y_" at "_(%XT\3600)_":"_$E(%XT#3600\60+100,2,3)
54 Q Y
55 ;
56ADD(MSG,FLG) ;Add msg to list
57 S XUTSK(.15,ZTC)=MSG,ZTC=ZTC+1 S:$D(FLG) XUTSK("CS")=FLG
58 Q
59A ;STATUS--determine position of late task in Schedule List
60 N ZTP
61 Q
62 ;
63IOQ ;STATUS--determine position in Device Waiting List
64 N ZTP
65 S ZTP=0,ZT2="" F ZT=0:0 S ZT2=$O(^%ZTSCH("IO",ZT1,ZT2)),ZT3="" Q:ZT2="" F ZT=0:0 S ZT3=$O(^%ZTSCH("IO",ZT1,ZT2,ZT3)) Q:ZT3="" S ZTP=ZTP+1 I ZT3=ZTSK G I1
66I1 D ADD(" "_(ZTP-1)_" task"_$S(ZTP=2:"",1:"s")_" ahead of this one.")
67 Q
68 ;
69JL ;STATUS--determine position in Job List
70 N ZTP
71 S ZTP=0,ZT1=""
72 F S ZT1=$O(^%ZTSCH("JOB",ZT1)),ZT2="" Q:ZT1="" F S ZT2=$O(^%ZTSCH("JOB",ZT1,ZT2)) Q:ZT2="" S ZTP=ZTP+1 I ZT2=ZTSK G J1
73J1 D ADD(" "_(ZTP-1)_" task"_$S(ZTP=2:"",1:"s")_" ahead of this one.")
74 Q
75 ;
76LL ;STATUS--determine position in Link Waiting List
77 N ZTP
78 S ZTP=0,ZT2=""
79 F S ZT2=$O(^%ZTSCH("LINK",ZT1,ZT2)),ZT3="" Q:ZT2="" F S ZT3=$O(^%ZTSCH("LINK",ZT1,ZT2,ZT3)) Q:ZT3="" S ZTP=ZTP+1 I ZT3=ZTSK G L1
80L1 D ADD(" "_(ZTP-1)_" task"_$S(ZTP=2:"",1:"s")_" ahead of this one.")
81 Q
82 ;
83TASKUSER(TSK) ;Return the user name for a task
84 N S1,S2,S3
85 S S1=$G(^%ZTSK(+TSK,0)) I '$L(S1) Q "Unknown"
86 S S1=+$P(S1,U,3)
87 S S2=$G(^VA(200,S1,0)) I '$L(S2) Q "Unknown"
88 S S3=$$ACTIVE^XUSER(S1)
89 Q $S(S3:$P(S2,U),1:$E($P(S2,U),1,25)_" (T)")
Note: See TracBrowser for help on using the repository browser.