Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ZTMS7

ZTMS7.m

Go to the documentation of this file.
  1. %ZTMS7 ;SEA/RDS-TaskMan: Submanager, (GetNext) ;10 Feb 2003 3:17 pm
  1. ;;8.0;KERNEL;**1,118,127,136,275**;Jul 10, 1995;
  1. ;
  1. GETNEXT ;PROCESS--search Device Waiting List for next task waiting for %ZTIO
  1. ;check stop node, and claim ownership of Device Waiting List
  1. S %ZTIME=$$H3^%ZTM($H)
  1. I $D(^%ZTSCH("STOP","SUB",ZTPAIR)) S ZTQUIT=1 G DEALOC8
  1. I $D(^%ZTSCH("WAIT","SUB")) G DEALOC8
  1. I $O(^%ZTSCH("IO",%ZTIO,0))<1 G DEALOC8
  1. S %=$G(^%ZTSCH("IO",%ZTIO))
  1. I %'["RES" S X=$$DEVLK^%ZTMS1(1,%ZTIO,3) D:$D(ZTMLOG) LOG("No Lock "_%ZTIO) I 'X G DEALOC8
  1. I %["RES" D ^%ZISC ;If a RES close now so open will update
  1. S ZTDTH=""
  1. ;
  1. ;look for task
  1. G3 S ZTDTH=$O(^%ZTSCH("IO",%ZTIO,ZTDTH)),ZTSK="" I ZTDTH="" G DEALOC8
  1. G5 S ZTSK=$O(^%ZTSCH("IO",%ZTIO,ZTDTH,ZTSK)) I ZTSK="" G G3
  1. L +^%ZTSK(ZTSK):0 G G5:'$T
  1. I $D(^%ZTSCH("IO",%ZTIO,ZTDTH,ZTSK))[0 L -^%ZTSK(ZTSK) G G5
  1. D DQ^%ZTM4 ;Remove from lists
  1. I $D(^%ZTSK(ZTSK,0))[0!'ZTSK D G G5
  1. . I ZTSK>0,$D(^%ZTSK(ZTSK)) D TSKSTAT("I","Discarded Because Incomplete")
  1. . L -^%ZTSK(ZTSK)
  1. I $L($P($G(^%ZTSK(ZTSK,.1)),U,10)) D G G5
  1. . D TSKSTAT("D","Stopped by User")
  1. . L -^%ZTSK(ZTSK)
  1. S ZTQUEUED=.5
  1. D:$D(ZTMLOG) LOG("Got "_%ZTIO)
  1. Q ;Quit w/ ^%ZTSK(ZTSK) locked
  1. ;
  1. DEALOC8 ;GETNEXT--deallocate device, and set ZTNONEXT
  1. D DEVLK^%ZTMS1(-1,%ZTIO)
  1. S IO("C")="",IO("T")=1 D ^%ZISC K IO("T"),IO("C")
  1. S ZTNONEXT=1,%ZTIO=""
  1. L ;Quit w/ all locks clear.
  1. Q
  1. ;
  1. LOG(M) ;Log a msg
  1. N % S %=$G(^%ZTSCH("L",$J))+1,^($J)=%
  1. S ^%ZTSCH("L",$J,%)=M_" ^"_$H
  1. Q
  1. TSKSTAT(CODE,MSG) ; Update task's status
  1. S $P(^%ZTSK(ZTSK,.1),U,1,3)=$G(CODE)_U_$H_U_$G(MSG)
  1. Q