ZU ;SF/RWF - For Cache and Open M! ;06/13/2006
;;8.0;KERNEL;**34,94,118,162,170,225,419**;Jul 10, 1995;Build 5
;TIE ALL TERMINALS EXCEPT CONSOLE TO THIS ROUTINE!
EN N $ES,$ETRAP S $ETRAP="D ERR^ZU Q:$QUIT -9 Q"
D:+$G(^%ZTSCH("LOGRSRC")) LOGRSRC^%ZOSV("$LOGIN$")
;The next line keeps sign-on users from taking the last slot
;It can be commented out if not needed.
I $$AVJ^%ZOSV()<3 W $C(7),!!,"** TROUBLE ** - NO AVALIABLE JOBS ** CALL IRM NOW! **" G HALT
;Only call ShareLic for Telnet connections.
I ($I["|TNT|")!($I["TNA") D SHARELIC^%ZOSV(0)
G ^XUS
;
;
ERR ;Come here on error
; Try and handle stack overflow errors specifically
I $ZE["STACK" S $ET="Q:$ST>"_($ST-8)_" D ERR2^ZU" Q
ERR2 ;
S $ET="D UNWIND^ZU" L ;Backup trap (419)
Q:$ECODE["<PROG>"
;
D ^%ZTER K %ZT ; Capture symbol table first!
;
I $G(IO)]"",$D(IO(1,IO)),$E($G(IOST))="P" D
. U IO
. W @$S($D(IOF):IOF,1:"#")
I $G(IO(0))]"" D
. U IO(0)
. W !!,"RECORDING THAT AN ERROR OCCURRED ---"
. W !!?15,"Sorry 'bout that"
. W !,*7
. W !?10,"$STACK=",$STACK," $ECODE=",$ECODE
. W !?10,"$ZERROR=",$ZERROR
;
I $G(DUZ)'>0 G HALT
X ^%ZOSF("PROGMODE") Q:Y
S $ET="D HALT^ZU" ;419
I $ZE'["<INTERRUPT>" S XUERF="" G ^XUSCLEAN ;419
CTRLC I $D(IO)=11 U IO(0) W !,"--Interrupt Acknowledged",!
D KILL1^XUSCLEAN ;Clean up symbol table
S $ECODE=",U55,"
Q
;
UNWIND ;Unwind the stack
Q:$ESTACK>1 G CTRLC2:$ECODE["U55"
S $ECODE=""
Q
;
CTRLC2 S $ECODE="" G:$G(^XUTL("XQ",$J,"T"))<2 ^XUSCLEAN
S ^XUTL("XQ",$J,"T")=1,XQY=^(1),XQY0=$P(XQY,"^",2,99)
G:$P(XQY0,"^",4)'="M" HALT
S XQPSM=$P(XQY,"^",1),XQY=+XQPSM,XQPSM=$P(XQPSM,XQY,2,3)
G:'XQY ^XUSCLEAN
S $ECODE="",$ETRAP="D ERR^ZU"
G M1^XQ
;
HALT S $ECODE="" I $D(^XUTL("XQ",$J)) D BYE^XUSCLEAN
D:+$G(^%ZTSCH("LOGRSRC")) LOGRSRC^%ZOSV("$LOGOUT$")
HALT
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HZUONT 1851 printed Nov 22, 2024@17:26:51 Page 2
ZU ;SF/RWF - For Cache and Open M! ;06/13/2006
+1 ;;8.0;KERNEL;**34,94,118,162,170,225,419**;Jul 10, 1995;Build 5
+2 ;TIE ALL TERMINALS EXCEPT CONSOLE TO THIS ROUTINE!
EN NEW $ESTACK,$ETRAP
SET $ETRAP="D ERR^ZU Q:$QUIT -9 Q"
+1 if +$GET(^%ZTSCH("LOGRSRC"))
DO LOGRSRC^%ZOSV("$LOGIN$")
+2 ;The next line keeps sign-on users from taking the last slot
+3 ;It can be commented out if not needed.
+4 IF $$AVJ^%ZOSV()<3
WRITE $CHAR(7),!!,"** TROUBLE ** - NO AVALIABLE JOBS ** CALL IRM NOW! **"
GOTO HALT
+5 ;Only call ShareLic for Telnet connections.
+6 IF ($IO["|TNT|")!($IO["TNA")
DO SHARELIC^%ZOSV(0)
+7 GOTO ^XUS
+8 ;
+9 ;
ERR ;Come here on error
+1 ; Try and handle stack overflow errors specifically
+2 IF $ZE["STACK"
SET $ETRAP="Q:$ST>"_($STACK-8)_" D ERR2^ZU"
QUIT
ERR2 ;
+1 ;Backup trap (419)
SET $ETRAP="D UNWIND^ZU"
LOCK
+2 if $ECODE["<PROG>"
QUIT
+3 ;
+4 ; Capture symbol table first!
DO ^%ZTER
KILL %ZT
+5 ;
+6 IF $GET(IO)]""
IF $DATA(IO(1,IO))
IF $EXTRACT($GET(IOST))="P"
Begin DoDot:1
+7 USE IO
+8 WRITE @$SELECT($DATA(IOF):IOF,1:"#")
End DoDot:1
+9 IF $GET(IO(0))]""
Begin DoDot:1
+10 USE IO(0)
+11 WRITE !!,"RECORDING THAT AN ERROR OCCURRED ---"
+12 WRITE !!?15,"Sorry 'bout that"
+13 WRITE !,*7
+14 WRITE !?10,"$STACK=",$STACK," $ECODE=",$ECODE
+15 WRITE !?10,"$ZERROR=",$ZERROR
End DoDot:1
+16 ;
+17 IF $GET(DUZ)'>0
GOTO HALT
+18 XECUTE ^%ZOSF("PROGMODE")
if Y
QUIT
+19 ;419
SET $ETRAP="D HALT^ZU"
+20 ;419
IF $ZE'["<INTERRUPT>"
SET XUERF=""
GOTO ^XUSCLEAN
CTRLC IF $DATA(IO)=11
USE IO(0)
WRITE !,"--Interrupt Acknowledged",!
+1 ;Clean up symbol table
DO KILL1^XUSCLEAN
+2 SET $ECODE=",U55,"
+3 QUIT
+4 ;
UNWIND ;Unwind the stack
+1 if $ESTACK>1
QUIT
if $ECODE["U55"
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=^(1)
SET XQY0=$PIECE(XQY,"^",2,99)
+2 if $PIECE(XQY0,"^",4)'="M"
GOTO HALT
+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="D ERR^ZU"
+6 GOTO M1^XQ
+7 ;
HALT SET $ECODE=""
IF $DATA(^XUTL("XQ",$JOB))
DO BYE^XUSCLEAN
+1 if +$GET(^%ZTSCH("LOGRSRC"))
DO LOGRSRC^%ZOSV("$LOGOUT$")
+2 HALT
+3 ;