INHUT8 ;JPD, GD ; 13 Feb 97 11:34; ZIS AND DEVICE HELP FOR GIS
;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
;COPYRIGHT 1991-2000 SAIC
ZIS(INRTN,INVARS,INLIM,HDR,INIOM,INIOP) ;Main entry point
; Input:
; INRTN - routine/subroutine that does report output
; INVARS-=Names of variables to pass ZTRTN. Separate names
; with "^". Example: "INTS^INDA(^INTYPE". Or can be array by
; ref. like the ZTSAVE taskman array.
; INLIM - 0 - Allow Queing but not forced 1 - don't allow queing
; 2 - Force queing
; INIOM - Width - Default=80
; INIOP - Force Device selection - See Birp for IOP format
;NEW statements
N %ZIS,A,COUNT,DATA,EXIT,HDR,LOOP,PAGE,X,ZTDESC,ZTIO,ZTRTN,ZTSAVE,IOP
N DIC,Y
S INLIM=+$G(INLIM),INIOM=+$G(INIOM),ZTRTN=$G(INRTN)
S:'INIOM INIOM=80
I $G(INIOP)'="" D
.S IOP=INIOP,%=$P(IOP,";")
.S %=$S(%="Q":3,%="SPOOL":3,$E(IOP,1,8)="Q;SPOOL;":4,1:2)
.S:'$P(IOP,";",%) $P(IOP,";",%)=INIOM
;Device handling & Tasking logic
S %ZIS("B")="",%ZIS="NQ"
D ^%ZIS I POP S IOP="",%ZIS="" D ^%ZIS K DTOUT D CLOSE Q
;Force to specified width even though user specified different
S IOM=INIOM
K ZTIO,ZTUCI,ZTDESC,ZTSK S IOP=ION_";"_$G(IOST)_";"_IOM_";"_IOSL
;
I (INLIM'=1&$D(IO("Q")))!(INLIM=2) Q:IO=IO(0) S ZTDESC="Description of job",ZTIO=IOP D Q
.D ZTSAVE
.D ^%ZTLOAD
.D CLOSE
I INLIM=1,$D(IO("Q")) U 0 W !,"Queing not allowed with this option",!,"report will be sent directly to device",!,*7
D OPENIT I POP D CLOSE Q
I ZTRTN'="" D @ZTRTN
D CLOSE
Q
;
N A
I ($P(IOST,"-")["C")&('$D(IO("Q")))&(IO=IO(0))&(PAGE>0) R !,"Press <RETURN> to continue ",A:DTIME I A[U S EXIT=1 Q
S PAGE=PAGE+1 W @IOF
S A=0 F S A=$O(HDR(A)) Q:'A U IO W !,@HDR(A)
Q
;
WRITE ;output a line
I ($Y>(IOSL-3))&(PAGE>0) D HEADER
Q:EXIT
W !,@DATA
Q
;
;
CLOSE ;exit module
D ^%ZISC
S IOP="",%ZIS="" D ^%ZIS U IO K IO("Q"),IOP,POP
Q
ZTSAVE N I K ZTSAVE
I $D(INVARS)<10 S INVARS=$G(INVARS) D Q
.F I=1:1 S %=$P(INVARS,U,I) Q:%="" S ZTSAVE(%)=""
S I="" F S I=$O(INVARS(I)) Q:I="" S ZTSAVE(I)=INVARS(I)
Q
OPENIT ; Internal routine to open device
S POP=0 S %ZIS="" D ^%ZIS
I POP S IOP="" D ^%ZIS W *7,!?5,"Device busy."
U IO
Q
ZIS2(INDEV,INOUT,DWPNT) ;Lookup for device
;Input:
; INDEV - name of device selected by user
;Output:
; INOUT - Output from lookup
; DWPNT - if it exists will repaint screen
;
N INLIST,%ZIS,POP,ION,IOP
K %ZIS S %ZIS="N"
S (INDEV,INOUT)=$G(INDEV)
I INDEV="SPOOL" D Q
.D MSG^INTSUT2("Spool files not supported at this time")
.S (INDEV,INOUT)=""
Q:INDEV=""
S IOP=INDEV
D ^%ZIS S:'POP INOUT=$G(ION)_";"_$G(IOST)_";"_$G(IOM)_";"_$G(IOSL) I POP D
.S INOUT=$$DISPDEV^%ZIS2(INDEV)
.I INOUT="SPOOL" D
..D MSG^INTSUT2("Spool files not supported at this time")
..S INOUT=""
S DWPNT=1
;kill this to prevent transparent print display on slave device
;K IO("S")
D ^%ZISC
Q
HELP ; This is help for the 'Device: ' prompt field.
; Local variables
; INDEVTYP -- Used for determining whether user wants to see a list
; all devices or just printers. Returned from HDASK^
; 0 = none, 1 - for printers only, 2 - for all devices
;
N INDEVTYP
S INDEVTYP=$$HDASK() ; Generate device type prompts.
I INDEVTYP="^" Q ;Timed out or '^' entered -- QUIT HELP
Q:'INDEVTYP ; INDEVTYP - 1 for printers, 2 - Yes answered to HDASK
; Display list of output devices if INDEVTYP not equal to 0
D PRNTLST(INDEVTYP)
Q
;
;--------------------------------------------------------------------
PRNTLST(INDTYPE) ; Output list of printer devices
; Input:
; INDTYPE --- Filter var used to determine list type.
; Local variables:
; INDONE -- Flag to test when done looping
; INNOPRT -- Flag used to ensure non-printer devices are not
; shown in list of devices.
; INPRDEV -- Used to get data piece to determine if a printer device.
; INDEVNAM -- Name of device as listed in %ZIS cross-ref, 'B'.
; INDEVNUM -- The number of the device as listed in ^%ZIS(1,DEVNUM.
; INYLINE -- Keeps track of Y-cordinate.
; INNODE -- Temp variable to hold node - less disk hits
; INRESULT -- Var to check if user wants to ^ out.
;
N INDONE,INPRDEV,INNOPRT,INDEVNAM,INDEVNUM,INYLINE,INNODE,INRESULT
S INDEVNAM=0,INYLINE=-1,INDONE=0
F Q:INDONE D
.S INDEVNAM=$O(^%ZIS(1,"B",INDEVNAM)) ; Loop through cross-ref of
.I '$L(INDEVNAM) S INDONE=1 Q ; printer devices till end.
.S INDEVNUM=$O(^%ZIS(1,"B",INDEVNAM,0))
.; Piece 2 - is $I, for opening and closing devices
.; Piece 2 = to 46 and 63 are magnetic devices.
.I $L(INDEVNUM),$D(^%ZIS(1,INDEVNUM,0)),'($P(^(0),"^",2)=46!($P(^(0),"^",2)=63)) Q:'$T
.S INNOPRT=0 ; Reset var on whether to skip non-printer data entry
.I INDTYPE=1 D Q:INNOPRT ; INDTYPE=1 -- Printer devices selected
..S INPRDEV=+$P(^%ZIS(1,INDEVNUM,0),"^",12)
..I '$D(^%ZIS(2,INPRDEV,0)) S INNOPRT=1 Q
..I ^%ZIS(2,INPRDEV,0)'?1"P".E S INNOPRT=1 Q
.; Get the node all at once, only once.
.S INNODE=^%ZIS(1,INDEVNUM,0)
.; This piece is the device's name.
.W ?2,$E($P(INNODE,"^",1),1,20)
.; This piece is the location of the terminal.
.W ?26,$E($P($G(^%ZIS(1,INDEVNUM,1)),"^"),1,35)
.; Notify user that this device exist, but is out of service.
.I $P(INNODE,"^",13) W " ** OUT OF SERVICE **"
.; Check to see if page displayed full yet.
.W ! S INYLINE=INYLINE+1
.I INYLINE>$S($D(DIJC("IOSL")):DIJC("IOSL"),1:20) D
..S INRESULT=$$MESS1^UTSRD("Press <RETURN> to continue, or '^' to Stop: ")
..W !
..I INRESULT=1 S INDONE=1 Q
..S INYLINE=-1 Q
Q
;----------------------------------------------------------
HDASK() ;-- Writes the Question prompt to ask for Output Device
; INCHOICE -- User choice for device type
; INQUIT -- Var set if user '^', or timed out
; 0 = normal exit
; 1,2,3 user responded by '^', or was too slow in choice
;
N INCHOICE,INQUIT
W !
D ^UTSRD("Want a list of devices? (Yes/No/Printers) No// ;;;;;;;;;;;;1;INQUIT","","")
S INCHOICE=X W !
; Check that user did not time out or hit '^'
I INQUIT'=0 Q "^"
; Return users choice for device/printer selection
Q $F("PpYy",$E(INCHOICE))\2
DISPDEV(XPARNAM,XX,XY,XD,XW,INPOS) ;old entry point for device help
Q $$DISPDEV^%ZIS2(.XPARNAM,.XX,.XY,.XD,.XW,.INPOS)
INHUT8 ;JPD, GD ; 13 Feb 97 11:34; ZIS AND DEVICE HELP FOR GIS
+1 ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
+2 ;COPYRIGHT 1991-2000 SAIC
ZIS(INRTN,INVARS,INLIM,HDR,INIOM,INIOP) ;Main entry point
+1 ; Input:
+2 ; INRTN - routine/subroutine that does report output
+3 ; INVARS-=Names of variables to pass ZTRTN. Separate names
+4 ; with "^". Example: "INTS^INDA(^INTYPE". Or can be array by
+5 ; ref. like the ZTSAVE taskman array.
+6 ; INLIM - 0 - Allow Queing but not forced 1 - don't allow queing
+7 ; 2 - Force queing
+8 ; INIOM - Width - Default=80
+9 ; INIOP - Force Device selection - See Birp for IOP format
+10 ;NEW statements
+11 NEW %ZIS,A,COUNT,DATA,EXIT,HDR,LOOP,PAGE,X,ZTDESC,ZTIO,ZTRTN,ZTSAVE,IOP
+12 NEW DIC,Y
+13 SET INLIM=+$GET(INLIM)
SET INIOM=+$GET(INIOM)
SET ZTRTN=$GET(INRTN)
+14 IF 'INIOM
SET INIOM=80
+15 IF $GET(INIOP)'=""
Begin DoDot:1
+16 SET IOP=INIOP
SET %=$PIECE(IOP,";")
+17 SET %=$SELECT(%="Q":3,%="SPOOL":3,$EXTRACT(IOP,1,8)="Q;SPOOL;":4,1:2)
+18 IF '$PIECE(IOP,";",%)
SET $PIECE(IOP,";",%)=INIOM
End DoDot:1
+19 ;Device handling & Tasking logic
+20 SET %ZIS("B")=""
SET %ZIS="NQ"
+21 DO ^%ZIS
IF POP
SET IOP=""
SET %ZIS=""
DO ^%ZIS
KILL DTOUT
DO CLOSE
QUIT
+22 ;Force to specified width even though user specified different
+23 SET IOM=INIOM
+24 KILL ZTIO,ZTUCI,ZTDESC,ZTSK
SET IOP=ION_";"_$GET(IOST)_";"_IOM_";"_IOSL
+25 ;
+26 IF (INLIM'=1&$DATA(IO("Q")))!(INLIM=2)
IF IO=IO(0)
QUIT
SET ZTDESC="Description of job"
SET ZTIO=IOP
Begin DoDot:1
+27 DO ZTSAVE
+28 DO ^%ZTLOAD
+29 DO CLOSE
End DoDot:1
QUIT
+30 IF INLIM=1
IF $DATA(IO("Q"))
USE 0
WRITE !,"Queing not allowed with this option",!,"report will be sent directly to device",!,*7
+31 DO OPENIT
IF POP
DO CLOSE
QUIT
+32 IF ZTRTN'=""
DO @ZTRTN
+33 DO CLOSE
+34 QUIT
+35 ;
+1 NEW A
+2 IF ($PIECE(IOST,"-")["C")&('$DATA(IO("Q")))&(IO=IO(0))&(PAGE>0)
READ !,"Press <RETURN> to continue ",A:DTIME
IF A[U
SET EXIT=1
QUIT
+3 SET PAGE=PAGE+1
WRITE @IOF
+4 SET A=0
FOR
SET A=$ORDER(HDR(A))
IF 'A
QUIT
USE IO
WRITE !,@HDR(A)
+5 QUIT
+6 ;
WRITE ;output a line
+1 IF ($Y>(IOSL-3))&(PAGE>0)
DO HEADER
+2 IF EXIT
QUIT
+3 WRITE !,@DATA
+4 QUIT
+5 ;
+6 ;
CLOSE ;exit module
+1 DO ^%ZISC
+2 SET IOP=""
SET %ZIS=""
DO ^%ZIS
USE IO
KILL IO("Q"),IOP,POP
+3 QUIT
ZTSAVE NEW I
KILL ZTSAVE
+1 IF $DATA(INVARS)<10
SET INVARS=$GET(INVARS)
Begin DoDot:1
+2 FOR I=1:1
SET %=$PIECE(INVARS,U,I)
IF %=""
QUIT
SET ZTSAVE(%)=""
End DoDot:1
QUIT
+3 SET I=""
FOR
SET I=$ORDER(INVARS(I))
IF I=""
QUIT
SET ZTSAVE(I)=INVARS(I)
+4 QUIT
OPENIT ; Internal routine to open device
+1 SET POP=0
SET %ZIS=""
DO ^%ZIS
+2 IF POP
SET IOP=""
DO ^%ZIS
WRITE *7,!?5,"Device busy."
+3 USE IO
+4 QUIT
ZIS2(INDEV,INOUT,DWPNT) ;Lookup for device
+1 ;Input:
+2 ; INDEV - name of device selected by user
+3 ;Output:
+4 ; INOUT - Output from lookup
+5 ; DWPNT - if it exists will repaint screen
+6 ;
+7 NEW INLIST,%ZIS,POP,ION,IOP
+8 KILL %ZIS
SET %ZIS="N"
+9 SET (INDEV,INOUT)=$GET(INDEV)
+10 IF INDEV="SPOOL"
Begin DoDot:1
+11 DO MSG^INTSUT2("Spool files not supported at this time")
+12 SET (INDEV,INOUT)=""
End DoDot:1
QUIT
+13 IF INDEV=""
QUIT
+14 SET IOP=INDEV
+15 DO ^%ZIS
IF 'POP
SET INOUT=$GET(ION)_";"_$GET(IOST)_";"_$GET(IOM)_";"_$GET(IOSL)
IF POP
Begin DoDot:1
+16 SET INOUT=$$DISPDEV^%ZIS2(INDEV)
+17 IF INOUT="SPOOL"
Begin DoDot:2
+18 DO MSG^INTSUT2("Spool files not supported at this time")
+19 SET INOUT=""
End DoDot:2
End DoDot:1
+20 SET DWPNT=1
+21 ;kill this to prevent transparent print display on slave device
+22 ;K IO("S")
+23 DO ^%ZISC
+24 QUIT
HELP ; This is help for the 'Device: ' prompt field.
+1 ; Local variables
+2 ; INDEVTYP -- Used for determining whether user wants to see a list
+3 ; all devices or just printers. Returned from HDASK^
+4 ; 0 = none, 1 - for printers only, 2 - for all devices
+5 ;
+6 NEW INDEVTYP
+7 ; Generate device type prompts.
SET INDEVTYP=$$HDASK()
+8 ;Timed out or '^' entered -- QUIT HELP
IF INDEVTYP="^"
QUIT
+9 ; INDEVTYP - 1 for printers, 2 - Yes answered to HDASK
IF 'INDEVTYP
QUIT
+10 ; Display list of output devices if INDEVTYP not equal to 0
+11 DO PRNTLST(INDEVTYP)
+12 QUIT
+13 ;
+14 ;--------------------------------------------------------------------
PRNTLST(INDTYPE) ; Output list of printer devices
+1 ; Input:
+2 ; INDTYPE --- Filter var used to determine list type.
+3 ; Local variables:
+4 ; INDONE -- Flag to test when done looping
+5 ; INNOPRT -- Flag used to ensure non-printer devices are not
+6 ; shown in list of devices.
+7 ; INPRDEV -- Used to get data piece to determine if a printer device.
+8 ; INDEVNAM -- Name of device as listed in %ZIS cross-ref, 'B'.
+9 ; INDEVNUM -- The number of the device as listed in ^%ZIS(1,DEVNUM.
+10 ; INYLINE -- Keeps track of Y-cordinate.
+11 ; INNODE -- Temp variable to hold node - less disk hits
+12 ; INRESULT -- Var to check if user wants to ^ out.
+13 ;
+14 NEW INDONE,INPRDEV,INNOPRT,INDEVNAM,INDEVNUM,INYLINE,INNODE,INRESULT
+15 SET INDEVNAM=0
SET INYLINE=-1
SET INDONE=0
+16 FOR
IF INDONE
QUIT
Begin DoDot:1
+17 ; Loop through cross-ref of
SET INDEVNAM=$ORDER(^%ZIS(1,"B",INDEVNAM))
+18 ; printer devices till end.
IF '$LENGTH(INDEVNAM)
SET INDONE=1
QUIT
+19 SET INDEVNUM=$ORDER(^%ZIS(1,"B",INDEVNAM,0))
+20 ; Piece 2 - is $I, for opening and closing devices
+21 ; Piece 2 = to 46 and 63 are magnetic devices.
+22 IF $LENGTH(INDEVNUM)
IF $DATA(^%ZIS(1,INDEVNUM,0))
IF '($PIECE(^(0),"^",2)=46!($PIECE(^(0),"^",2)=63))
IF '$TEST
QUIT
+23 ; Reset var on whether to skip non-printer data entry
SET INNOPRT=0
+24 ; INDTYPE=1 -- Printer devices selected
IF INDTYPE=1
Begin DoDot:2
+25 SET INPRDEV=+$PIECE(^%ZIS(1,INDEVNUM,0),"^",12)
+26 IF '$DATA(^%ZIS(2,INPRDEV,0))
SET INNOPRT=1
QUIT
+27 IF ^%ZIS(2,INPRDEV,0)'?1"P".E
SET INNOPRT=1
QUIT
End DoDot:2
IF INNOPRT
QUIT
+28 ; Get the node all at once, only once.
+29 SET INNODE=^%ZIS(1,INDEVNUM,0)
+30 ; This piece is the device's name.
+31 WRITE ?2,$EXTRACT($PIECE(INNODE,"^",1),1,20)
+32 ; This piece is the location of the terminal.
+33 WRITE ?26,$EXTRACT($PIECE($GET(^%ZIS(1,INDEVNUM,1)),"^"),1,35)
+34 ; Notify user that this device exist, but is out of service.
+35 IF $PIECE(INNODE,"^",13)
WRITE " ** OUT OF SERVICE **"
+36 ; Check to see if page displayed full yet.
+37 WRITE !
SET INYLINE=INYLINE+1
+38 IF INYLINE>$SELECT($DATA(DIJC("IOSL")):DIJC("IOSL"),1:20)
Begin DoDot:2
+39 SET INRESULT=$$MESS1^UTSRD("Press <RETURN> to continue, or '^' to Stop: ")
+40 WRITE !
+41 IF INRESULT=1
SET INDONE=1
QUIT
+42 SET INYLINE=-1
QUIT
End DoDot:2
End DoDot:1
+43 QUIT
+44 ;----------------------------------------------------------
HDASK() ;-- Writes the Question prompt to ask for Output Device
+1 ; INCHOICE -- User choice for device type
+2 ; INQUIT -- Var set if user '^', or timed out
+3 ; 0 = normal exit
+4 ; 1,2,3 user responded by '^', or was too slow in choice
+5 ;
+6 NEW INCHOICE,INQUIT
+7 WRITE !
+8 DO ^UTSRD("Want a list of devices? (Yes/No/Printers) No// ;;;;;;;;;;;;1;INQUIT","","")
+9 SET INCHOICE=X
WRITE !
+10 ; Check that user did not time out or hit '^'
+11 IF INQUIT'=0
QUIT "^"
+12 ; Return users choice for device/printer selection
+13 QUIT $FIND("PpYy",$EXTRACT(INCHOICE))\2
DISPDEV(XPARNAM,XX,XY,XD,XW,INPOS) ;old entry point for device help
+1 QUIT $$DISPDEV^%ZIS2(.XPARNAM,.XX,.XY,.XD,.XW,.INPOS)