ZU ;SFISC/RWF - For MSM-NT and MSM-UNIX, TIE all User terminals to this routine!! ;06/20/2000 11:31 [ 04/02/2003 8:29 AM ]
;;8.0;KERNEL;**1002,1003,1004,1005,1006,1007**;APR 1, 2003
;;8.0;KERNEL;**13,42,49,94,107,162**;Jul 10, 1995
;FOR MSM-NT and MSM-UNIX v4.3 or greater
EN N $ESTACK S $ECODE="",$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
D:+$G(^%ZTSCH("LOGRSRC")) LOGRSRC^%ZOSV("$LOGIN$")
;Bump up the partition size, Task partition size if file 14.7
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 ^XUS ;G ^XUSG:$G(ZUGUI1),^XUS
;
G ;Entry point for GUI device.
S ZUGUI1=1 G EN
;
ERR ;Come here on error.
I $ZE["STKOVR" S $ET="Q:$ST>"_($ST-8)_" D ERR2^ZU" Q
ERR2 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
I $EC'["<INRPT>" S XUERF="",$EC="" G ^XUSCLEAN
CTRLC I $D(IO)=11 U IO(0) C:IO'=IO(0) IO S IO=IO(0)
W !,"--Interrupt Acknowledged",!
D KILL1^XUSCLEAN ;Clean up symbol table
S $ECODE=",U<<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
D:+$G(^%ZTSCH("LOGRSRC")) LOGRSRC^%ZOSV("$LOGOUT$")
I '$ESTACK G CONT
S $ETRAP="D UNWIND^ZU" ;Set new trap
S $ECODE=",U<<HALT>>," ;Cause error to unwind stack
Q
CONT ;
S $ECODE="",$ETRAP=""
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-NT and MSM-UNIX, TIE all User terminals to this routine!! ;06/20/2000 11:31 [ 04/02/2003 8:29 AM ]
+1 ;;8.0;KERNEL;**1002,1003,1004,1005,1006,1007**;APR 1, 2003
+2 ;;8.0;KERNEL;**13,42,49,94,107,162**;Jul 10, 1995
+3 ;FOR MSM-NT and MSM-UNIX v4.3 or greater
EN ;,ZUGUI2=$$GUI()
NEW $ESTACK
SET $ECODE=""
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 IF +$GET(^%ZTSCH("LOGRSRC"))
DO LOGRSRC^%ZOSV("$LOGIN$")
+2 ;Bump up the partition size, Task partition size if file 14.7
+3 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
+4 ;G ^XUSG:$G(ZUGUI1),^XUS
GOTO ^XUS
+5 ;
G ;Entry point for GUI device.
+1 SET ZUGUI1=1
GOTO EN
+2 ;
ERR ;Come here on error.
+1 IF $ZE["STKOVR"
SET $ETRAP="Q:$ST>"_($STACK-8)_" D ERR2^ZU"
QUIT
ERR2 ;Unlock, Turn off break
SET $ETRAP="D UNWIND^ZU"
LOCK
BREAK 0
+1 IF $ECODE["<PROG>"
QUIT
+2 IF $GET(IO)]""
IF $DATA(IO(1,IO))
IF $EXTRACT($GET(IOST))="P"
USE IO
WRITE @$SELECT($DATA(IOF):IOF,1:"#")
+3 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
+4 DO ^%ZTER
+5 IF $ECODE'["<INRPT>"
SET XUERF=""
SET $ECODE=""
GOTO ^XUSCLEAN
CTRLC IF $DATA(IO)=11
USE IO(0)
IF IO'=IO(0)
CLOSE IO
SET IO=IO(0)
+1 WRITE !,"--Interrupt Acknowledged",!
+2 ;Clean up symbol table
DO KILL1^XUSCLEAN
+3 SET $ECODE=",U<<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 +$GET(^%ZTSCH("LOGRSRC"))
DO LOGRSRC^%ZOSV("$LOGOUT$")
+2 IF '$ESTACK
GOTO CONT
+3 ;Set new trap
SET $ETRAP="D UNWIND^ZU"
+4 ;Cause error to unwind stack
SET $ECODE=",U<<HALT>>,"
+5 QUIT
CONT ;
+1 SET $ECODE=""
SET $ETRAP=""
+2 HALT
+3 ;
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