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/ZTM4.m@ 1073

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

initial load of WorldVistAEHR

File size: 2.1 KB
Line 
1%ZTM4 ;SEA/RDS-TaskMan: Manager, (Waiting List) ;06/19/2000 09:32
2 ;;8.0;KERNEL;**1,118,127,162**;Jul 03, 1995
3 ;
4 ;^%ZTSK(ZTSK) must be locked before call
5NQ ;enter a task on the busy device waiting lists
6 N ZT,ZT1,ZT2,ZT3,ZT4,ZT5,ZTHG,ZTI
7 K ^%ZTSK(ZTSK,.26) S ZTHG="" ;L +^%ZTSCH("IO")
8 I ZTIOT'="HG" D I ZTIO(1)="DIRECT" G NQX
9 . I $D(^%ZTSCH("IO",%ZTIO))[0 S ^(%ZTIO)=ZTIOT
10 . S ^%ZTSK(ZTSK,.26,%ZTIO)="",^%ZTSCH("IO",%ZTIO,ZTDTH,ZTSK)=""
11 . I (ZTIO(1)="DIRECT")!('$D(^%ZIS(1,"AHG",ZTIOS))) Q
12 . S ZT2=""
13 . F S ZT2=$O(^%ZIS(1,"AHG",ZTIOS,ZT2)) Q:ZT2="" D NAME,ADD
14 . Q
15 I ZTIOT="HG" S ZT2=ZTIOS D ADD
16 I ZTHG]"" S ^%ZTSK(ZTSK,.26)=ZTHG
17NQX Q
18 ;
19NAME ;NQ--save name of hunt group
20 S ZTS=$G(^%ZIS(1,ZT2,0))
21 S ZTN=$P(ZTS,U) I ZTN="" Q
22 I ZTHG="" S ZTHG=ZTN Q
23 S ZTHG=ZTHG_","_ZTN
24 Q
25 ;
26ADD ;NQ--add the devices in this hunt group to the list the task waits for
27 N ZTI,ZT5 S ZT5=""
28 F S ZT5=$O(^%ZIS(1,ZT2,"HG","B",ZT5)) Q:ZT5="" D
29 .S ZTI=$P($G(^%ZIS(1,ZT5,0)),U,2) ;Get $I
30 .I ZTI="" Q
31 .I $D(^%ZTSCH("IO",ZTI))[0 S ^%ZTSCH("IO",ZTI)=$P($G(^%ZIS(1,ZT5,"TYPE")),"^") ;Get type
32 .S ^%ZTSCH("IO",ZTI,ZTDTH,ZTSK)="",^%ZTSK(ZTSK,.26,ZTI)=""
33 Q
34 ;
35DQ ;Remove A Task From The Busy Device Waiting Lists, TASK is LOCKED
36 N ZT,ZT1,ZTL
37 K ^%ZTSCH("IO",%ZTIO,ZTDTH,ZTSK)
38 S ZT1=""
39 F S ZT1=$O(^%ZTSK(ZTSK,.26,ZT1)) Q:ZT1="" K ^%ZTSCH("IO",ZT1,ZTDTH,ZTSK)
40 K ^%ZTSK(ZTSK,.26) Q
41 ;
42KILL ;POST^%ZTMS4, Call To Delete A Task And Unschedule It Completely
43 ;As long as ^%ZTSK(ZTSK) is locked we can remove any reference.
44 N ZTDTH
45 I $D(^%ZTSK(ZTSK,0))[0 K ^%ZTSK(ZTSK) Q ;No task to work on.
46 S ZTDTH=$G(^%ZTSK(ZTSK,.04)) S:ZTDTH="" ZTDTH=$$H3^%ZTM($P(^%ZTSK(ZTSK,0),U,6))
47 I %ZTIO]"",$D(^%ZTSK(ZTSK,0))#2,$P(^(0),U,6)]"" D DQ
48 K ^%ZTSK(ZTSK)
49 N ZT,ZT1,ZT2 D US
50 Q
51 ;
52US ;Un-Schedule a task from all lists
53 ;S ZT1="" F S ZT1=$O(^%ZTSCH("JOB",ZT1)) Q:ZT1="" I $D(^(ZT1,ZTSK)) K ^(ZTSK)
54 ;S ZT1="" F S ZT1=$O(^%ZTSCH(ZT1)) Q:'ZT1 I $D(^(ZT1,ZTSK)) K ^(ZTSK)
55 K ^%ZTSCH(ZTDTH,ZTSK),^%ZTSCH("JOB",ZTDTH,ZTSK)
56 S ZT1="" F S ZT1=$O(^%ZTSCH("C",ZT1)) Q:ZT1="" K ^%ZTSCH("C",ZT1,ZTDTH,ZTSK)
57 ;Any others??
58 Q
Note: See TracBrowser for help on using the repository browser.