ZU ;SFISC/RWF - For MSM, TIE ALL TERMINALS EXCEPT CONSOLE TO THIS ROUTINE!! ;01/20/98 13:21 [ 04/02/2003 8:29 AM ]
;;8.0;KERNEL;**1004,1005,1007**;APR 1, 2003
;;8.0;KERNEL;**13,42,49**;Jul 10, 1995
;FOR MSM-NT and MSM-UNIX v4.3 or greater
EN S $ETRAP="D ERR^ZU Q:$QUIT 0 Q" ;,ZUGUI2=$$GUI()
;The next line keeps sign-on users from taking the last slot
;It can be commented out if not needed.
JOBCHK X ^%ZOSF("AVJ") I Y<3 W $C(7),!!,"** TROUBLE ** - ** CALL IRM NOW! **" G HALT
;Bump up the partition size
D GETENV^%ZOSV S Y=$P(Y,"^",4),%=$O(^%ZIS(14.7,"B",Y,0)),Y=$G(^%ZIS(14.7,+%,0)),%K=$P(Y,"^",5) I %K>0 D INT^%PARTSIZ
G ^XUSG:$G(ZUGUI1),^XUS
;
G ;Entry point for GUI device.
S ZUGUI1=1 G EN
;
ERR ;Come here on error.
S $ETRAP="D UNWIND^ZU" L B 0 ;Unlock, Turn off break
Q:$ECODE["<PROG>"
I $G(IO)]"",$D(IO(1,IO)),$E($G(IOST))="P" U IO W @$S($D(IOF):IOF,1:"#")
I $G(IO(0))]"" U IO(0) W !!,"RECORDING THAT AN ERROR OCCURRED ---",!!?15,"Sorry 'bout that",!,*7,!?10,"$STACK=",$STACK,"$ECODE=",$ECODE,!?10,"$ZERROR=",$ZERROR
D ^%ZTER
X ^%ZOSF("PROGMODE") Q:Y S $ZT="HALT^ZU"
I $ZE'["<INRPT>" S XUERF="" G ^XUSCLEAN
CTRLC I $D(IO)=11 U IO(0) C:IO'=IO(0) IO S IO=IO(0)
W:$ZE["-CTLC" !,"--Interrupt Acknowledged",!
D KILL1^XUSCLEAN ;Clean up symbol table
S $ECODE=",<<POP>>,"
Q
;
UNWIND ;Unwind the stack
Q:$ESTACK>1 G CONT:$ECODE["<<HALT>>",CTRLC2:$ECODE["<<POP>>"
S $ECODE=""
Q
;
CTRLC2 S $ECODE="" G:$G(^XUTL("XQ",$J,"T"))<2 ^XUSCLEAN
S ^XUTL("XQ",$J,"T")=1,XQY=$G(^(1)),XQY0=$P(XQY,"^",2,99)
G:$P(XQY0,"^",4)'="M" CTRLC2
S XQPSM=$P(XQY,"^",1),XQY=+XQPSM,XQPSM=$P(XQPSM,XQY,2,3)
G:'XQY ^XUSCLEAN
S $ECODE="",$ETRAP="S %ZTER11S=$STACK D ERR^ZU Q:$QUIT 0 Q" G M1^XQ
;
HALT I $D(^XUTL("XQ",$J)) D:$D(DUZ)#2 BYE^XUSCLEAN
I '$ESTACK G CONT
S $ETRAP="D UNWIND^ZU" ;Set new trap
S $ECODE=",<<HALT>>," ;Cause error to unwind stack
Q
CONT ;
S $ECODE="",$ETRAP=""
I $D(^XTV(8989.3,1,"XUCP")),^("XUCP")="Y" D LOGRSRC^%ZOSV("DSMOUT")
HALT
;
GUI() ;Test if under GUI
Q "" ;Just say No.
S $ZT="GUIX",X="" G:$PD'=1 GUIX
S X=$G(^$DI($PD,"PLATFORM"))
GUIX Q X
ZU ;SFISC/RWF - For MSM, TIE ALL TERMINALS EXCEPT CONSOLE TO THIS ROUTINE!! ;01/20/98 13:21 [ 04/02/2003 8:29 AM ]
+1 ;;8.0;KERNEL;**1004,1005,1007**;APR 1, 2003
+2 ;;8.0;KERNEL;**13,42,49**;Jul 10, 1995
+3 ;FOR MSM-NT and MSM-UNIX v4.3 or greater
EN ;,ZUGUI2=$$GUI()
SET $ETRAP="D ERR^ZU Q:$QUIT 0 Q"
+1 ;The next line keeps sign-on users from taking the last slot
+2 ;It can be commented out if not needed.
JOBCHK XECUTE ^%ZOSF("AVJ")
IF Y<3
WRITE $CHAR(7),!!,"** TROUBLE ** - ** CALL IRM NOW! **"
GOTO HALT
+1 ;Bump up the partition size
+2 DO GETENV^%ZOSV
SET Y=$PIECE(Y,"^",4)
SET %=$ORDER(^%ZIS(14.7,"B",Y,0))
SET Y=$GET(^%ZIS(14.7,+%,0))
SET %K=$PIECE(Y,"^",5)
IF %K>0
DO INT^%PARTSIZ
+3 IF $GET(ZUGUI1)
GOTO ^XUSG
GOTO ^XUS
+4 ;
G ;Entry point for GUI device.
+1 SET ZUGUI1=1
GOTO EN
+2 ;
ERR ;Come here on error.
+1 ;Unlock, Turn off break
SET $ETRAP="D UNWIND^ZU"
LOCK
BREAK 0
+2 IF $ECODE["<PROG>"
QUIT
+3 IF $GET(IO)]""
IF $DATA(IO(1,IO))
IF $EXTRACT($GET(IOST))="P"
USE IO
WRITE @$SELECT($DATA(IOF):IOF,1:"#")
+4 IF $GET(IO(0))]""
USE IO(0)
WRITE !!,"RECORDING THAT AN ERROR OCCURRED ---",!!?15,"Sorry 'bout that",!,*7,!?10,"$STACK=",$STACK,"$ECODE=",$ECODE,!?10,"$ZERROR=",$ZERROR
+5 DO ^%ZTER
+6 XECUTE ^%ZOSF("PROGMODE")
IF Y
QUIT
SET $ZT="HALT^ZU"
+7 IF $ZE'["<INRPT>"
SET XUERF=""
GOTO ^XUSCLEAN
CTRLC IF $DATA(IO)=11
USE IO(0)
IF IO'=IO(0)
CLOSE IO
SET IO=IO(0)
+1 IF $ZE["-CTLC"
WRITE !,"--Interrupt Acknowledged",!
+2 ;Clean up symbol table
DO KILL1^XUSCLEAN
+3 SET $ECODE=",<<POP>>,"
+4 QUIT
+5 ;
UNWIND ;Unwind the stack
+1 IF $ESTACK>1
QUIT
IF $ECODE["<<HALT>>"
GOTO CONT
IF $ECODE["<<POP>>"
GOTO CTRLC2
+2 SET $ECODE=""
+3 QUIT
+4 ;
CTRLC2 SET $ECODE=""
IF $GET(^XUTL("XQ",$JOB,"T"))<2
GOTO ^XUSCLEAN
+1 SET ^XUTL("XQ",$JOB,"T")=1
SET XQY=$GET(^(1))
SET XQY0=$PIECE(XQY,"^",2,99)
+2 IF $PIECE(XQY0,"^",4)'="M"
GOTO CTRLC2
+3 SET XQPSM=$PIECE(XQY,"^",1)
SET XQY=+XQPSM
SET XQPSM=$PIECE(XQPSM,XQY,2,3)
+4 IF 'XQY
GOTO ^XUSCLEAN
+5 SET $ECODE=""
SET $ETRAP="S %ZTER11S=$STACK D ERR^ZU Q:$QUIT 0 Q"
GOTO M1^XQ
+6 ;
HALT IF $DATA(^XUTL("XQ",$JOB))
IF $DATA(DUZ)#2
DO BYE^XUSCLEAN
+1 IF '$ESTACK
GOTO CONT
+2 ;Set new trap
SET $ETRAP="D UNWIND^ZU"
+3 ;Cause error to unwind stack
SET $ECODE=",<<HALT>>,"
+4 QUIT
CONT ;
+1 SET $ECODE=""
SET $ETRAP=""
+2 IF $DATA(^XTV(8989.3,1,"XUCP"))
IF ^("XUCP")="Y"
DO LOGRSRC^%ZOSV("DSMOUT")
+3 HALT
+4 ;
GUI() ;Test if under GUI
+1 ;Just say No.
QUIT ""
+2 SET $ZT="GUIX"
SET X=""
IF $PDISPLAY'=1
GOTO GUIX
+3
*** ERROR ***
SET X=$GET(^$DI($PDISPLAY,"PLATFORM"))
GUIX QUIT X