From:	SMTP%"smithdm@ldoc03.ldc.dupont.com" 25-SEP-1993 10:27:04.25
To:	EVERHART
CC:	
Subj:	Re: How to get rid of corrupted records in SYSUAF.DAT?

X-Newsgroups: comp.os.vms
From: smithdm@ldoc03.ldc.dupont.com (David M. Smith)
Subject: Re: How to get rid of corrupted records in SYSUAF.DAT?
Message-ID: <1993Sep23.163549.2001@es.dupont.com>
Sender: news@es.dupont.com (USENET News System)
Nntp-Posting-Host: ldoc01.lvs.dupont.com
Reply-To: smithdm@ldoc03.ldc.dupont.com
Organization: DuPont (Opinions are those of the writer only)
Date: Thu, 23 Sep 1993 16:35:49 GMT
Lines: 76
To: Info-VAX@KL.SRI.COM
X-Gateway-Source-Info: USENET

In article <2CA07601.12123@news.service.uci.edu>, iglesias@draco.acs.uci.edu 
(Mike Iglesias) writes:
>A few weeks ago we had some disk problems on our system disk that may
>have causes some records in SYSUAF.DAT to become corrupted (record
>sizes greater than 1412).  I've managed to get rid of one of the records
>by using DCL to open the file, read/delete the bad record, and close it.
>There's another record in the file that is 4096 bytes long, and anytime
>I try to access it via, DCL, CONVERT, DUMP, etc, I get logged out (the
>accounting record says there was a access violation).
>
>Is there anyway to get rid of this record?  I really do not want to go
>back several weeks and restore a backup copy of our SYSUAF file unless
>it's the only way to recover it.  

If you had disk problems, then the RMS structure of the file may be corrupt and
you may strike out, as Carl pointed out.  However, we once had a problem with
some "odd size" records in our SYSUAF.DAT (no idea where they came from) and
wrote two small Fortran programs to deal with them.  Here they are -- no
guarantees at all whether they will work in your case or not.

The first program reads through SYSUAF and displays the username (key) and size
of any record whose size is not 644 (the standard size on our system: 580 bytes
for VMS stuff and 64 bytes user-data, which we don't use).  Requires a SYSUAF
logical name pointing to the file.

----- cut here FIND_ODD_SIZE_RECORDS.FOR -------------------------------------
	implicit none
	character username*12
	integer rsize

	open(unit=1,name='SYSUAF',readonly,shared,
	1   type='old')

10	continue
	read(1,1000,end=900) rsize, username
1000	format(q,4x,a)
	if ( rsize .ne. 644 ) write(6,*) username, rsize
	goto 10
900	close(unit=1)
	call exit
	end
----- cut here FIND_ODD_SIZE_RECORDS.FOR -------------------------------------

I don't have any bad size records, so can't show you the output but it's pretty
obvious.

Aarmed with the username of bad records, you can "resize" such records with the
other program.  It reads in a specified record by username and rewrites it in
the file, overwriting the original record.

----- cut here FIX_ODD_SIZE_RECORDS.FOR --------------------------------------
	implicit none
	character record*644
	character username*12

	open(unit=1,name='SYSUAF',form='unformatted',shared,type='old',
	1   access='keyed')

10	continue
	write(6,*) 'Enter username'
	read(5,'(A)',end=900) username
	read(1,key=username) record(1:580)
	rewrite(1) record
	goto 10

900	call exit
	end
----- cut here FIX_ODD_SIZE_RECORDS.FOR --------------------------------------

For safety sake, I encourage you to try these on a _copy_ of SYSUAF.DAT first
and make sure it fixes your problem.  You should probably also try ANALYZE/RMS
on your SYSUAF.DAT to see if it has RMS structural problems.
--------------------------------------------------------------------------------
David M. Smith  (302) 774-6914  smithdm@wmvx.dnet.dupont.com
DuPont                          (Opinions are those of the writer only)
--------------------------------------------------------------------------------

