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/XUTMTR1.m@ 1361

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

initial load of WorldVistAEHR

File size: 3.3 KB
Line 
1XUTMTR1 ;SEA/RDS - TaskMan: ToolKit, Report 1 (Status) ;05/26/98 16:41
2 ;;8.0;KERNEL;**86**;Jul 10, 1995
3 ;
4TASK ;Lookup Task File Data
5 L +^%ZTSK(XUTMT) I $D(^%ZTSCH("TASK",XUTMT)),$D(^(XUTMT,0))[0 W !,"Task # ",XUTMT," is currently running, but its record has been deleted." G T4
6 I '$D(^%ZTSK(XUTMT)) W !,"Task # ",XUTMT," does not exist." G NOPE
7 I $D(^%ZTSK(XUTMT,0))[0 W !,"Task # ",XUTMT," does exist, but is missing critical data." G NOPE
8T4 S ZTSK=XUTMT,XUTSK(0)=$S($D(^%ZTSK(ZTSK,0))#2:^(0),1:""),XUTSK(.1)=$S($D(^(.1))#2:^(.1),1:""),XUTSK(.2)=$S($D(^(.2))#2:^(.2),1:""),XUTSK(.26)=$S($D(^(.26))#2:^(.26),1:"")
9 N %,%D,%H,%M,%Y,%ZTT,X,Y,ZT,ZT1,ZT2,ZT3,ZTC
10 ;
11SCHED ;Lookup Task In Schedule File
12 S ZT1="" F ZT=0:0 S ZT1=$O(^%ZTSCH(ZT1)) Q:'ZT1 I $D(^%ZTSCH(ZT1,ZTSK))#2 S XUTSK("A",ZT1,ZTSK)="",ZT2=^(ZTSK) I ZT2]"" S $P(XUTSK(.2),U)=ZT2
13 S ZT1="" F ZT=0:0 S ZT1=$O(^%ZTSCH("IO",ZT1)),ZT2="" Q:ZT1="" F ZT=0:0 S ZT2=$O(^%ZTSCH("IO",ZT1,ZT2)) Q:ZT2="" S:$D(^(ZT2,ZTSK))#2 XUTSK("IO",ZT1,ZT2,ZTSK)=""
14 S ZT1="" F ZT=0:0 S ZT1=$O(^%ZTSCH("JOB",ZT1)) Q:ZT1="" S:$D(^(ZT1,ZTSK))#2 XUTSK("JOB",ZT1,ZTSK)=""
15 S ZT1="" F ZT=0:0 S ZT1=$O(^%ZTSCH("LINK",ZT1)),ZT2="" Q:ZT1="" F ZT=0:0 S ZT2=$O(^%ZTSCH("LINK",ZT1,ZT2)) Q:ZT2="" S:$D(^(ZT2,ZTSK))#2 XUTSK("LINK",ZT1,ZT2,ZTSK)=""
16 S:$D(^%ZTSCH("TASK",ZTSK))#2 XUTSK("TASK",ZTSK)=^(ZTSK)
17 L -^%ZTSK(XUTMT)
18 ;
19STATUS ;Determine Status According To Lookup Data
20 S ZTC=0
21 I $D(XUTSK("A")) S ZT1="" F ZT=0:0 S ZT1=$O(XUTSK("A",ZT1)) Q:ZT1="" S XUTSK(.15,ZTC)="Scheduled to start "_$$TIME^XUTMTP(ZT1),ZTC=ZTC+1
22 I XUTSK(.26)]"" S XUTSK(.15,ZTC)="Waiting for hunt group"_$S(XUTSK(.26)[",":"s ",1:" ")_XUTSK(.26)_".",ZTC=ZTC+1
23 I XUTSK(.26)="",$D(XUTSK("IO")) S ZT1="" F ZT=0:0 S ZT1=$O(XUTSK("IO",ZT1)) Q:ZT1="" S XUTSK(.15,ZTC)="Waiting for device "_ZT1_".",ZTC=ZTC+1 D IOQ
24 I $D(XUTSK("JOB")) S XUTSK(.15,ZTC)="Waiting for a submanager.",ZTC=ZTC+1 D JL
25 I $D(XUTSK("LINK")) S ZT1="" F ZT=0:0 S ZT1=$O(XUTSK("LINK",ZT1)) Q:ZT1="" S XUTSK(.15,ZTC)="Waiting for the link to "_ZT1_" to be restored.",ZTC=ZTC+1 D LL
26 I $D(XUTSK("TASK")) S XUTSK(.15,ZTC)="Currently running.",ZTC=ZTC+1
27 I $O(XUTSK(.3))="",$D(XUTSK(.1))#2,$P(XUTSK(.1),U)]"" X "S X=""TRAP^XUTMTP0"",@^%ZOSF(""TRAP"") D @($P(XUTSK(.1),U)_""^XUTMTP0"")" S X="",@^%ZOSF("TRAP"),ZTC=ZTC+1
28 ;
29REPORT ;Report Status And Quit
30 F ZT=0:1:ZTC-1 W !,XUTSK(.15,ZT)
31 K XUTMT Q
32 ;
33A ;STATUS--determine position of late task in Schedule List
34 N ZTP
35 Q
36 ;
37IOQ ;STATUS--determine position in Device Waiting List
38 N ZTP
39 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
40I1 S XUTSK(.15,ZTC)=" "_(ZTP-1)_" task"_$S(ZTP=2:"",1:"s")_" ahead of this one.",ZTC=ZTC+1
41 Q
42 ;
43JL ;STATUS--determine position in Job List
44 N ZTP
45 S ZTP=0,ZT1="" F ZT=0:0 S ZT1=$O(^%ZTSCH("JOB",ZT1)),ZT2="" Q:ZT1="" F ZT=0:0 S ZT2=$O(^%ZTSCH("JOB",ZT1,ZT2)) Q:ZT2="" S ZTP=ZTP+1 I ZT2=ZTSK G J1
46J1 S XUTSK(.15,ZTC)=" "_(ZTP-1)_" task"_$S(ZTP=2:"",1:"s")_" ahead of this one.",ZTC=ZTC+1
47 Q
48 ;
49LL ;STATUS--determine position in Link Waiting List
50 N ZTP
51 S ZTP=0,ZT2="" F ZT=0:0 S ZT2=$O(^%ZTSCH("LINK",ZT1,ZT2)),ZT3="" Q:ZT2="" F ZT=0:0 S ZT3=$O(^%ZTSCH("LINK",ZT1,ZT2,ZT3)) Q:ZT3="" S ZTP=ZTP+1 I ZT3=ZTSK G L1
52L1 S XUTSK(.15,ZTC)=" "_(ZTP-1)_" task"_$S(ZTP=2:"",1:"s")_" ahead of this one.",ZTC=ZTC+1
53 Q
54 ;
55NOPE L -^%ZTSK(XUTMT) K XUTMT
56 Q
Note: See TracBrowser for help on using the repository browser.