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

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

initial load of FOIAVistA 6/30/08 version

File size: 3.0 KB
Line 
1%ZTLOAD5 ;SEA/RDS-TaskMan: P I: Task Status ;03/30/2004 17:00
2 ;;8.0;KERNEL;**49,339**;JUL 10, 1995;Build 3
3 ;
4INPUT ;check input parameters for error conditions
5 N %,ZT1,ZT2,ZT3
6 S:$D(ZTSK)[0 ZTSK=""
7 I $D(ZTSK)>1 S %=ZTSK K ZTSK S ZTSK=%
8 S ZTSK(0)=0,ZTSK(1)=0,ZTSK(2)="Undefined"
9 I ZTSK<1!('$D(^%ZTSK(ZTSK,0))) Q
10 L +^%ZTSK(ZTSK) D SEARCH L -^%ZTSK(ZTSK)
11 Q
12 ;
13SEARCH ;search ^%ZTSCH for task
14 I $D(^%ZTSCH("TASK",ZTSK))#2 S ZTSK(0)=1,ZTSK(1)=2,ZTSK(2)="Active: Running" Q
15 S ZT1=0 D Q:ZTSK(0) ;*339
16 . F S ZT1=$O(^%ZTSCH(ZT1)) Q:ZT1'>0 I $D(^%ZTSCH(ZT1,ZTSK))#2 S ZTSK(0)=1,ZTSK(1)=1,ZTSK(2)="Active: Pending" Q
17 S ZT1="" D Q:ZTSK(0)
18 . F S ZT1=$O(^%ZTSCH("IO",ZT1)),ZT2="" Q:ZT1="" D Q:ZTSK(0)
19 . . F S ZT2=$O(^%ZTSCH("IO",ZT1,ZT2)) Q:ZT2="" I $D(^(ZT2,ZTSK))#2 S ZTSK(0)=1,ZTSK(1)=1,ZTSK(2)="Active: Pending" Q
20 S ZT1="" D Q:ZTSK(0)
21 . F S ZT1=$O(^%ZTSCH("JOB",ZT1)) Q:ZT1="" I $D(^(ZT1,ZTSK))#2 S ZTSK(0)=1,ZTSK(1)=1,ZTSK(2)="Active: Pending" Q
22 S ZT1="" D Q:ZTSK(0)
23 . F S ZT1=$O(^%ZTSCH("LINK",ZT1)),ZT2="" Q:ZT1="" D Q:ZTSK(0)
24 . . F S ZT2=$O(^%ZTSCH("LINK",ZT1,ZT2)) Q:ZT2="" I $D(^(ZT2,ZTSK))#2 S ZTSK(0)=1,ZTSK(1)=1,ZTSK(2)="Active: Pending" Q
25 S ZT1=0 D Q:ZTSK(0) ;*339
26 . F S ZT1=$O(^%ZTSCH("C",ZT1)) Q:ZT1'>0 I $D(^(ZT1,ZTSK)) S ZTSK(0)=1,ZTSK(2)="Active: Pending" Q
27 ;
28FLAG ;If we didn't find it in a list, use status flag
29 I $D(^%ZTSK(ZTSK,.1))[0 Q
30 S ZT=$P(^%ZTSK(ZTSK,.1),U),ZTSK(0)=1
31 I ZT=2!(ZT=4) S ZTSK(1)=1,ZTSK(2)="Active: Pending" Q
32 I ZT=6 S ZTSK(1)=3,ZTSK(2)="Inactive: Finished" Q
33 I ZT="H"!(ZT="K") S ZTSK(1)=4,ZTSK(2)="Inactive: Available" Q
34 S ZTSK(1)=5,ZTSK(2)="Inactive: Interrupted"
35 Q
36 ;
37DESC ;Find tasks with matching description.
38 ;From %ZTLOAD input param DESC,LST
39 Q:$G(DESC)=""
40 N ZTSK,X D ENV
41 S:'$D(LST) LST="^TMP($J)" S ZTSK=0
42 F S ZTSK=$O(^%ZTSK(ZTSK)) Q:ZTSK'>0 S X=$G(^%ZTSK(ZTSK,0)) D
43 . Q:$$SKIP()
44 . I $G(^%ZTSK(ZTSK,.03))=DESC S @LST@(ZTSK)=""
45 . Q
46 Q
47RTN ;Find tasks with matching routines
48 ;From %ZTLOAD input param RTN,LST
49 Q:$G(RTN)=""
50 N ZTSK,X D ENV
51 S:'$D(LST) LST="^TMP($J)" S:RTN'["^" RTN="^"_RTN S ZTSK=0
52 F S ZTSK=$O(^%ZTSK(ZTSK)) Q:ZTSK'>0 S X=$G(^%ZTSK(ZTSK,0)) D
53 . Q:$$SKIP()
54 . I $P(X,"^",1,2)=RTN S @LST@(ZTSK)="" Q
55 . I "^"_($P(X,"^",2))=RTN S @LST@(ZTSK)=""
56 . Q
57 Q
58OPTION ;Find tasks with matching option names
59 ;From %ZTLOAD input param OPNM, LST
60 Q:$G(OPNM)="" N ZTSK,X,FLG D ENV
61 S:'$D(LST) LST="^TMP($J)" S ZTSK=0,FLG=(OPNM?1.N1"^"1A.ANP)
62 Q:'FLG&(OPNM'?1A.ANP)
63 F S ZTSK=$O(^%ZTSK(ZTSK)) Q:ZTSK'>0 S X=$G(^%ZTSK(ZTSK,0)) D
64 . Q:$$SKIP()
65 . I FLG,$P(X,"^",8,9)=OPNM S @LST@(ZTSK)="" Q
66 . I $P(X,"^",1,2)="ZTSK^XQ1",$P(X,"^",9)=OPNM S @LST@(ZTSK)=""
67 . Q
68 Q
69SKIP() ;Screen on ZTKEY, UCI, DUZ, return: 0=OK, 1=Skip
70 Q:ZTKEY 0
71 Q:($P(X,U,11)_","_$P(X,U,12))'=ZTUCI 1
72 Q:$P(X,U,3)'=DUZ 1
73 Q 0
74ENV ;Setup
75 S ZTKEY=$D(^XUSEC("ZTMQ",DUZ)),U="^"
76 X ^%ZOSF("UCI") S ZTUCI=Y
77 Q
78 ;
79JOB ;Return JOB # for running task. Called from JOB^ZTLOAD (*339)
80 N Z1,Z2 S Z1=""
81 I $G(ZTM)>0 S Z2=$G(^%ZTSCH("TASK",ZTM)),Z1=$S($L(Z2):$P(Z2,"^",10),1:"")
82 Q Z1
Note: See TracBrowser for help on using the repository browser.