Operating System - OpenVMS
1827696 Members
3204 Online
109967 Solutions
New Discussion

Translation of F$GETDVI(dev,"STS")

 
SOLVED
Go to solution
Lachnitt_1
Frequent Advisor

Translation of F$GETDVI(dev,"STS")

Hi folks,

how can I translate the value of F$GETDVI(dev,"STS")?

I want to write a procedure which dismounts all local shadow-members on remote nodes with parameter /POLICY=MINI.

Therefore I started to wrote such a search algorithm:

$!
$ AC = F$GETSYI("ALLOCLASS")
$ X=0
$ LOOP:
$ DSTEMP = F$DEVICE("_$''AC'$*","DISK")
$ if DSTEMP.eqs."" then GOTO exit
$ DSSTS = F$GETDVI(dstemp,"STS")
$ DSMBR = F$GETDVI(dstemp,"SHDW_MEMBER")
$ IF .NOT. DSMBR THEN GOTO LOOP
$!

So now I have several states, that I know that they mean "MOUNTED":

$ STS_TO_NAME:
$ IF DSSTS .EQ. 3088 THEN DSSTS = "MOUNTED"
$ IF DSSTS .EQ. 7184 THEN DSSTS = "MOUNTED"
$ IF DSSTS .EQ. 134219792 THEN DSSTS = "MOUNTED"
$ IF DSSTS .EQ. 134350864 THEN DSSTS = "MOUNTED"
$ IF DSSTS .EQ. 134354960 THEN DSSTS = "MOUNTED"
$ IF DSSTS .EQ. 402786320 THEN DSSTS = "MOUNTED"
$ IF DSSTS .EQ. 402790416 THEN DSSTS = "MOUNTED"
$!
$ if DSSTS .EQS. "MOUNTED"
$ THEN
$ say " ''DSTEMP' ''DSSTS'"
$ X=X+1
$ LINE'X' = "DO DISMOUNT /POLICY=MINICOPY ''DSTEMP'"
$ MAXX=X
$ ENDIF

But I'm sure that's NOT all!

Can anybody help?
5 REPLIES 5
Volker Halle
Honored Contributor
Solution

Re: Translation of F$GETDVI(dev,"STS")

Hi,

why not just check for F$GETDVI(dstmp,"MNT") ?

The definitions of the various bits in UCB$L_STS can be found in SYS$LIBRARY:LIB.REQ

$ sea sys$library:lib.req ucb$v,216/match=and

in BLISS notation fieldname = offset,bit-number,size,sign

Volker.
Hein van den Heuvel
Honored Contributor

Re: Translation of F$GETDVI(dev,"STS")

Well according to the system service reference manual STS is BITMASK, defined byt $UCBDEF which for example can be found as:

$ libr/extr=$ucbdef /out=tmp.tmp sys$library:lib.mlb

Type that file!
$EQU UCB$M_ONLINE <^X10>
$EQU UCB$M_POWER <^X20>
$EQU UCB$M_TIMOUT <^X40>
$EQU UCB$M_INTTYPE <^X80>
$EQU UCB$M_BSY <^X100>
$EQU UCB$M_MOUNTING <^X200>
$EQU UCB$M_DEADMO <^X400>
$EQU UCB$M_VALID <^X800>


Now look at for example 3088
$ x=3088
$ shwo symb x
$ show symb x
X = 3088 Hex = 00000C10 Octal = 00000006020

So this has the bits ONLINE, DEADMO and VALID set.

You should test individual bits with an AND.
Something like:

$UCB$M_VALID = ^X800
$IF (STS .AND. UCB$M_VALID) .NE. 0 THEN...

Whether a device is mounted or not is encoded in the bitmask DEVCHAR which is defined in $DEVDEF

$ pipe libr/extr=$devdef/out=sys$output sys$library:starlet.mlb | searc sys$pipe
MNT
$EQU DEV$M_MNT <^X80000>
$EQU DEV$V_MNT 19

But if you just want to know whether a device is mounted, why not use F$GETDVI(x,"MNT") ?

Hein.



http://h71000.www7.hp.com/doc/732FINAL/4527/4527pro_004.html#index_x_559
Hein van den Heuvel
Honored Contributor

Re: Translation of F$GETDVI(dev,"STS")


Minor correction, and a bit more on bits...

I wrote:
$UCB$M_VALID = ^X800
That should have been %x800

[Guy... if you are reading this... can we get a #include from to define symbols for us? Mostly kidding! ]

DCL can easily extract bits from strings, but not from integers. DCL allows for left hand bit address, but not right hand. Combined this give a second way to test for bits:

$ DEV$V_MNT=19
$ bitstring="1234"
$ bitstring[0,32]=f$getdvi("_dka100:","devchar")
$ if f$cvui(DEV$V_MNT,1,bitstring) then write sys$output "Mounted"
Mounted

fwiw....
Hein.


John Gillings
Honored Contributor

Re: Translation of F$GETDVI(dev,"STS")

Hein,

> [Guy... if you are reading this... can
> we get a #include from
> to define symbols for
> us? Mostly kidding! ]

Also mostly kidding. Here's more silly DCL to define symbols from a macro library.

example:

$ @SYMDEF $UCBDEF SYS$SHARE:LIB.MLB

(beware of filling your symbol table!)

SYMDEF.COM (see attachment in case of wrapping)
$ IF p1.EQS."="
$ THEN
$ v=p3-"<"-">"
$ IF F$EXTR(0,2,v).EQS."^X" THEN v="%"+v-"^"
$ 'p2'=='v'
$ ELSE
$ IF p1.EQS."" THEN INQUIRE p1 "Module"
$ IF p2.EQS."" THEN p2="SYS$SHARE:STARLET.MLB"
$ PIPE LIBRARY/EXTRACT='p1'/OUT=SYS$OUTPUT 'p2' | -
SEARCH SYS$PIPE "$EQU" /OUT=SYS$SCRATCH:TMP.COM
$ equ="@''F$ENVIRONMENT("PROCEDURE") ""="""
$ @SYS$SCRATCH:TMP.COM
$ DELETEX SYS$SCRATCH:TMP.COM;
$ ENDIF
$ EXIT
A crucible of informative mistakes
Lachnitt_1
Frequent Advisor

Re: Translation of F$GETDVI(dev,"STS")

thx at all