1 | %ZOSV ;SFISC/AC - $View commands for Open M for NT. ;03/03/2008
|
---|
2 | ;;8.0;KERNEL;**34,94,107,118,136,215,293,284,385,425,440**;Jul 10, 1995;Build 13
|
---|
3 | ;Per VHA Directive 2004-038, this routine should not be modified
|
---|
4 | ACTJ() ;# Active jobs
|
---|
5 | N %,V,Y S V=$$VERSION()
|
---|
6 | I V<5 D Q Y
|
---|
7 | . S %=0 F Y=0:1 S %=$ZJOB(%) Q:%=""
|
---|
8 | S Y=$system.License.LUConsumed() ;Cache 5 up
|
---|
9 | Q Y
|
---|
10 | AVJ() ;# available jobs
|
---|
11 | N %,AVJ,V,ZOSV,$ET
|
---|
12 | S V=+$$VERSION()
|
---|
13 | ;Cache 3 and 4
|
---|
14 | ;maxpid: from %SS
|
---|
15 | I V<5 D Q AVJ
|
---|
16 | . N PORT,T,X,MAXPID,LMFLIM
|
---|
17 | . S $ET="",MAXPID=$V($ZU(40,2,118),-2,4)
|
---|
18 | . X "S ZOSV=$ZU(5),%=$ZU(5,""%SYS"") S LMFLIM=$$inquire^LMFCLI,%=$ZU(5,ZOSV)" ;Get the license info
|
---|
19 | . ;Add together the enterprise and division licenses avaliable
|
---|
20 | . S X=$P(LMFLIM,";",2)+$P($P(LMFLIM,"|",2),";",2)
|
---|
21 | . S T=+LMFLIM+$P(LMFLIM,"|",2) ;Check the license total
|
---|
22 | . S AVJ=$S(T<MAXPID:X,1:MAXPID-$$ACTJ) ;Return the smaller of license or pid
|
---|
23 | ;To get available jobs from Cache 5.0 up
|
---|
24 | I V'<5 D Q AVJ
|
---|
25 | . X "S AVJ=$system.License.LUAvailable()"
|
---|
26 | ;Return fixed value not known version
|
---|
27 | Q 15
|
---|
28 | ;
|
---|
29 | PRIINQ() ;
|
---|
30 | Q 8
|
---|
31 | ;
|
---|
32 | UCI ;Current UCI,VOL
|
---|
33 | S Y=$ZU(5)_","_^%ZOSF("VOL") Q
|
---|
34 | ;
|
---|
35 | UCICHECK(X) ;Check if valid namespace (UCI)
|
---|
36 | N Y,%
|
---|
37 | S %=$P(X,",",1),Y=0 I $ZU(90,10,%) S Y=%
|
---|
38 | Q Y
|
---|
39 | ;
|
---|
40 | GETPEER() ;Get the PEER tcp/ip address
|
---|
41 | N PEER,NL,$ET S NL="",PEER="",$ET="S $EC=NL Q NL"
|
---|
42 | I $$OS="VMS" S PEER=$ZF("TRNLNM","VISTA$IP")
|
---|
43 | I '$L(PEER) S PEER=$ZU(111,0) S:$L(PEER) PEER=$A(PEER,1)_"."_$A(PEER,2)_"."_$A(PEER,3)_"."_$A(PEER,4)
|
---|
44 | Q PEER
|
---|
45 | ;
|
---|
46 | SHARELIC(TYPE) ;See if can share a C/S license
|
---|
47 | ;Per Sandy Waal 10/18/2003: With Cache 5.0, your telnet and IP connections are now handled properly.
|
---|
48 | ;N %,%N,%2,UID,%V,$ET S $ET="S $EC="""" Q",%V=$$VERSION()
|
---|
49 | ;I %V'<5 Q
|
---|
50 | ;Type is 1 for C/S and 0 for Telnet
|
---|
51 | ;I %V<3.1 X:TYPE "S %N=$ZU(5),%2=$ZU(5,""%SYS""),%2=$$GetLic^LMFCLI,%N=$ZU(5,%N)" Q
|
---|
52 | ;I %V<5 S:TYPE %=$$GetCSLic^%LICENSE S:'TYPE %=$$ShareLic^%LICENSE
|
---|
53 | ;S $EC=""
|
---|
54 | Q
|
---|
55 | ;
|
---|
56 | JOBPAR ;See if X points to a valid Job. Return its UCI.
|
---|
57 | N NL,$ET S Y="",NL="",$ET="S $EC=NL Q"
|
---|
58 | I $D(^$JOB(X)) S Y=$V(-1,X),Y=$P(Y,"^",14)_","_^%ZOSF("VOL")
|
---|
59 | Q
|
---|
60 | ;
|
---|
61 | NOLOG ;4096 is switch 12 - sign on inhibited.
|
---|
62 | S Y="$V(0,-2,4)\4096#2" Q
|
---|
63 | ;
|
---|
64 | PROGMODE() ;Check if in PROG mode
|
---|
65 | Q $ZJOB#2
|
---|
66 | ;
|
---|
67 | PRGMODE ;
|
---|
68 | N X,XMB,XQZ,XUCI,XUSLNT,XUVOL,Y,ZTPAC
|
---|
69 | W ! S ZTPAC=$S('$D(^VA(200,+DUZ,.1)):"",1:$P(^(.1),U,5)),XUVOL=^%ZOSF("VOL")
|
---|
70 | S X="" X ^%ZOSF("EOFF") R:ZTPAC]"" !,"PAC: ",X:60 D LC^XUS X ^%ZOSF("EON") I X'=ZTPAC W "??"_$C(7) Q
|
---|
71 | S XMB="XUPROGMODE",XMB(1)=DUZ,XMB(2)=$I D ^XMB:$L($T(^XMB)) D BYE^XUSCLEAN K ZTPAC,X,XMB
|
---|
72 | D UCI S XUCI=Y,XQZ="PRGM^ZUA[MGR]",XUSLNT=1 D DO^%XUCI D ^%PMODE U $I:(:"+B+C+R") S $ZT="" Q
|
---|
73 | Q
|
---|
74 | LGR() ;Last Global ref.
|
---|
75 | N $ET,NL S NL="",$ET="S $EC=NL Q NL"
|
---|
76 | Q $ZR
|
---|
77 | ;
|
---|
78 | EC() ;Error code
|
---|
79 | Q $ZE
|
---|
80 | ;
|
---|
81 | DOLRO ;SAVE ENTIRE SYMBOL TABLE IN LOCATION SPECIFIED BY X
|
---|
82 | ;S Y="%" F S Y=$O(@Y) Q:Y="" D
|
---|
83 | ;. I $D(@Y)#2 S @(X_"Y)="_Y)
|
---|
84 | ;. I $D(@Y)>9 S %X=Y_"(",%Y=X_"Y," D %XY^%RCR
|
---|
85 | S Y="%" F M:$D(@Y) @(X_"Y)="_Y) S Y=$O(@Y) Q:Y=""
|
---|
86 | Q
|
---|
87 | ;
|
---|
88 | ORDER ;SAVE PART OF SYMBOL TABLE IN LOCATION SPECIFIED BY X
|
---|
89 | N %
|
---|
90 | S (Y,%)=$P(Y,"*",1) ;I $D(@Y)=0 F S Y=$O(@Y) Q:Y=""!(Y[Y1)
|
---|
91 | Q:Y=""
|
---|
92 | ;S %=$D(@Y) S:%#2 @(X_"Y)="_Y) I %>9 S %X=Y_"(",%Y=X_"Y," D %XY^%RCR
|
---|
93 | ;F S Y=$O(@Y) Q:Y=""!(Y'[Y1) S %=$D(@Y) S:%#2 @(X_"Y)="_Y) I %>9 S %X=Y_"(",%Y=X_"Y," D %XY^%RCR
|
---|
94 | F M:$D(@Y) @(X_"Y)="_Y) S Y=$O(@Y) Q:Y=""!(Y'[%)
|
---|
95 | Q
|
---|
96 | ;
|
---|
97 | PARSIZ ;Old and not used.
|
---|
98 | S X=3
|
---|
99 | Q
|
---|
100 | ;
|
---|
101 | DEVOPN ;List of Devices opened, Not used
|
---|
102 | ;Returns variable Y. Y=Devices owned separated by a comma
|
---|
103 | Q
|
---|
104 | ;
|
---|
105 | DEVOK ;
|
---|
106 | S Y=0,X1=$G(X1) Q:X=2 Q:(X1="HFS")!(X1="SPL")!(X1="MT")!(X1="CHAN") ;Quit w/ OK for HFS, Spool, MT, TCP/IP
|
---|
107 | G:X1="RES" RESOK^%ZIS6
|
---|
108 | N $ET S $ET="D OPNERR Q"
|
---|
109 | O X::$S($D(%ZISTO):%ZISTO,1:0) E S Y=999 Q ;G NOPN
|
---|
110 | S Y=0 I '$D(%ZISCHK)!($G(%ZIS)["T") C X Q
|
---|
111 | S:X]"" IO(1,X)="" Q
|
---|
112 | Q
|
---|
113 | ;
|
---|
114 | OPNERR S $EC="",Y=-1 Q
|
---|
115 | ;
|
---|
116 | GETENV ;Get environment (UCI^VOL^NODE^BOX:VOLUME)
|
---|
117 | N %,%1 S %=$$VERSION,%1=$ZU(86),%1=$S(%<3.1:$P(%1,"*",3),1:$P(%1,"*",2))
|
---|
118 | D UCI S Y=$P(Y,",")_"^"_^%ZOSF("VOL")_"^"_$ZU(110)_"^"_^%ZOSF("VOL")_":"_%1
|
---|
119 | Q
|
---|
120 | VERSION(X) ;return Cache version, X=1 - return full name
|
---|
121 | Q $S($G(X):$P($ZV,")")_")",1:$P($P($ZV,") ",2),"("))
|
---|
122 | ;
|
---|
123 | OS() ;Return the OS NT, VMS, Unix
|
---|
124 | Q $S($ZV["VMS":"VMS",$ZV["UNIX":"UNIX",$ZV["Linux":"UNIX",$ZV["Windows":"NT",$ZV["NT":"NT",1:"UNK")
|
---|
125 | ;
|
---|
126 | SETNM(X) ;Set name, Fall into SETENV
|
---|
127 | SETENV ;Set environment
|
---|
128 | N Q,$ET,$ES S $ET="S $EC="""" Q"
|
---|
129 | I $$OS="VMS" S Q=$ZF("SETPRN",$E(X,1,15))
|
---|
130 | Q
|
---|
131 | ;
|
---|
132 | SID() ;System ID Ver 1
|
---|
133 | N %1,%2,%3,%4,%5,T S T="~"
|
---|
134 | S %1=$ZU(5) ;namespace
|
---|
135 | S %2=$ZU(12,"") ;directory
|
---|
136 | I '$L(%2),$$VERSION'<5.2 S %2=$$defdir^%SYS.GLO(%1) ;remote directory
|
---|
137 | S %3=$G(^XTV(8989.3,1,"SID")),%4=$P(%3,"^",4),%5=$P(%3,"^",5)
|
---|
138 | I $L(%4),$L(%5),%2[%4 S %2=$P(%2,%4)_%5_$P(%2,%4,2,9)
|
---|
139 | S %3=%1_T_%2 ;namespace~directory
|
---|
140 | Q "1~"_%3
|
---|
141 | ;
|
---|
142 | PRI() ;Check if a mixed OS enviroment.
|
---|
143 | ;Default return 1 unless we are on the secondary OS.
|
---|
144 | ;Only Cache on a VMS(1)/Linux or NT(2) mix is supported now.
|
---|
145 | N % S %=1
|
---|
146 | I $P(^XTV(8989.3,1,0),"^",5),$$OS'="VMS" S %=2
|
---|
147 | Q %
|
---|
148 | ;
|
---|
149 | HFSREW(IO,IOPAR) ;Rewind Host File.
|
---|
150 | S $ZT="HFSRWERR"
|
---|
151 | C IO O @(""""_IO_""""_$S(IOPAR]"":":"_IOPAR_":1",1:":1")) I '$T Q 0
|
---|
152 | Q 1
|
---|
153 | HFSRWERR ;Error encountered
|
---|
154 | Q 0
|
---|
155 | LOGRSRC(OPT,TYPE,STATUS) ;record resource usage in ^XTMP("KMPR"
|
---|
156 | Q:'$G(^%ZTSCH("LOGRSRC")) ; quit if RUM not turned on.
|
---|
157 | ; call to RUM routine.
|
---|
158 | D RU^%ZOSVKR($G(OPT),$G(TYPE),$G(STATUS))
|
---|
159 | Q
|
---|
160 | SETTRM(X) ;Turn on specified terminators.
|
---|
161 | U $I:(:"+T":X)
|
---|
162 | Q 1
|
---|
163 | ;
|
---|
164 | T0 ; start RT clock, obsolete
|
---|
165 | ;S XRT0=$H
|
---|
166 | Q
|
---|
167 | T1 ; store RT datum, obsolete
|
---|
168 | ;S ^%ZRTL(3,XRTL,+$H,XRTN,$P($H,",",2))=XRT0 K XRT0
|
---|
169 | Q
|
---|