Operating System - OpenVMS
1753963 Members
7110 Online
108811 Solutions
New Discussion юеВ

Exact Position of DISUSER Field In SYSUAF

 
SOLVED
Go to solution
Robert Atkinson
Respected Contributor

Exact Position of DISUSER Field In SYSUAF

Given the data available in the UAF070DEF module in SYS$COMMON:[SYSLIB]SYS$STARLET_C.TLB, can anyone help me to find the exact position and length of the DISUSER flag field (disacnt) in the record?

I know accessing SYSUAF in this way is unsupported, but it's the only way I can get the information I need for a relatively minor program I'm writing.

Thanks, Rob.
10 REPLIES 10
Volker Halle
Honored Contributor

Re: Exact Position of DISUSER Field In SYSUAF

Rob,

the UAF070$L_FLAGS longword (byte offset 468.) contains the various flags bits.

The UAF070$V_DISACNT flag is bit 4 in this longword or as a mask definition: UAI$M_DISACNT = %X'10'

The above is from the BLISS module SYS$LIBRARY:STARLET.REQ

Volker.
Volker Halle
Honored Contributor

Re: Exact Position of DISUSER Field In SYSUAF

Rob,

see here for some FORTRAN example code:

http://mvb.saic.com/freeware/freewarev40/pwd_update/src/pwd_update.for

Volker.
Robert Atkinson
Respected Contributor

Re: Exact Position of DISUSER Field In SYSUAF

Volker, if the flag exists as a bit mask inside a longword, can I get to it individually, or would I have to take the whole longword and work out the value of bit 4?

Ideally, I'd like to do the eqivilent of f$extract with my programming language to get the disacnt field, and then translate it from an unsigned into something more legible.

What is the length in bytes of an unsigned?

Rob.
Jan van den Ende
Honored Contributor

Re: Exact Position of DISUSER Field In SYSUAF

Robert,



>>>
Ideally, I'd like to do the eqivilent of f$extract with my programming language to get the disacnt field, and then translate it from an unsigned into something more legible.
<<<

A general solution in DCL to do that:
use f$extract to extract exactly ONE longword, and
.AND.
that to the wished bit mask.
eg
$ disacnt = ( f$extract(468,8,UAF070$L_FLAGS) .AND. %X10 )

Corresponding simailar syntax in other languages.

hth

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Volker Halle
Honored Contributor
Solution

Re: Exact Position of DISUSER Field In SYSUAF

Rob,

here is a simple DCL example:

$ open/read/share x sysuaf.dat ! copy of SYSUAF
$ read x line ! just read 1st record
$ close x
$ flags=f$extract(468,1,line) ! extract 1st byte of FLAGS
$ x=f$cvsi(4,1,flags) ! convert bit 4
$ sho sym x
X = -1 Hex = FFFFFFFF Octal = 37777777777

If the first user record found in SYSUAF is not disusered, X will return as 0.

Volker.
Robert Atkinson
Respected Contributor

Re: Exact Position of DISUSER Field In SYSUAF

Thanks Volker.

Armed with the example you gave, I can now write the equivilent of f$cvui in my application (Vista 4GL) and be able to translate the flag to 1 or 0.

Everyones help is much appreciated.

Rob.
Hein van den Heuvel
Honored Contributor

Re: Exact Position of DISUSER Field In SYSUAF


Hi Roberts,

Thanks for mentioning the target language!

For the benfit of future readers, allow me to point out that the right place to get account information is to call SYS$GETUAI. I still have hope that someday there will be an F$GETUAI, but it did not happen with 8.3.
So this 'vista' does not have an interface to SYS$GETUAI and that would be too hard to make? And it does have an (indexed) file interface huh?!

Also for the benefit of future readers using DCL. One really should not (need not) grab the flags longword and then find the right bit. Just ask for the bit directly:

$ libr/extr=$uaf070def/out=uafdef.mar sys$library:starlet.mlb
$ sea uafdef.mar flags,disacnt
$EQU UAF070$L_FLAGS 468
$EQU UAF070$V_DISACNT 4
$ open/read/share=write sysuaf
$ read/key="DEFAULT" sysuaf record
$ read/key="HEIN" sysuaf record
$ write sys$output f$cvui(468*8+4,1,record)
1
$ write sys$output f$cvsi(468*8+4,1,record)
-1
$ read/key="HEIN" x record
$ write sys$output f$cvsi(468*8+4,1,record)
0


Jan>> use f$extract to extract exactly ONE longword, and .AND. that to the wished bit mask.
eg
$ disacnt = ( f$extract(468,8,UAF070$L_FLAGS) .AND. %X10 )

Actually.. a longword is, as you know, 4 bytes. No harm here, but asking for 8 byte could make you falll of the edge in some cases. But you knew that. Just a typo surely.

Volker>$ flags=f$extract(468,1,line) ! extract 1st byte of FLAGS
$ x=f$cvsi(4,1,flags) ! convert bit 4

Actually.. flags is, as you know, 4 bytes. No harm here, but asking for 1 byte is potentially confusing and assumes you just 'know' the intresting flag is in the low byte, and that you know the byte ordering. But you knew that. Just a typo surely, or maybe a 'clever' optimization, but it makes for a bad example.

Cheers,
Hein.








Robert Atkinson
Respected Contributor

Re: Exact Position of DISUSER Field In SYSUAF

Although the Vista engine is written in 'C', it's basically an interpretted language using verbs like, FILE-READ, FILE-WRITE, LIST, PRINT, CLEAR, SORT, TOTAL, etc, ect.

It does not allow the programmer to get to system service calls, or even the operating system, for that matter, so I need to read the file directly and convert the data into something usable.

The hardest problem was knowing exactly where the data is, and how to access it in the right way (converting the byte into a bit mask).

Rob.
Jan van den Ende
Honored Contributor

Re: Exact Position of DISUSER Field In SYSUAF

Re Hein:

>>>
Jan>> use f$extract to extract exactly ONE longword, and .AND. that to the wished bit mask.
eg
$ disacnt = ( f$extract(468,8,UAF070$L_FLAGS) .AND. %X10 )

Actually.. a longword is, as you know, 4 bytes. No harm here, but asking for 8 byte could make you falll of the edge in some cases. But you knew that. Just a typo surely.
<<<

AAAAHGGG!!!!

Did I really check what I wrote???
Good you pointed it out, it might well have worked as a rather bad example.
Makes one feel humble again :-(

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.