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

INHUT8.m

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