Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: XUP

XUP.m

Go to the documentation of this file.
  1. XUP ;SFISC/RWF - Setup environment for programmers ;09/02/15 06:36
  1. ;;8.0;KERNEL;**208,258,284,432,469,659**;Jul 10, 1995;Build 22
  1. ;Per VA Directive 6402, this routine should not be modified.
  1. W !,"Setting up programmer environment"
  1. S U="^",$ECODE="",$ETRAP="" ;Clear error and error trap
  1. X ^%ZOSF("TYPE-AHEAD")
  1. ;Check if Production and report
  1. W !,"This is a "_$S($$PROD^XUPROD(1):"PRODUCTION",1:"TEST")_" account.",!
  1. ;
  1. K ^UTILITY($J),^XUTL("XQ",$J) D KILL1^XUSCLEAN
  1. S U="^",DT=$$DT^XLFDT
  1. S XUEOFF=^%ZOSF("EOFF"),XUEON=^%ZOSF("EON"),U="^",XUTT=0,XUIOP=""
  1. D GETENV^%ZOSV S XUENV=Y,XUVOL=$P(Y,U,2),XUCI=$P(Y,U,1)
  1. ;Reset DUZ if user "Switched Identities".
  1. I $D(DUZ("SAV")) S DUZ=+DUZ("SAV"),DUZ(0)=$P(DUZ("SAV"),U,2) K DUZ("SAV")
  1. ;Get user info
  1. I $G(DUZ)>.5,$D(^VA(200,DUZ,0))[0 K DUZ W !,"DUZ Must point to a real user." G EXIT ;p432
  1. I $G(DUZ)>0 D DUZ(DUZ)
  1. I $G(DUZ)'>0!('$D(DUZ(0))) D ASKDUZ G:Y'>0 EXIT
  1. I '$D(XQUSER) S XQUSER=$S($D(^VA(200,DUZ,20)):$P(^(20),"^",2),1:"Unk")
  1. S DTIME=600 ;Set a temp DTIME
  1. S DILOCKTM=+$G(^DD("DILOCKTM"),1) ;p432
  1. S DUZ("LOA")=2 ;p659
  1. S DUZ("AUTHENTICATION")="XUP"
  1. ;Getting Terminal Type
  1. ZIS 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
  1. 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
  1. 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
  1. ZIS2 S %ZIS="L",IOP="HOME;"_XUIOP(1) D ^%ZIS G EXIT:POP W !,"Terminal Type set to: ",IOST,!
  1. S DTIME=$$DTIME(DUZ,IOS),DUZ("BUF")=1,XUDEV=IOS
  1. S %=+$G(^VA(200,DUZ,.1)) I %>0 S %=$P(^XTV(8989.3,1,"XUS"),U,15)-($H-%) I %<14,%>0 W !!,"Your VERIFY code will expire in "_%_" days",!!
  1. ;Save info, Set last sign-on
  1. D SAVE^XUS1 S $P(^VA(200,DUZ,1.1),"^",1)=$$NOW^XLFDT
  1. ;Check Mail
  1. S Y=$P($G(^XMB(3.7,DUZ,0)),U,6) I Y W !,"You have "_Y_" new message"_$S(Y=1:"",1:"s")_"."
  1. ;Setup error trap
  1. I $$GET^XPAR("USR^SYS","XUS-XUP SET ERROR TRAP",1,"Q") S $ETRAP="D ERR^XUP"
  1. D KILL1^XUSCLEAN S $P(XQXFLG,U,3)="XUP" D ^XQ1
  1. EXIT ;Clean-up and exit
  1. D KILL1^XUSCLEAN K XQY,XQY0
  1. I $G(DUZ)>0,$$GET^XPAR("USR^SYS","XUS-XUP VPE",1,"Q"),$D(^%ZVEMS) X ^%ZVEMS ;Run VPE
  1. Q
  1. ;
  1. ASKDUZ ;Ask for Access Code
  1. N X
  1. ;X XUEOFF S DIR(0)="FO",DIR("A")="Access Code" D ^DIR W ! X XUEON I $D(DIRUT) S Y=-1 Q
  1. X XUEOFF W !,"Access Code: " S X=$$ACCEPT^XUS() X XUEON
  1. I X["^"!('$L(X)) S Y=-1 Q
  1. S X=$$UP^XLFSTR(X) S:X[":" XUTT=1,X=$P(X,":",1)_$P(X,":",2)
  1. D ^XUSHSH S Y=$O(^VA(200,"A",X,0))
  1. K DUZ D DUZ(+Y)
  1. Q
  1. ;
  1. DUZ(DA) ;Build DUZ for a user. Used by Mailman.
  1. ;(p284) Make the setting of several DUZ parts conditional.
  1. N Y
  1. S Y(0)=$G(^VA(200,+DA,0)),Y("XUS")=$G(^XTV(8989.3,1,"XUS"))
  1. S DUZ=DA
  1. S:$G(DUZ(0))'="@" DUZ(0)=$P(Y(0),"^",4)
  1. S DUZ(1)="",DUZ("AG")=$P($G(^XTV(8989.3,1,0)),"^",8)
  1. S:'$G(DUZ(2)) DUZ(2)=$O(^VA(200,DUZ,2,0))
  1. S:'DUZ(2) DUZ(2)=+$P(Y("XUS"),"^",17)
  1. S:'$L($G(DUZ("LANG"))) DUZ("LANG")=$P(Y("XUS"),"^",7)
  1. Q
  1. ;
  1. DTIME(E,D) ;Return DTIME value for user E, device D.
  1. N P
  1. 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)
  1. Q $S(P]"":P,1:300)
  1. ;
  1. ERR ;
  1. N %XUP U $P
  1. W !,"$ECODE=",$ECODE," $STACK=",$STACK
  1. W !,"Location: ",$STACK($STACK-1,"PLACE")
  1. R !!,"Want to record the error: No// ",%XUP:600 I "Yy"[$E(%XUP_"N") D ^%ZTER
  1. D UNWIND^%ZTER ;S:'$ESTACK $ECODE="" S $ETRAP="" Q:$QUIT "" Q