XUPSUTQ ;EDS/GRR - QUEUEING UTILITY (%ZTLOAD) ; 16-JUL-03
;;8.0;KERNEL;**309**;Jul 10, 1995
;
Q1 S ZTDTH=$H
QUE K IO("Q") I '$D(ZTIO),$D(ION),ION="" S ZTIO=""
I '$D(ZTDESC) S ZTDESC=$S($D(XUPSPGM):XUPSPGM,$D(PGM):PGM,1:"KERNEL UNKNOWN OPTION")
I '$D(ZTRTN) S ZTRTN=$S($D(XUPSPGM):XUPSPGM,$D(PGM):PGM,1:"") G:XUPSPGM="" CLOSE S ZTRTN="DQ^XUPSUTQ"
I $D(XUPSPGM),'$D(ZTLOAD(XUPSPGM)) S ZTSAVE("XUPSPGM")=""
LOAD D ^%ZTLOAD W !!,$S($D(ZTSK):"Request Queued!",1:"Request Cancelled!") S:'$D(ZTSK) X="^" S:$D(ZTSK) X="" G CLOSE:$D(ZTSK),END
Q
ZIS W ! K IOP,IO("Q") S POP=0,%ZIS="QMP" D ^%ZIS K %ZIS,IOP Q:POP I $D(IO("Q")) D QUE S POP=1 G CLOSE
U IO
Q
CLOSE Q:$D(ZTQUEUED) N POP D ^%ZISC
END K ZTSK,ZTDESC,ZTRTN,ZTREQ,ZTSAVE,ZTIO,ZTDTH,ZTUCI,XUPSPGM,PGM,IO("Q"),IO("C")
Q
DQ D @($S($D(XUPSPGM):XUPSPGM,$D(PGM):PGM,1:"CLOSE"))
D KILL^%ZTLOAD,CLOSE
Q
DTQ N XUPSX,Z,X,%H I $D(ZTSK("D")) S XUPSX=ZTSK("D"),%H=$P(XUPSX,",") D YMD^%DTC S XUPSX=$P(XUPSX,",",2),Z=X_((XUPSX#3600\60)/100+(XUPSX\3600)/100) ;Find time queued
Q
XUPSUTQ ;EDS/GRR - QUEUEING UTILITY (%ZTLOAD) ; 16-JUL-03
+1 ;;8.0;KERNEL;**309**;Jul 10, 1995
+2 ;
Q1 SET ZTDTH=$HOROLOG
QUE KILL IO("Q")
IF '$DATA(ZTIO)
IF $DATA(ION)
IF ION=""
SET ZTIO=""
+1 IF '$DATA(ZTDESC)
SET ZTDESC=$SELECT($DATA(XUPSPGM):XUPSPGM,$DATA(PGM):PGM,1:"KERNEL UNKNOWN OPTION")
+2 IF '$DATA(ZTRTN)
SET ZTRTN=$SELECT($DATA(XUPSPGM):XUPSPGM,$DATA(PGM):PGM,1:"")
IF XUPSPGM=""
GOTO CLOSE
SET ZTRTN="DQ^XUPSUTQ"
+3 IF $DATA(XUPSPGM)
IF '$DATA(ZTLOAD(XUPSPGM))
SET ZTSAVE("XUPSPGM")=""
LOAD DO ^%ZTLOAD
WRITE !!,$SELECT($DATA(ZTSK):"Request Queued!",1:"Request Cancelled!")
IF '$DATA(ZTSK)
SET X="^"
IF $DATA(ZTSK)
SET X=""
IF $DATA(ZTSK)
GOTO CLOSE
GOTO END
+1 QUIT
ZIS WRITE !
KILL IOP,IO("Q")
SET POP=0
SET %ZIS="QMP"
DO ^%ZIS
KILL %ZIS,IOP
IF POP
QUIT
IF $DATA(IO("Q"))
DO QUE
SET POP=1
GOTO CLOSE
+1 USE IO
+2 QUIT
CLOSE IF $DATA(ZTQUEUED)
QUIT
NEW POP
DO ^%ZISC
END KILL ZTSK,ZTDESC,ZTRTN,ZTREQ,ZTSAVE,ZTIO,ZTDTH,ZTUCI,XUPSPGM,PGM,IO("Q"),IO("C")
+1 QUIT
DQ DO @($SELECT($DATA(XUPSPGM):XUPSPGM,$DATA(PGM):PGM,1:"CLOSE"))
+1 DO KILL^%ZTLOAD
DO CLOSE
+2 QUIT
DTQ ;Find time queued
NEW XUPSX,Z,X,%H
IF $DATA(ZTSK("D"))
SET XUPSX=ZTSK("D")
SET %H=$PIECE(XUPSX,",")
DO YMD^%DTC
SET XUPSX=$PIECE(XUPSX,",",2)
SET Z=X_((XUPSX#3600\60)/100+(XUPSX\3600)/100)
+1 QUIT