TIUDEV ; SLC/JER - Device Handling Utilities ;6/19/98@16:24:11
;;1.0;TEXT INTEGRATION UTILITIES;**1,20**;Jun 20, 1997
DEVICE(IO,TIUDEV,TIUZIS,TIUSCR,TIUIOP) ; Calls to Device Handler
N %I,%T,%Y,POP,%ZIS,IOP
I $G(TIUDEV)="LAST" S TIUDEV=$$LAST
S:$D(TIUDEV) %ZIS("B")=TIUDEV
S:$G(TIUSCR)]"" %ZIS("S")=TIUSCR
S:$D(TIUIOP) IOP=TIUIOP
S %ZIS=$G(TIUZIS,"Q") D ^%ZIS
I +$G(POP) S ION="" W !,$C(7),"TRY LATER"
Q ION
QUE(ZTRTN,ZTIO) ; Queue output
N %,ZTDTH,ZTSAVE,ZTSK
Q:'$D(ZTRTN) K IO("Q"),ZTSAVE
F %="DA","DFN","TIU*","VALM*","^TMP(""TIURIDX"",$J," S ZTSAVE(%)=""
F %="OR*","^TMP(""OR"",$J," S ZTSAVE(%)=""
S:'$D(ZTDESC) ZTDESC="PRINT DOCUMENTS"
D ^%ZTLOAD W !,$S($D(ZTSK):"Request Queued!",1:"Request Cancelled!")
K ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE D ^%ZISC
S IOP="HOME" D ^%ZIS
Q
LAST() ; Get last device
N TIUDIEN,TIUDNM
S TIUDIEN=$G(^DISV(DUZ,"^%ZIS(1,"))
I +TIUDIEN'>0 S TIUDNM="" G LASTX
I $L($G(^%ZIS(1,+TIUDIEN,"TYPE"))),(";HFS;MT;BAR;VTRM;RES;CHAN;IMPC;"[(";"_^("TYPE")_";")) S TIUDNM="" G LASTX
S TIUDNM=$P($G(^%ZIS(1,TIUDIEN,0)),U)
LASTX Q $G(TIUDNM)
TIUDEV ; SLC/JER - Device Handling Utilities ;6/19/98@16:24:11
+1 ;;1.0;TEXT INTEGRATION UTILITIES;**1,20**;Jun 20, 1997
DEVICE(IO,TIUDEV,TIUZIS,TIUSCR,TIUIOP) ; Calls to Device Handler
+1 NEW %I,%T,%Y,POP,%ZIS,IOP
+2 IF $GET(TIUDEV)="LAST"
SET TIUDEV=$$LAST
+3 IF $DATA(TIUDEV)
SET %ZIS("B")=TIUDEV
+4 IF $GET(TIUSCR)]""
SET %ZIS("S")=TIUSCR
+5 IF $DATA(TIUIOP)
SET IOP=TIUIOP
+6 SET %ZIS=$GET(TIUZIS,"Q")
DO ^%ZIS
+7 IF +$GET(POP)
SET ION=""
WRITE !,$CHAR(7),"TRY LATER"
+8 QUIT ION
QUE(ZTRTN,ZTIO) ; Queue output
+1 NEW %,ZTDTH,ZTSAVE,ZTSK
+2 IF '$DATA(ZTRTN)
QUIT
KILL IO("Q"),ZTSAVE
+3 FOR %="DA","DFN","TIU*","VALM*","^TMP(""TIURIDX"",$J,"
SET ZTSAVE(%)=""
+4 FOR %="OR*","^TMP(""OR"",$J,"
SET ZTSAVE(%)=""
+5 IF '$DATA(ZTDESC)
SET ZTDESC="PRINT DOCUMENTS"
+6 DO ^%ZTLOAD
WRITE !,$SELECT($DATA(ZTSK):"Request Queued!",1:"Request Cancelled!")
+7 KILL ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
DO ^%ZISC
+8 SET IOP="HOME"
DO ^%ZIS
+9 QUIT
LAST() ; Get last device
+1 NEW TIUDIEN,TIUDNM
+2 SET TIUDIEN=$GET(^DISV(DUZ,"^%ZIS(1,"))
+3 IF +TIUDIEN'>0
SET TIUDNM=""
GOTO LASTX
+4 IF $LENGTH($GET(^%ZIS(1,+TIUDIEN,"TYPE")))
IF (";HFS;MT;BAR;VTRM;RES;CHAN;IMPC;"[(";"_^("TYPE")_";"))
SET TIUDNM=""
GOTO LASTX
+5 SET TIUDNM=$PIECE($GET(^%ZIS(1,TIUDIEN,0)),U)
LASTX QUIT $GET(TIUDNM)