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

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

initial load of FOIAVistA 6/30/08 version

File size: 2.0 KB
Line 
1%ZTLOAD ;ISF/RDS,RWF - TaskMan: Programmer Interface: Entry Points ;07/26/2006
2 ;;8.0;KERNEL;**67,118,127,339,381**;JUL 10, 1995;Build 2
3 ;
4QUEUE ;queue a task (create, schedule) (Entry Point = ^%ZTLOAD)
5 G ^%ZTLOAD1
6 ;
7S(MSG) ;Entry Point: extrinsic variable returns boolean: should task stop?
8 I $G(ZTQUEUED)>.5,$D(^%ZTSCH("TASK",ZTQUEUED)) S ^%ZTSCH("TASK",ZTQUEUED,1)=$H
9 I $D(MSG),$G(ZTQUEUED)>.5 S ^%ZTSK(ZTQUEUED,.11)=MSG
10 N ZTSTOP S ZTSTOP=0
11 I $G(ZTQUEUED)>.5,$L($P($G(^%ZTSK(ZTQUEUED,.1)),"^",10)) S ZTSTOP=1
12 Q ZTSTOP
13 ;
14TM() ;Entry Point: extrinsic variable returns boolean: is TM running?
15 N ZTH,ZTR S ZTH=$H,ZTR=$G(^%ZTSCH("RUN"))
16 Q ZTH-ZTR*86400+$P(ZTH,",",2)-$P(ZTR,",",2)<500
17 ;
18REQ ;Entry Point: requeue a task (edit, reschedule)
19 G ^%ZTLOAD3
20 ;
21KILL ;Entry Point: delete a task
22 S ZTSK=$G(ZTSK)
23 K ZTSK(0) S ZTSK(0)=0
24 I ZTSK>1,$D(^%ZTSK(ZTSK)) D L -^%ZTSK(ZTSK) ;could be done!
25 . L +^%ZTSK(ZTSK):20 Q:'$T
26 . ;Don't kill running persistent tasks.
27 . I $D(^%ZTSCH("ZTSK",ZTSK,"P")) Q
28 . K ^%ZTSK(ZTSK) S ZTSK(0)=1
29 Q
30 ;
31ISQED ;Entry Point: return whether task is pending (scheduled or waiting)
32 G ^%ZTLOAD4
33 ;
34STAT ;Entry Point: return status of a task
35 G ^%ZTLOAD5
36 ;
37DQ ;Entry Point: dequeue a task (unschedule)
38 G ^%ZTLOAD6
39 ;
40DESC(DESC,LST) ;Find tasks with description
41 G DESC^%ZTLOAD5
42 ;
43RTN(RTN,LST) ;Find tasks that call this routine
44 G RTN^%ZTLOAD5
45 ;
46OPTION(OPNM,LST) ;Find tasks for this OPTION.
47 G OPTION^%ZTLOAD5
48 ;
49JOB(ZTM) ;Return the job # for a running task
50 G JOB^%ZTLOAD5
51 ;
52ZTSAVE(%,%1) ;input variables in string delimited by ; to build ZTSAVE array
53 N %2 K:$G(%1) ZTSAVE
54 F %1=1:1 S %2=$P(%,";",%1) Q:%2="" S ZTSAVE(%2)=""
55 Q
56 ;
57PSET(ZTM) ;e.f. Set the persistents node
58 D TN Q:'$D(^%ZTSCH("TASK",ZTM)) 0
59 S ^%ZTSCH("TASK",ZTM,"P")=""
60 Q 1
61 ;
62PCLEAR(ZTM) ;Clear the persistents node
63 D TN Q:'$D(^%ZTSCH("TASK",ZTM))
64 K ^%ZTSCH("TASK",ZTM,"P")
65 Q
66 ;
67ASKSTOP(ZTSK) ;E.F. Ask a task to stop.
68 G ASKSTOP^%ZTLOAD2
69 Q
70 ;
71TN S ZTM=$S($G(ZTM)>0:ZTM,$G(ZTQUEUED)>.9:ZTQUEUED,$G(ZTSK)>0:ZTSK,1:0)
72 Q
Note: See TracBrowser for help on using the repository browser.