Operating System - OpenVMS
1752680 Members
5584 Online
108789 Solutions
New Discussion юеВ

Re: Command file to put UAF field values into a text file

 
R Swenson
Frequent Advisor

Command file to put UAF field values into a text file

Hi, all! I have looked around in the archives and found some processes that are close to what I want, but not exactly.

What I need is a command file (batch or not), that will create a comma-delimited flat text file with the following field values from SYSUAF.DAT:

'owner','account','lastlogindate_interactive', 'lastlogindate_noninteractive'

Any help is appreciated. Thanks!
5 REPLIES 5
Hein van den Heuvel
Honored Contributor

Re: Command file to put UAF field values into a text file

There is a well known tool out there 'uaf' which probably can do this. Google to the rescue?

I made a program a decade ago to do the CSV thing and published with the openVMS freeware as:

http://h71000.www7.hp.com/freeware/freeware60/rms_tools/bonus/getuai.c

I just tried it, but it did not compile clean on Alpha and mangled the 'account' field.

Should be fixed now. Try the attachment!

hth,
Hein.
Ian Miller.
Honored Contributor

Re: Command file to put UAF field values into a text file

Is that different to
ftp://ftp.process.com/vms-freeware/fileserv/getuai.zip

?
____________________
Purely Personal Opinion
Hein van den Heuvel
Honored Contributor

Re: Command file to put UAF field values into a text file

Hi there Ian,

>> Is that different to....

Yes. Mine generates the CSV as requested, the other one does not (it focusses on define DCL symbold)

No, it's the same core: A driver table + getuai call.

Yes, Mine uses a (trivial) RMS (wildcard) lookup on the username, as requested. The above reference just does not, it operateds on one selected user at a time,

Yes, mine is 50 lines, the above 5000.

Mostly kidding...

Hein,
DECxchange
Regular Advisor

Re: Command file to put UAF field values into a text file

Hello,
What you could do is go into AUTHORIZE and list/full the files. Then you could do a SEARCH command for the particular fields you're after and /out this to another text file. Sure this is not a comma delimieted format, but it will provide you with the same info.

If you want comma delimited, you could write a DCL program to read the SYSUAF.DAT file generated from
sysuaf> list/full

This creates a sysuaf.dat, and then you could use the DCL READ command and then use LEXICAL functions to parse each line and delimit each filed with commas, to another file you opened in DCL. But to me, that's a lot of work when all you need to do is use the SEARCH utility a few times, and save the output of the latter to a text file.
Graham Burley
Frequent Advisor

Re: Command file to put UAF field values into a text file

$ exit_status = %x1
$ on warning then $goto ERROR
$ on control_y then $goto ABORT
$ uaf_file = f$parse("SYSUAF","SYS$SYSTEM:.DAT")
$ close/nolog uaf_chan
$ open/read/share=write uaf_chan 'uaf_file'
$ none = "17-NOV-1858 00:00:00.00"
$ write sys$output "user,owner,account" -
,",lastlogindate_interactive,lastlogindate_noninteractive"
$LOOP: read/nolock/end=END uaf_chan uaf_rec
$ user = f$edit(f$extract(4,32,uaf_rec),"TRIM")
$ owner = f$extract(84+1,f$cvsi(84*8,8,uaf_rec),uaf_rec)
$ account = f$edit(f$extract(52,32,uaf_rec),"TRIM")
$ q_lli = f$extract(396,8,uaf_rec)
$ q_lln = f$extract(404,8,uaf_rec)
$ lli = f$fao("!%D",f$cvui(32,32,f$fao("!AD",8,q_lli)))
$ lln = f$fao("!%D",f$cvui(32,32,f$fao("!AD",8,q_lln)))
$ if lli .eqs. none then $lli = "(none)"
$ if lln .eqs. none then $lln = "(none)"
$ write sys$output f$fao("!AS,""!AS"",!AS,!AS,!AS" -
,user,owner,account,lli,lln)
$ goto LOOP
$ABORT: exit_status = %x2c
$END: close/nolog uaf_chan
$ exit 'exit_status'
$ERROR: exit_status = $status
$ set noon
$ goto END