source: FOIAVistA/tag/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/XUSCLEAN.m@ 1437

Last change on this file since 1437 was 636, checked in by George Lilly, 15 years ago

WorldVistAEHR overlayed on FOIAVistA

File size: 3.4 KB
Line 
1XUSCLEAN ;SF/STAFF - CLEANUP BEFORE EXIT ;05/26/2005 14:28
2 ;;8.0;KERNEL;**13,59,165,353**;Jul 10, 1995;Build 1
3H ;;Exit point for all R/S applications
4 LOCK ;Unlock any locks
5 S U="^"
6 ;Unwind Exit Actions
7 I $D(^XUTL("XQ",$J,"T")) S %XQEA=^("T") D
8 . F %XQEA1=%XQEA:-1:1 I $D(^XUTL("XQ",$J,%XQEA1)),$P(^(%XQEA1),U,16) S %XQEA2=+^(%XQEA1) I $D(^DIC(19,%XQEA2,15)),$L(^(15)) X ^(15)
9 K %XQEA,%XQEA1,%XQEA2
10 ;Jump if the home device was closed
11 G:$D(IO("C")) H2
12 ;Clear the screen
13 I $S($D(IOST)[0:1,IOST="":1,IOST["C-":1,1:0),'$D(XUERF) W !!!!!!!!!!!!!!!!!!!!!!!
14 I $D(XQNOLOG) W !!,"==> Sorry, all activity on this volume set is being halted! Try again later.",*7,*7,*7,!!!!
15 ;W !!,"Halting at " S X=$P($H,",",2),Y=$E(X#3600\60+100,2,3),X=X\3600,Z=0 S:X>11 Z=1 S:'X X=12 S:X>12 X=X-12 W X,":",Y," ",$S(Z:"pm",1:"am")
16 W !!,"Logged out at "_$$HTE^XLFDT($H,"1FMP")
17 D:$D(DUZ("NEWCODE")) NEWCODE
18 ;NON-R/S exit thru here also.
19H2 ;No talking after this point
20 D C,XUTL
21 ;un-comment the following line if you want FM space recall cleared
22 ;after each session.
23 ;K ^DISV($G(DUZ,0))
24 S:'($D(XQXFLG)#2) XQXFLG="" I $D(XQCH),XQCH="HALT" S $P(XQXFLG,U,3)=""
25 I ($D(XQNOHALT)#2)!($D(ZTQUEUED)#2)!($P(XQXFLG,U,3)="XUP") K XQNOHALT,XQXFLG Q ;Return to REST^XQ12, ^XUP or Taskman.
26 ;This was for modem hang up code. Obsolete now
27 I $D(^%ZIS("H"))#2 X ^("H")
28 ;Go to ZU to do final halt.
29 G HALT^ZU
30 ;
31TOUCH ;SR. API to set the keepalive node, Only set once a day
32 Q:+$G(^XUTL("XQ",$J,"KEEPALIVE"))=+$H
33 S ^XUTL("XQ",$J,"KEEPALIVE")=$H
34 Q
35 ;
36C ;Do device close execute, User exit.
37 N XUDEV
38 S XUDEV=$S($D(^XUTL("XQ",$J,"IOS")):^("IOS"),1:"")
39 D ^%ZISC,BYE
40 Q
41 ;
42 ;Called from Broker, VistaLink, R/S
43BYE ;Set flags to show user has left. Called from anyplace the user exits
44 N DA,DIK,R0,%
45 I $G(^VA(200,+$G(DUZ),1.1)) S $P(^VA(200,DUZ,1.1),"^",3)=0
46 S DA=+$G(^XUTL("XQ",$J,0)) D LOUT(DA)
47 I $D(^XUSEC(0,DA,0)) D
48 . S R0=^XUSEC(0,DA,0)
49 . I $G(IO("IP"))]"",$P(R0,"^",13)]"" S %=$$CMD^XWBCAGNT(.R0,"XWB DELETE HANDLE",$P(R0,"^",13))
50 K ^XUTL("XQ",$J)
51 Q
52 ;
53LOUT(DA) ;Enter log-out time, in Sign-on log
54 N DIK
55 I $D(^XUSEC(0,DA,0)) D
56 . S R0=^(0),$P(^(0),"^",4)=$$NOW^XLFDT,DIK="^XUSEC(0,",DIK(1)="3" D EN1^DIK
57 Q
58 ;
59XUTL ;Cleanup JOB temporary Globals
60 N XQN D CLEAN^DILF ;Cleanup FM too.
61 K ^XUTL($J),^UTILITY($J),^TMP($J)
62 S XQN=" " F S XQN=$O(^XUTL(XQN)) Q:XQN="" K:"^XQO^XGATR^XGKB^"'[XQN ^XUTL(XQN,$J)
63 S XQN=" " F S XQN=$O(^TMP(XQN)) Q:XQN="" K ^TMP(XQN,$J)
64 S XQN=" " F S XQN=$O(^UTILITY(XQN)) Q:XQN="" K:"^ROU^GLO^LRLTR"'[XQN ^UTILITY(XQN,$J)
65 K ^XUTL("ZISPARAM",$I)
66 Q
67 ;
68NEWCODE ;Remind user they changed there VC.
69 W !!,*7,"But, as I recall...",!,"You've changed your VERIFY CODE during this session.",!,"Please remember it for next time." H 4
70 Q
71 ;
72 ;Entry point to clear symbol table
73KILL ;SR. This is what was requested.
74 K %1,%2,%3 S %3=+$G(^XUTL("XQ",$J,"T"))
75 ;See if Menu stack has Variable to protect.
76 F %1=%3:-1:1 S %2=+$G(^XUTL("XQ",$J,%1)),%2=$G(^DIC(19,%2,"NOKILL")) I %2]"" N @%2
77 ;Fall into next part of kill.
78KILL1 ;To clean up ALL but kernel variables.
79 I $$BROKER^XWBLIB S %2=$P($T(VARLST^XWBLIB),";;",2) I %2]"" N @%2 ;Protect Broker variables.
80 N KWAPI,XGWIN,XGDI,XGEVENT
81 N XQAEXIT,XQAUSER,XQX1,XQAKILL,XQAID
82 K (DUZ,DTIME,DT,DISYS,IO,IOBS,IOF,IOM,ION,IOSL,IOST,IOT,IOS,IOXY,U,XRTL,%ZH0,XQVOL,XQY,XQY0,XQDIC,XQPSM,XQPT,XQAUDIT,XQXFLG,ZTSTOP,ZTQUEUED,ZTREQ)
83 K IO("C"),IO("Q")
84 Q
85 ;
86XMR ;Entry point from XUS to DO xmr and cleanup after.
87 D NEXT^XUS1 S XQXFLG="",XQXFLG("HALT")=1 G H2
Note: See TracBrowser for help on using the repository browser.