[613] | 1 | %ZOSV ;SFISC/AC,LL/DFH,sfisc/fyb ;10/31/95 10:04
|
---|
| 2 | ;;8.0;KERNEL;**13**;Jul 10, 1995
|
---|
| 3 | ; ** For DataTree **
|
---|
| 4 | ;
|
---|
| 5 | ACTJ() ; Active Jobs
|
---|
| 6 | Q $$njobs^%mjob("running")
|
---|
| 7 | ;
|
---|
| 8 | AVJ() ; Available Jobs
|
---|
| 9 | Q $$njobs^%mjob("free")
|
---|
| 10 | ;
|
---|
| 11 | T0 ; start RT clock
|
---|
| 12 | S XRT0=$H Q
|
---|
| 13 | T1 ; store RT datum
|
---|
| 14 | S ^%ZRTL(3,XRTL,+$H,XRTN,$P($H,",",2))=XRT0 K XRT0 Q
|
---|
| 15 | MAXJ ; Maximum # of Jobs
|
---|
| 16 | S Y=$$njobs^%mjob("total") Q
|
---|
| 17 | ;
|
---|
| 18 | BAUD ; Baud rate of device - used by BAUD field of the Device File
|
---|
| 19 | ; Internal entry of device is D0
|
---|
| 20 | ZETRAP BAUDERR
|
---|
| 21 | S X=$zdevspeed($P(^%ZIS(1,D0,0),"^",2)) Q
|
---|
| 22 | BAUDERR S X="" Q
|
---|
| 23 | ;
|
---|
| 24 | LGR() Q $ZR ;Last global reference
|
---|
| 25 | ;
|
---|
| 26 | EC() Q $ZE ;Error code
|
---|
| 27 | ;
|
---|
| 28 | DEVOPN ;X=$J,Y=List of devices separated by a comma
|
---|
| 29 | G DEVOPN^%ZOSV1
|
---|
| 30 | ;
|
---|
| 31 | DEVOK ;X=Device $I, Y=0 if available, Y=999 if device is busy
|
---|
| 32 | ;Y=-1 if device is undefined.
|
---|
| 33 | G RES:$G(X1)="RES" I $E(X)="/"!($E(X)="\") S Y=0 Q
|
---|
| 34 | I $D(X)[0 S X=$I
|
---|
| 35 | I X=$I S Y=$J Q
|
---|
| 36 | I X<20,(X>9) S Y=0 D NULLDEV O X:("W":NULLDEV):0 C:$T X S:'$T Y=999 Q
|
---|
| 37 | ZETRAP NODEV
|
---|
| 38 | O X::0 I '$T S Y=999 Q
|
---|
| 39 | C X S Y=0
|
---|
| 40 | Q
|
---|
| 41 | RES S Y=0,%ZISD0=$O(^%ZISL(3.54,"B",X,0))
|
---|
| 42 | I '%ZISD0 S Y=-1,%ZISD0=%O(^%ZIS(1,"C",X)) Q:'%ZISD0 Q:'$D(^%ZIS(1,+%ZISD0,0)) Q:$P(^(0),"^")'=X Q:'$D(^("TYPE")) Q:^("TYPE")'="RES" S Y=0 Q
|
---|
| 43 | S X1=$S($D(^%ZISL(3.54,+%ZISD0,0)):^(0),1:"")
|
---|
| 44 | I $P(X1,"^",2)&(X=$P(X1,"^")) S Y=0 Q
|
---|
| 45 | S Y=999 F %ZISD1=0:0 S %ZISD1=$O(^%ZISL(3.54,%ZISD0,1,%ZISD1)) Q:%ZISD1'>0 I $D(^(%ZISD1,0)) S Y=$P(^(0),"^",3) Q
|
---|
| 46 | K %ZISD0,%ZISD1
|
---|
| 47 | Q
|
---|
| 48 | NULLDEV ; based on %device
|
---|
| 49 | K HWTYPE S NULLDEV="NUL",H=$V($S($P($ZVER,"/",2)<4:4,1:1),3,-1)
|
---|
| 50 | S HWTYPE=$S(H<10:"WS",H<20:"MF",H<64:"?",H<129:"PC",1:"?")
|
---|
| 51 | I HWTYPE'="PC" S NULLDEV="[NUL]"
|
---|
| 52 | K H,HWTYPE Q
|
---|
| 53 | ;
|
---|
| 54 | NODEV S Y=-1
|
---|
| 55 | Q
|
---|
| 56 | ;
|
---|
| 57 | DOLRO ;SAVE ENTIRE SYMBOL TABLE IN LOCATION SPECIFIED BY X
|
---|
| 58 | ;I $P($ZVER,"/",2)<4 D ^%VARLOG
|
---|
| 59 | S Y="%" F %=0:0 S Y=$O(@Y) Q:Y="" S %=$D(@Y) S:%#2 @(X_"Y)="_Y) I %>9 S %X=Y_"(",%Y=X_"Y," D %XY^%RCR
|
---|
| 60 | Q
|
---|
| 61 | ;
|
---|
| 62 | ORDER ; Save part of the symbol table in location specified by X
|
---|
| 63 | S (Y,Y1)=$P(Y,"*",1) I $D(@Y)=0 F %=0:0 S Y=$O(@Y) Q:Y=""!(Y[Y1)
|
---|
| 64 | Q:Y="" S %=$D(@Y) S:%#2 @(X_"Y)="_Y)
|
---|
| 65 | I %>9 S %X=Y_"(",%Y=X_"Y," D %XY^%RCR
|
---|
| 66 | F %=0:0 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
|
---|
| 67 | K %,X,Y,Y1 Q
|
---|
| 68 | ;
|
---|
| 69 | JOBPAR ; Returns job X's namespace
|
---|
| 70 | D JSTAT^%ZOSV1
|
---|
| 71 | I ($P($ZVER,"/",2)'<4)&($P($ZVER,"/",2)<4.3) S Y=$ZCONVERT($V(0,JA+908,-5),"U")
|
---|
| 72 | E S Y=$$jstat^%mjob(X),Y=$P(Y,"|",4)
|
---|
| 73 | Q
|
---|
| 74 | ;
|
---|
| 75 | ;
|
---|
| 76 | NOLOG ; No logins allowed
|
---|
| 77 | S Y=0 Q
|
---|
| 78 | ;
|
---|
| 79 | PARSIZ ;
|
---|
| 80 | S X=3 Q
|
---|
| 81 | ;
|
---|
| 82 | PRIINQ() ; Priority Inquire
|
---|
| 83 | N X,Y S X=$J ;D JSTAT^%ZOSV1
|
---|
| 84 | ;I ZVER S Y=$V(0,$V(1,(X-1*2)+100,-2)*16+5,-1)-128\2 S:Y Y=10-Y
|
---|
| 85 | S Y=$$jstat^%mjob(X),Y=$P(Y,"|",7) S:Y Y=10-Y
|
---|
| 86 | Q Y
|
---|
| 87 | ;
|
---|
| 88 | PRIORITY ; Set priority of job
|
---|
| 89 | I X<1!(X>10) Q
|
---|
| 90 | S Y=X,X=10-X ; convert Kernel to DTM priority
|
---|
| 91 | I $P($ZVER,"/",2)<4 V 64+$J:50:$C(128+X) Q
|
---|
| 92 | S X=X*2+128 zc #changepriority(X) V 2:5:$C(X)
|
---|
| 93 | Q
|
---|
| 94 | PRGMODE ;
|
---|
| 95 | W ! S ZTPAC=$S($D(^VA(200,+DUZ,.1))#10:$P(^(.1),"^",5),1:""),XUVOL=^%ZOSF("VOL")
|
---|
| 96 | I ZTPAC]"" X ^%ZOSF("EOFF") R !,"PAC: ",X:60 S X=$ZCONVERT(X,"U") X ^%ZOSF("EON") I X'=ZTPAC W "??",*7 Q
|
---|
| 97 | S XMB="XUPROGMODE",XMB(1)=DUZ,XMB(2)=$I D ^XMB:$L($T(^XMB)) D BYE^XUSCLEAN K ZTPAC,X,XMB
|
---|
| 98 | X ^%ZOSF("UCI") S XUCI=Y,XQZ="PRGM^ZUA[MGR]",XUSLNT=1 D DO^%XUCI
|
---|
| 99 | U:$I>99 $I:IXXLATE=2 D ^%mshell
|
---|
| 100 | ;
|
---|
| 101 | UCICHECK(X) ; The call to ns^%m for Version 4 is necessary
|
---|
| 102 | ; only if namespaces are password protected.
|
---|
| 103 | ZETRAP BADUCI N CURUCI
|
---|
| 104 | S X=$P(X,",")
|
---|
| 105 | S X=$ZCONVERT(X,"U"),CURUCI=$ZNSPACE
|
---|
| 106 | I $P($ZVER,"/",2)<4 ZNSPACE X ZNSPACE CURUCI Q X
|
---|
| 107 | D ns^%m(X,1) S ^UTILITY($J)="" ; *** force error if dataset not mounted
|
---|
| 108 | I CURUCI'=X D ns^%m(CURUCI,1)
|
---|
| 109 | Q X
|
---|
| 110 | BADUCI ; set flag and return to old namespace
|
---|
| 111 | S Y=0
|
---|
| 112 | I $P($ZVER,"/",2)<4 ZNSPACE CURUCI
|
---|
| 113 | E D ns^%m(CURUCI,1)
|
---|
| 114 | Q Y
|
---|
| 115 | ;
|
---|
| 116 | VERSION(X) ;return OS version, X=1 - return OS
|
---|
| 117 | Q $S($G(X):$P($ZV,"/"),1:$P($ZV,"/",2))
|
---|
| 118 | ;
|
---|
| 119 | SETNM(X) ;Set name, Fall into SETENV
|
---|
| 120 | SETENV ; Set environment
|
---|
| 121 | S XUENV=X_"^"
|
---|
| 122 | I $P($ZVER,"/",2)>4.2 V 2:374:$C($L(X))_X:$J#256 Q
|
---|
| 123 | S X1=X,X=$J D JSTAT^%ZOSV1
|
---|
| 124 | V 0:JA+374:$C($L(X1))_X1
|
---|
| 125 | Q
|
---|
| 126 | GETENV ; Get environment
|
---|
| 127 | S Y=$ZNSPACE_"^"_^%ZOSF("VOL")_"^^"_^%ZOSF("VOL")
|
---|
| 128 | Q
|
---|
| 129 | TRMON ;Turn terminators on
|
---|
| 130 | U $I:IXINTERP=2 N % S %=$$getall^%mixinterp()
|
---|
| 131 | I $A(%)'=35 F %=0:1:31,127 D set^%mixinterp(%,35)
|
---|
| 132 | Q
|
---|
| 133 | TRMOFF ;Turn terminators off
|
---|
| 134 | U $I:IXINTERP=$S($I>99:1,1:0)
|
---|
| 135 | Q
|
---|
| 136 | PASSALL ;Pass all characters
|
---|
| 137 | U $I:IXINTERP=3 N % S %=$$getall^%mixinterp()
|
---|
| 138 | I $A(%)'=18 F %=0:1:31,127 D set^%mixinterp(%,18)
|
---|
| 139 | Q
|
---|
| 140 | NOPASS ;Do not pass all characters
|
---|
| 141 | D TRMOFF
|
---|
| 142 | Q
|
---|
| 143 | ;
|
---|
| 144 | HFSREW(IO,IOPAR) ;Rewind Host File
|
---|
| 145 | S $ZT="HFSRWERR"
|
---|
| 146 | U IO:(LFA=0)
|
---|
| 147 | Q 1
|
---|
| 148 | HFSRWERR ;Error encountered.
|
---|
| 149 | Q 0
|
---|
| 150 | LOGRSRC(OPT) ;record resource usage in ^XUCP
|
---|
| 151 | Q
|
---|
| 152 | SETTRM(X) ;Turn on specified terminators.
|
---|
| 153 | U $I:TERM=X
|
---|
| 154 | Q 1
|
---|