ANSCZIS ;IHS/OIRM/DSD/CSC - DEVICE CALLS AND QUEUING; [ 02/25/98 10:32 AM ]
;;3.0;NURSING PATIENT ACUITY;;APR 01, 1996
;;ROUTINE USED AS CENTRAL POINT FOR ALL DEVICE HANDLING AND QUEUING
ZIS ;EP;TO CALL DEVICE
K DN
D FS
I $D(ANSCOND) D
.W !!,*7,*7,"The report you are about to print requires either a wide carriage printer or",!,"a printer set for condensed mode with a width of 132 characters."
.W !,"Check with your system manager if you are uncertain which device to select."
K ANSCOND
S %ZIS="NPQ",ZIBH=$TR($H,",","")_$R(1000)
W !
S:$D(ANSREV) IOP="HOME"
D ^%ZIS
I POP>0 D CLOSE Q
S:$G(IOPAR)]"" %ZIS("IOPAR")=IOPAR
S ZTSAVE("%ZIS*")="",ZTSAVE("ZIBH")=""
S ZTRTN="OPEN^ANSCZIS"
I $D(IO("Q")),IO=IO(0)!$D(IO("S")) W !!,*7,"CANNOT QUEUE TO HOME OR SLAVE DEVICE." G ZIS
I $E(IOST,1,2)="P-",'$D(ANSREV) D I $D(ANSQUIT)!$D(ANSOUT) D CLOSE Q
.S DIR(0)="NO^1:99",DIR("A")="Number of Copies",DIR("B")=1
.D DIR^ANSDIC
.I $D(ANSQUIT)!$D(ANSOUT)!'+Y S ANSQUIT="" Q
.S ANSCOPY=+Y
.S ANSPRT=IO ;;CSC 7-97
I '$D(IO("Q")) D D CLOSE Q
.I $E(IOST,1,2)="P-" W !!,"...One moment please, while I complete your print request...",!
.D:$D(ANSRTN) @ZTRTN
E D ZTLOAD
Q
CLOSE ;EP;TO CLOSE DEVICE
D ^%ZISC ;S IO=ANSPRT D ^%ZISC ;;CSC 7-97
K IOP,IOPAR,%ZIS,ZTSK,ANSPRT
Q
ZTLOAD ;EP;TO CALL %ZTLOAD
K ANSDR
S ZTIO=ION,ZTSAVE("ANS*")=""
D ^%ZTLOAD
W !!,$S($G(ZTSK)]"":"Request queued!",1:"Request cancelled.")
D CLOSE
H 2
Q
OPEN ;EP;TO OPEN DEVICE AND PRINT SELECTED REPORT
I '$D(ZTQUEUED)!(ION["HOST") S IOP=ION D ^%ZIS I POP S ANSQUIT="" Q
S ANSPRT=IO ;;CSC 7-97
D @ANSRTN
S:$D(ZTQUEUED) ZTREQ="@"
D:'$D(ZTQUEUED) CLOSE
Q
HOST ;EP;TO OPEN HOST FILE
;%FN - FILE NAME REQUIRED
;ANSOP - 'R' FOR READ, 'W' FOR WRITE REQUIRED, 'M' FOR READ/WRITE
Q:'$D(%FN)!'$D(ANSOP)
F ANSI=1:1:4 S (IOP,ION)="HOST FILE SERVER #"_ANSI,%ZIS("IOPAR")="("""_%FN_""":"""_ANSOP_""")" D ^%ZIS Q:'POP
I POP G HOST
K IOP
Q
FS ;EP;TO CHECK IF WIDE CARRIAGE/CONDENSED PRINTER NEEDED
I $G(ANSDOCDA),$D(^ANSDOC(ANSDOCDA,3)) N X S X=^(3) D
.I $P(X,U,13),'$P(X,U,17) D
..I $P($G(^ANSPO(+$P($G(^ANSDOC(ANSDOCDA,0)),U,8),"DT")),U,10) S X=$P(^("DT"),U,10),(ION,%ZIS("B"))=$P(^%ZIS(1,X,0),U)
..E S ANSCOND=""
.S:$P(X,U,17)=1 ANS3542=""
Q
ANSCZIS ;IHS/OIRM/DSD/CSC - DEVICE CALLS AND QUEUING; [ 02/25/98 10:32 AM ]
+1 ;;3.0;NURSING PATIENT ACUITY;;APR 01, 1996
+2 ;;ROUTINE USED AS CENTRAL POINT FOR ALL DEVICE HANDLING AND QUEUING
ZIS ;EP;TO CALL DEVICE
+1 KILL DN
+2 DO FS
+3 IF $DATA(ANSCOND)
Begin DoDot:1
+4 WRITE !!,*7,*7,"The report you are about to print requires either a wide carriage printer or",!,"a printer set for condensed mode with a width of 132 characters."
+5 WRITE !,"Check with your system manager if you are uncertain which device to select."
End DoDot:1
+6 KILL ANSCOND
+7 SET %ZIS="NPQ"
SET ZIBH=$TRANSLATE($HOROLOG,",","")_$RANDOM(1000)
+8 WRITE !
+9 IF $DATA(ANSREV)
SET IOP="HOME"
+10 DO ^%ZIS
+11 IF POP>0
DO CLOSE
QUIT
+12 IF $GET(IOPAR)]""
SET %ZIS("IOPAR")=IOPAR
+13 SET ZTSAVE("%ZIS*")=""
SET ZTSAVE("ZIBH")=""
+14 SET ZTRTN="OPEN^ANSCZIS"
+15 IF $DATA(IO("Q"))
IF IO=IO(0)!$DATA(IO("S"))
WRITE !!,*7,"CANNOT QUEUE TO HOME OR SLAVE DEVICE."
GOTO ZIS
+16 IF $EXTRACT(IOST,1,2)="P-"
IF '$DATA(ANSREV)
Begin DoDot:1
+17 SET DIR(0)="NO^1:99"
SET DIR("A")="Number of Copies"
SET DIR("B")=1
+18 DO DIR^ANSDIC
+19 IF $DATA(ANSQUIT)!$DATA(ANSOUT)!'+Y
SET ANSQUIT=""
QUIT
+20 SET ANSCOPY=+Y
+21 ;;CSC 7-97
SET ANSPRT=IO
End DoDot:1
IF $DATA(ANSQUIT)!$DATA(ANSOUT)
DO CLOSE
QUIT
+22 IF '$DATA(IO("Q"))
Begin DoDot:1
+23 IF $EXTRACT(IOST,1,2)="P-"
WRITE !!,"...One moment please, while I complete your print request...",!
+24 IF $DATA(ANSRTN)
DO @ZTRTN
End DoDot:1
DO CLOSE
QUIT
+25 IF '$TEST
DO ZTLOAD
+26 QUIT
CLOSE ;EP;TO CLOSE DEVICE
+1 ;S IO=ANSPRT D ^%ZISC ;;CSC 7-97
DO ^%ZISC
+2 KILL IOP,IOPAR,%ZIS,ZTSK,ANSPRT
+3 QUIT
ZTLOAD ;EP;TO CALL %ZTLOAD
+1 KILL ANSDR
+2 SET ZTIO=ION
SET ZTSAVE("ANS*")=""
+3 DO ^%ZTLOAD
+4 WRITE !!,$SELECT($GET(ZTSK)]"":"Request queued!",1:"Request cancelled.")
+5 DO CLOSE
+6 HANG 2
+7 QUIT
OPEN ;EP;TO OPEN DEVICE AND PRINT SELECTED REPORT
+1 IF '$DATA(ZTQUEUED)!(ION["HOST")
SET IOP=ION
DO ^%ZIS
IF POP
SET ANSQUIT=""
QUIT
+2 ;;CSC 7-97
SET ANSPRT=IO
+3 DO @ANSRTN
+4 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+5 IF '$DATA(ZTQUEUED)
DO CLOSE
+6 QUIT
HOST ;EP;TO OPEN HOST FILE
+1 ;%FN - FILE NAME REQUIRED
+2 ;ANSOP - 'R' FOR READ, 'W' FOR WRITE REQUIRED, 'M' FOR READ/WRITE
+3 IF '$DATA(%FN)!'$DATA(ANSOP)
QUIT
+4 FOR ANSI=1:1:4
SET (IOP,ION)="HOST FILE SERVER #"_ANSI
SET %ZIS("IOPAR")="("""_%FN_""":"""_ANSOP_""")"
DO ^%ZIS
IF 'POP
QUIT
+5 IF POP
GOTO HOST
+6 KILL IOP
+7 QUIT
FS ;EP;TO CHECK IF WIDE CARRIAGE/CONDENSED PRINTER NEEDED
+1 IF $GET(ANSDOCDA)
IF $DATA(^ANSDOC(ANSDOCDA,3))
NEW X
SET X=^(3)
Begin DoDot:1
+2 IF $PIECE(X,U,13)
IF '$PIECE(X,U,17)
Begin DoDot:2
+3 IF $PIECE($GET(^ANSPO(+$PIECE($GET(^ANSDOC(ANSDOCDA,0)),U,8),"DT")),U,10)
SET X=$PIECE(^("DT"),U,10)
SET (ION,%ZIS("B"))=$PIECE(^%ZIS(1,X,0),U)
+4 IF '$TEST
SET ANSCOND=""
End DoDot:2
+5 IF $PIECE(X,U,17)=1
SET ANS3542=""
End DoDot:1
+6 QUIT