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

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

initial load of WorldVistAEHR

File size: 5.1 KB
Line 
1%ZOSV ;SFISC/AC - View commands & special functions. ;10/26/06 08:15
2 ;;8.0;KERNEL;**13,65,71,94,107,118,136,215,284,425**;Jul 10, 1995;Build 18
3ACTJ() ; # active jobs
4 Q $P($$JOBS^%SY,",",2)
5 ;
6AVJ() ; # available jobs
7 N Y S Y=$$JOBS^%SY Q +Y-$P(Y,",",2)
8 ;
9PASSALL ;
10 S Y=$ZC(%SPAWN,"SET TERM/PASTHRU "_$I) U $I:NOTERM Q
11NOPASS ;
12 S Y=$ZC(%SPAWN,"SET TERM/NOPASTHRU "_$I) U $I:TERM="" Q
13 ;
14PRGMODE ;
15 W ! S ZTPAC=$S($D(^VA(200,+DUZ,.1))#10:$P(^(.1),"^",5),1:""),XUVOL=^%ZOSF("VOL")
16 S X="" X ^%ZOSF("EOFF") R:ZTPAC]"" !,"PAC: ",X:60 D LC^XUS X ^%ZOSF("EON") I X'=ZTPAC W "??",*7 Q
17 K XMB,XMTEXT,XMY S XMB="XUPROGMODE",XMB(1)=DUZ,XMB(2)=$I D ^XMB:$L($T(^XMB)) D BYE^XUSCLEAN K ZTPAC,X,XMB
18 I '$$PROGMODE() D UCI S XUCI=Y,XQZ="PRGM^ZUA[MGR]",XUSLNT=1 D DO^%XUCI ZESCAPE
19 E S $ECODE=",<<PROG>>,"
20 ;
21PROGMODE() ;
22 Q ($V($V($V(0)))#2=0)
23 ;
24UCI ;
25 S Y=$ZC(%UCI),Y=$P(Y,",",1)_","_$P(Y,",",4) Q
26 ;
27UCICHECK(X) ;
28 N %,%1,U,V,Y
29 I '(X?3U!(X?3U1","3U)) Q ""
30 S U=$ZC(%UCI),V=$P(U,",",4),U=$P(U,","),%1=$P(X,",",2),%=$P(X,",")
31 S Y=$ZC(%SETUCI,%,%1),Y=$S(Y:%_","_$S(%1]"":%1,1:V),1:""),V=$ZC(%SETUCI,U,V)
32 Q Y
33 ;
34GETPEER() ;Get the PEER address
35 N PEER,NL,$ET S NL="",$ET="S $EC=NL Q NL",PEER=""
36 S PEER=$ZC(%TRNLNM,"VISTA$IP")
37 I '$L(PEER) S PEER=$&%UCXGETPEER S PEER=$A(PEER,1)_"."_$A(PEER,2)_"."_$A(PEER,3)_"."_$A(PEER,4)
38 Q PEER
39 ;
40SHARELIC(TYPE) ;See if can share a C/S license DSM
41 Q ;Cache only at this time.
42 Q:$$VERSION<7.2
43 N %,$ET S $ET="S $EC="""" Q"
44 I TYPE S %=$$GetCSLic^%LICENSE Q
45 I 'TYPE S %=$$ShareLic^%LICENSE
46 S $EC=""
47 Q
48PRIORITY ;
49 Q ;Q:X>10!(X<1) S X=(X+1)\2-1,Y=$ZC(%SETPRI,X) Q ;Let VSM do it's thing.
50 ;
51PRIINQ() ;
52 Q $ZC(%GETJPI,0,"PRIB")*2+2
53 ;
54BAUD S X="UNKNOWN" Q
55 ;
56LGR() Q $ZR ;Last global ref.
57 ;
58EC() Q $ZE ;Error code
59 ;
60DOLRO ;SAVE ENTIRE SYMBOL TABLE IN LOCATION SPECIFIED BY X
61 S Y="%" F S Y=$ZSORT(@Y) Q:Y="" D ;code from DEC
62 . I $D(@Y)#2 S @(X_"Y)="_Y)
63 . I $D(@Y)>9 S %X=Y_"(",%Y=X_"Y," D %XY^%RCR
64 K %X,%Y,Y Q
65 ;
66ORDER ;SAVE PARTS OF SYMBOL TABLE IN LOCATION SPECIFIED BY X
67 S (Y,Y1)=$P(Y,"*") I $D(@Y)=0 F S Y=$ZSORT(@Y) Q:Y=""!(Y[Y1)
68 Q:Y="" S %=$D(@Y) S:%#2 @(X_"Y)="_Y) I %>9 S %X=Y_"(",%Y=X_"Y," D %XY^%RCR
69 F S Y=$ZSORT(@Y) Q:Y=""!(Y'[Y1) S %=$D(@Y) S:%#2 @(X_"Y)="_Y) I %>9 S %X=Y_"(",%Y=X_"Y," D %XY^%RCR
70 K %,%X,%Y,Y,Y1
71 Q
72 ;
73PARSIZ ;
74 S X=3 Q
75 ;
76NOLOG ;
77 S Y=0 Q
78 ;
79GETENV ;Get environment Return Y='UCI^VOL/DIR^NODE^BOX LOOKUP'
80 S Y=$P($ZU(0),",",1)_"^"_$P($ZU(0),",",2)_"^"_$P($ZC(%GETSYI),",",4)
81 S $P(Y,"^",4)=$P(Y,"^",2)_":"_$P(Y,"^",3)
82 Q
83VERSION(X) ;return DSM version, X=1 - return OS
84 N % S %=$ZV
85 I %[" V" Q $S($G(X):$P($ZV," V"),1:$P($ZV," V",2))
86 Q $S($G(X):$P($ZV," ",1,2),1:$P($ZV," ",3))
87 ;
88SETNM(X) ;Set name, Trap dup's, Fall into SETENV
89 N $ETRAP S $ETRAP="S $ECODE="""" Q"
90SETENV ;Set environment X='PROCESS NAME^ '
91 S %=$ZC(%SETPRN,$P(X,"^")) Q
92 ;
93 ;Code moved to %ZOSVKR, Comment out if needed.
94LOGRSRC(OPT,TYPE,STATUS) ;record resource usage in ^XTMP("KMPR"
95 Q:'$G(^%ZTSCH("LOGRSRC")) ; quit if RUM not turned on.
96 ; call to RUM routine.
97 D RU^%ZOSVKR($G(OPT),$G(TYPE),$G(STATUS))
98 Q
99 ;
100SETTRM(X) ;Turn on specified terminators.
101 U $I:TERM=X
102 Q 1
103 ;
104DEVOK ;Check Device Availability. (not complete)
105 ;INPUT: X=Device $I, X1=IOT -- X1 needed for resources
106 ;OUTPUT: Y=0 if available, Y=job # if owned, Y=-1 if device does not exists.
107 S Y=0 Q:X["::" I $G(X1)="RES" G RESOK^%ZIS6
108 S Y=$ZC(%GETDVI,X,"EXISTS")
109 G DV1:Y D DV2 Q:Y=-1 I Y="TERM" S Y=-1 Q
110 S Y=-2 Q
111DV1 S Y=$ZC(%GETDVI,X,"PID") I Y=$J!($ZC(%GETDVI,X,"SPL")) S Y=0 Q
112 I Y,$ZC(%GETJPI,X,"MASTER_PID")=Y G DVOPN
113 Q:Y>0 D DV2 G DVOPN:Y="TERM" S Y=$S(Y="DISK":0,Y="MAILBOX":0,Y="TAPE":0,1:-1) Q
114DV2 S Y=$ZC(%PARSE,X) I Y="" S Y=-1 Q
115 I X]"" S Y=$ZC(%GETDVI,$S(Y]"":Y,1:X),"DEVCLASS") Q
116 Q
117DVOPN S $ZT="DVERR",Y=0 Q:$D(%ZTIO)
118 L:$D(%ZISLOCK) +@%ZISLOCK:60
119 O X::$S($D(%ZISTO):%ZISTO,1:0) E S Y=999 L:$D(%ZISLOCK) -@%ZISLOCK:60 Q
120 L:$D(%ZISLOCK) -@%ZISLOCK
121 S Y=0 I '$D(%ZISCHK)!$S($D(%ZIS)#2:(%ZIS["T"),1:0) C X Q
122 S:X]"" IO(1,X)="" Q
123DVERR I $ZE["OPENERR" S Y=-1 Q
124 ZQ
125 ;
126SID() ;Build a System ID
127 N J1,J2,J3,T S T="~"
128 S J1=$P($ZC(%GETSYI),",",4) ;NODE NAME
129 S J2=$ZU(0) ;UCI
130 S J3=$ZC(%ENVIDNM) ;Enviroment number,name
131 ;S ^RWF("SID",$J,1)=J1,^(2)=J2,^(3)=J3
132 Q "1~"_(+J3)_T_$P(J3,",",2)_T_J2_T
133 ;
134T0 ; start RT clock
135 ;S %ZH0=$ZH,%=$P(%ZH0,",",3) S:$E($ZV,10,12)>5.1 %=$E(%,13,23) S XRT0=+$H_","_($P(%,":")*3600+($P(%,":",2)*60)+$P(%,":",3))
136 Q
137 ;
138T1 ; store RT datum w/ZHDIF
139 ;S %ZH1=$ZH,%=$P(%ZH1,",",3) S:$E($ZV,10,12)>5.1 %=$E(%,13,23) S XRT1=+$H_","_($P(%,":")*3600+($P(%,":",2)*60)+$P(%,":",3))
140 ;S ^%ZRTL(3,XRTL,+XRT1,XRTN,$P(XRT1,",",2))=XRT0_"^^"_($P(%ZH1,",")-$P(%ZH0,","))_"^"_($P(%ZH1,",",7)-$P(%ZH0,",",7))_"^"_($P(%ZH1,",",8)-$P(%ZH0,",",8)) K XRT0,%ZH0,%ZH1
141 Q
142 ;
143ZHDIF ;Display dif of two $ZH's
144 W !," CPU=",$J($P(%ZH1,",")-$P(%ZH0,","),6,2),?14," ET=",$J($P(%ZH1,",",2)-$P(%ZH0,",",2),6,1),?27," DIO=",$J($P(%ZH1,",",7)-$P(%ZH0,",",7),5),?40," BIO=",$J($P(%ZH1,",",8)-$P(%ZH0,",",8),5),! Q
145 ;
146DEVOPN ;List devices opened.
147 N %,%B,%I,%L,%X,%X1,%X2,%Y
148 S %X1=$V($V(0)+8),%X2=$V(%X1),Y=""
149 F %I=1:1 D D1 S %X2=$V(%X2) Q:%X2=%X1
150 Q
151D1 S %X=$V(%X2+8)
152 S %L=$V(%X+4,-1,1),%B=$V(%X+8)
153 S %Y=""
154 F %=1:1:%L S %Y=%Y_$C($V(%B,-1,1)) S %B=%B+1
155 S Y=Y_%Y_"," Q
156 ;
Note: See TracBrowser for help on using the repository browser.