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

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

initial load of FOIAVistA 6/30/08 version

File size: 3.0 KB
Line 
1XUP ;SFISC/RWF - Setup enviroment for programmers ;10/12/06 12:45
2 ;;8.0;KERNEL;**208,258,284,432**;Jul 10, 1995;Build 3
3 W !,"Setting up programmer environment"
4 S U="^",$ECODE="",$ETRAP="" ;Clear error and error trap
5 X ^%ZOSF("TYPE-AHEAD")
6 ;Check if Production and report
7 W !,"This is a "_$S($$PROD^XUPROD(1):"PRODUCTION",1:"TEST")_" account.",!
8 ;
9 K ^UTILITY($J),^XUTL("XQ",$J) D KILL1^XUSCLEAN
10 S U="^",DT=$$DT^XLFDT
11 S XUEOFF=^%ZOSF("EOFF"),XUEON=^%ZOSF("EON"),U="^",XUTT=0,XUIOP=""
12 D GETENV^%ZOSV S XUENV=Y,XUVOL=$P(Y,U,2),XUCI=$P(Y,U,1)
13 ;Reset DUZ if user "Switched Identities".
14 I $D(DUZ("SAV")) S DUZ=+DUZ("SAV"),DUZ(0)=$P(DUZ("SAV"),U,2) K DUZ("SAV")
15 ;Get user info
16 I $G(DUZ)>.5,$D(^VA(200,DUZ,0))[0 K DUZ W !,"DUZ Must point to a real user." G EXIT ;p432
17 I $G(DUZ)>0 D DUZ(DUZ)
18 I $G(DUZ)'>0!('$D(DUZ(0))) D ASKDUZ G:Y'>0 EXIT
19 I '$D(XQUSER) S XQUSER=$S($D(^VA(200,DUZ,20)):$P(^(20),"^",2),1:"Unk")
20 S DTIME=600 ;Set a temp DTIME
21 S DILOCKTM=+$G(^DD("DILOCKTM"),1) ;p432
22 ;Getting Terminal Type
23ZIS I XUTT D ENQ^XUS1 G:$D(XUIOP(1)) ZIS2 S Y=0 D TT^XUS3 I Y>0 S XUIOP(1)=$P(XUIOP,";",2) G ZIS2
24 S X="`"_+$G(^VA(200,DUZ,1.2)),DIC="^%ZIS(2,",DIC(0)="MQ"_$S(X]"`0":"",1:"AE") D ^DIC G:Y'>0 EXIT
25 S XUIOP(1)=$P(Y,U,2) I DIC(0)["A",$G(^VA(200,+DUZ,0))]"" S $P(^VA(200,DUZ,1.2),U,1)=+Y
26ZIS2 S %ZIS="L",IOP="HOME;"_XUIOP(1) D ^%ZIS G EXIT:POP W !,"Terminal Type set to: ",IOST,!
27 S DTIME=$$DTIME(DUZ,IOS),DUZ("BUF")=1,XUDEV=IOS
28 ;Save info, Set last sign-on
29 D SAVE^XUS1 S $P(^VA(200,DUZ,1.1),"^",1)=$$NOW^XLFDT
30 ;Check Mail
31 S Y=$P($G(^XMB(3.7,DUZ,0)),U,6) I Y W !,"You have "_Y_" new message"_$S(Y=1:"",1:"s")_"."
32 ;Setup error trap
33 I $$GET^XPAR("USR^SYS","XUS-XUP SET ERROR TRAP",1,"Q") S $ETRAP="D ERR^XUP"
34 D KILL1^XUSCLEAN S $P(XQXFLG,U,3)="XUP" D ^XQ1
35EXIT ;Clean-up and exit
36 D KILL1^XUSCLEAN K XQY,XQY0
37 I $G(DUZ)>0,$$GET^XPAR("USR^SYS","XUS-XUP VPE",1,"Q"),$D(^%ZVEMS) X ^%ZVEMS ;Run VPE
38 Q
39 ;
40ASKDUZ ;Ask for Access Code
41 N X
42 ;X XUEOFF S DIR(0)="FO",DIR("A")="Access Code" D ^DIR W ! X XUEON I $D(DIRUT) S Y=-1 Q
43 X XUEOFF W !,"Access Code: " S X=$$ACCEPT^XUS() X XUEON
44 I X["^"!('$L(X)) S Y=-1 Q
45 S X=$$UP^XLFSTR(X) S:X[":" XUTT=1,X=$P(X,":",1)_$P(X,":",2)
46 D ^XUSHSH S Y=$O(^VA(200,"A",X,0))
47 K DUZ D DUZ(+Y)
48 Q
49 ;
50DUZ(DA) ;Build DUZ for a user. Used by Mailman.
51 ;(p284) Make the setting of several DUZ parts conditional.
52 N Y
53 S Y(0)=$G(^VA(200,+DA,0)),Y("XUS")=$G(^XTV(8989.3,1,"XUS"))
54 S DUZ=DA
55 S:$G(DUZ(0))'="@" DUZ(0)=$P(Y(0),"^",4)
56 S DUZ(1)="",DUZ("AG")=$P($G(^XTV(8989.3,1,0)),"^",8)
57 S:'$G(DUZ(2)) DUZ(2)=$O(^VA(200,DUZ,2,0))
58 S:'DUZ(2) DUZ(2)=+$P(Y("XUS"),"^",17)
59 S:'$L($G(DUZ("LANG"))) DUZ("LANG")=$P(Y("XUS"),"^",7)
60 Q
61 ;
62DTIME(E,D) ;Return DTIME value for user E, device D.
63 N P
64 S P=$P($G(^VA(200,+$G(E),200)),"^",10) S:P="" P=$P($G(^%ZIS(1,+$G(D),"XUS")),"^",10) S:P="" P=$P($G(^XTV(8989.3,1,"XUS")),"^",10)
65 Q $S(P]"":P,1:300)
66 ;
67ERR ;
68 N %XUP U $P
69 W !,"$ECODE=",$ECODE," $STACK=",$STACK
70 W !,"Location: ",$STACK($STACK-1,"PLACE")
71 R !!,"Want to record the error: No// ",%XUP:600 I "Yy"[$E(%XUP_"N") D ^%ZTER
72 D UNWIND^%ZTER ;S:'$ESTACK $ECODE="" S $ETRAP="" Q:$QUIT "" Q
Note: See TracBrowser for help on using the repository browser.