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/ZTLOAD2.m@ 1800

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

initial load of FOIAVistA 6/30/08 version

File size: 2.5 KB
Line 
1%ZTLOAD2 ;SEA/RDS-TaskMan: Queue, Part 2 ;10/19/2005 12:20
2 ;;8.0;KERNEL;**1,67,118,275,339**;Jul 10, 1995;Build 3
3 ;
4REJECT(MSG) ;GET--reject bad task
5 I '$D(ZTQUEUED) W !,"QUEUE INFORMATION MISSING - NOT QUEUED",!,MSG
6 G EXIT
7 ;
8BADDEV(MSG) ;GET--Reject task because of device issue.
9 I '$D(ZTQUEUED) W !,"Queueing not allowed to device -- NOT QUEUED",!,MSG
10EXIT S %ZTLOAD("ERROR")=MSG
11 Q
12 ;
13RESTRCT ;GET--flag tasks with output restricted from certain times; check.
14 I $D(ZTQUEUED) Q
15 S ZTNOGO=0
16 I ZTDTH="@" Q
17 I ZTDTH'?1.5N1","1.5N Q
18 S X=$$HTFM^%ZTLOAD7(ZTDTH) D ^XQ92 I X="" S ZTDTH="" W !,"Sorry--that time is restricted!",!,$C(7)
19 Q
20 ;
21ASK ;GET--ask for start time
22 N %DT,Y
23 I $D(ZTQUEUED) D:ZTDTH]"" Q
24 . S %DT="FRS",X=ZTDTH D ^%DT
25 . S ZTDTH=$$FMTH^%ZTLOAD7(+Y) I Y'>0 S ZTDTH=""
26 . Q
27 S ZTDTH="",%DT="AERSX",%DT("A")="Requested Start Time: ",%DT("B")="NOW",%DT(0)="NOW"
28 I $D(ZTNOGO) D I X="" Q
29 . S Y=+XQY D NEXT^XQ92 I X="" W !,"Output is never allowed from this option!",$C(7),$C(7) Q
30 . S %DT("B")=$$FMTE^%ZTLOAD7(X),%DT="AERSX"
31 . Q
32 I $D(ZTNOGO),'$D(XQNOGO) W !,"Output from this option is restricted during certain times."
33 F ZT=0:0 D ^%DT Q:(Y<0)!'$D(ZTNOGO) S ZT=Y,X=Y D ^XQ92 S Y=ZT Q:X]"" W !!,"That is a restricted time!",!,$C(7)
34 S:Y>0 ZTDTH=$$FMTH^%ZTLOAD7(+Y)
35 K %DT,%T,X5,ZT
36 Q
37 ;
38OPTION ;GET--get option data
39 S ZTA4=$G(ZTSAVE("XQY")) I 'ZTA4 S ZTA4=$G(XQY) I 'ZTA4 S ZTA4=""
40 S ZTA1="O" I 'ZTA4 S ZTA1="" Q
41 S ZTA5=$P($G(^DIC(19,ZTA4,0)),U)
42 Q
43 ;
44ZTKIL ;GET--convert forget time
45 S ZTKIL=$S(ZTKIL?5N:ZTKIL,ZTKIL?5N1","1.5N:ZTKIL,ZTKIL?7N.".".N:$$FMTH^%ZTLOAD7(ZTKIL),1:"")
46 Q
47 ;
48SPOOL ;DEVICE--for predefined ZTIO spool device, pick up IO("DOC") if missing
49 I $G(IO("DOC"))="" Q
50 I ZTIO[IO("DOC") Q
51 I $P(ZTIO,";",2)?.N D
52 .S ZTIO=$P(ZTIO,";")_";"_IO("DOC")_";"_$P(ZTIO,";",2,999)
53 E I $P(ZTIO,";",2)?1.2A1"-"1.ANP,$P(ZTIO,";",3)?.N D
54 .S ZTIO=$P(ZTIO,";",1,2)_";"_IO("DOC")_";"_$P(ZTIO,";",3,999)
55 Q
56 ;
57ASKSTOP ;e.f. Called from ASKSTOP^%ZTLOAD
58 ;Ask a task to stop. Unschedule if not started.
59 N % S ZTSK=$G(ZTSK)
60 S %=$$AKS L -^%ZTSK(ZTSK)
61 Q %
62 ;
63AKS() ;
64 N ZT1,ZT2,ZTDTH,%ZTIO
65 L +^%ZTSK(ZTSK):10 I '$T Q "0^Busy"
66 S ZTSK(0)=$G(^%ZTSK(ZTSK,0)),ZTSK(.1)=$G(^(.1))
67 I ZTSK(0)="" Q "1^Task missing"
68 S $P(^%ZTSK(ZTSK,.1),U,10)=$S($D(ZTNAME)#2:ZTNAME,1:$G(DUZ,.5))
69 I +ZTSK(.1)=6 Q "1^Finished running"
70 I +ZTSK(.1)=5 Q "2^Asked to stop"
71 S ZTDTH=$$H3^%ZTM($P(ZTSK(0),U,6))
72 K ^%ZTSCH(ZTDTH,ZTSK) ;Remove from schedule
73 S %ZTIO=$O(^%ZTSK(ZTSK,.26,"")) I %ZTIO]"" D DQ^%ZTM4 ;Remove from device lists.
74 L -^%ZTSK(ZTSK)
75 Q "2^Unscheduled"
Note: See TracBrowser for help on using the repository browser.