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/ZTMS7.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: 1.5 KB
RevLine 
[613]1%ZTMS7 ;SEA/RDS-TaskMan: Submanager, (GetNext) ;10 Feb 2003 3:17 pm
2 ;;8.0;KERNEL;**1,118,127,136,275**;Jul 10, 1995;
3 ;
4GETNEXT ;PROCESS--search Device Waiting List for next task waiting for %ZTIO
5 ;check stop node, and claim ownership of Device Waiting List
6 S %ZTIME=$$H3^%ZTM($H)
7 I $D(^%ZTSCH("STOP","SUB",ZTPAIR)) S ZTQUIT=1 G DEALOC8
8 I $D(^%ZTSCH("WAIT","SUB")) G DEALOC8
9 I $O(^%ZTSCH("IO",%ZTIO,0))<1 G DEALOC8
10 S %=$G(^%ZTSCH("IO",%ZTIO))
11 I %'["RES" S X=$$DEVLK^%ZTMS1(1,%ZTIO,3) D:$D(ZTMLOG) LOG("No Lock "_%ZTIO) I 'X G DEALOC8
12 I %["RES" D ^%ZISC ;If a RES close now so open will update
13 S ZTDTH=""
14 ;
15 ;look for task
16G3 S ZTDTH=$O(^%ZTSCH("IO",%ZTIO,ZTDTH)),ZTSK="" I ZTDTH="" G DEALOC8
17G5 S ZTSK=$O(^%ZTSCH("IO",%ZTIO,ZTDTH,ZTSK)) I ZTSK="" G G3
18 L +^%ZTSK(ZTSK):0 G G5:'$T
19 I $D(^%ZTSCH("IO",%ZTIO,ZTDTH,ZTSK))[0 L -^%ZTSK(ZTSK) G G5
20 D DQ^%ZTM4 ;Remove from lists
21 I $D(^%ZTSK(ZTSK,0))[0!'ZTSK D G G5
22 . I ZTSK>0,$D(^%ZTSK(ZTSK)) D TSKSTAT("I","Discarded Because Incomplete")
23 . L -^%ZTSK(ZTSK)
24 I $L($P($G(^%ZTSK(ZTSK,.1)),U,10)) D G G5
25 . D TSKSTAT("D","Stopped by User")
26 . L -^%ZTSK(ZTSK)
27 S ZTQUEUED=.5
28 D:$D(ZTMLOG) LOG("Got "_%ZTIO)
29 Q ;Quit w/ ^%ZTSK(ZTSK) locked
30 ;
31DEALOC8 ;GETNEXT--deallocate device, and set ZTNONEXT
32 D DEVLK^%ZTMS1(-1,%ZTIO)
33 S IO("C")="",IO("T")=1 D ^%ZISC K IO("T"),IO("C")
34 S ZTNONEXT=1,%ZTIO=""
35 L ;Quit w/ all locks clear.
36 Q
37 ;
38LOG(M) ;Log a msg
39 N % S %=$G(^%ZTSCH("L",$J))+1,^($J)=%
40 S ^%ZTSCH("L",$J,%)=M_" ^"_$H
41 Q
42TSKSTAT(CODE,MSG) ; Update task's status
43 S $P(^%ZTSK(ZTSK,.1),U,1,3)=$G(CODE)_U_$H_U_$G(MSG)
44 Q
Note: See TracBrowser for help on using the repository browser.