From: system@SendSpamHere.ORG
Sent: Wednesday, December 08, 1999 7:34 AM
To: Info-VAX@Mvb.Saic.Com
Subject: Re: how do i reset error couter

In article <82k3hr$27o$2@newsg3.svr.pol.co.uk>, "Peter Abbott" <peter@pahpc.freeserve.co.uk> writes:
>test
>Hoff Hoffman <hoffman@xdelta.zko.dec.nospam> wrote in message
>news:82hn20$mgr$1@mailint03.im.hou.compaq.com...
>>
>> In article <8E948AF79joeyahoocom@news.supernews.com>, joecarlos@yahoo.com
>(Joe) writes:
>> :hi guys this is a laim question but you quys have been so help full that
>> :i stop thinking thanks, ...
>>
>>   Either through an unsupported and architecture- and version-specific
>>   kernel hack -- and no, I don't know where a customer could get this
>>   tool -- or through a system reboot.  The latter is the only supported
>>   approach, but is obviously undesirable in various situations...
>>
>>   An integrated and supported way to clear the error counter might show
>>   up in a future OpenVMS release after V7.2-1 -- this one is under some
>>   discussion here in engineering.  (It's relatively easy code, but so are
>>   the zillions of other simple projects...)
>>
>>   For chuckles, some of the kernel hacks can also set non-zero error
>>   counts -- try setting a non-zero error count on the null device. :-)
>>
>>   Time to add this question to the OpenVMS FAQ -- I've been seeing this
>>   question far too often of late.  If anyone has a pointer to the hack
>>   -- which will be version dependent and might just crash the system
>>   should something go wrong -- please let me know via email and I'll add
>>   that information to the FAQ...
>>
>> --
>>
>>   Please remember to include the OpenVMS version and platform when posting
>>   questions.  Thanks.
>>
>>
>>  --------------------------- pure personal
>opinion ---------------------------
>>    Hoff (Stephen) Hoffman   OpenVMS Engineering
>hoffman#xdelta.zko.dec.com
>>

There is one 'supported' way to do this if you consider the SYSTEM DUMP 
ANALYZER (SDA) and the DELTA debugger to be supported!  ;)  Of course,
the use, in this fashion, of these utilities is likely to be considered
unsupported.

To reset the error count, one needs to determine the system address of 
the error count field.  For a device, this is at an offset within the
device's UCB structure.  On VAX, the field is at an offset symbolically
defined as UCB$W_ERRCNT.  On Alpha, this field's offset is symbolically
defined as UCB$L_ERRCNT.  The former is a word in size; the latter is
a longword.  (Could it be that Alpha devices are more error prone? ;)

You now need to locate the system address of the UCB$%_ERRCNT field of
the device you wish to reset.  Enter SDA.  In the following, you will
see designations in {} separated by a /.  The first item in braces is
to be used on the VAX and the second item should be used on an Alpha.
(ie.  {VAX/Alpha})

$ ANALYZE/SYSTEM
SDA>  READ SYS${SYSTEM/LOADABLE_IMAGES}:SYSDEF.STB
SDA>  SHOW DEVICE <ddnc:>    ! device designation of device with error 
SDA>  EVALUATE UCB+UCB${W/L}_ERRCNT
Hex = hhhhhhhh   Decimal = -dddddddddd         UCB+offset


Record the hexadecimal value 'hhhhhhhh' returned.

You can now exit from SDA and $ RUN SYS$SHARE:DELTA or do what I prefer
to do, issue the following:

SDA> SPAWN RUN SYS$SHARE:DELTA

On both VAX and Alpha, the DELTA debugger will be invoked and will ident-
ify itself.  On Alpha, there will be an Alpha instruction decoded.  For
those unfamiliar with DELTA, it does not have a prompt and only one error
message -- Eh?  (Well, for sake of argument, there might be another error
produced on the console if you're not careful -- aka. a system crash!)

If you are on a VAX, enter the command: [W    
If you are on Alpha, enter the command: [L

These set the prevailing mode to word and longword respectively.  Remem-
ber the UCB${W/L)_ERRCNT differences?

You're now poised to ZAP the error count field.  To do so you need to en-
ter the system address and view its contents.  The format of the command
to do this is of the form:

<IPID>:<hhhhhhhh>/

For an IPID, use the IPID of the SWAPPER process.  It is always: 00010001

Thus, to ZAP the error count, you would enter:

00010001:hhhhhhhh/

When you enter the / SDA will return the content of the address hhhhhhhh.
This should be the error count (in hexadecimal) of the device in question.
If it is not, you did something wrong and I'd suggest you type a carriage
return and then enter the command EXIT to get out of DELTA.  Regroup and
see where your session went awry.

If you entered your address correctly and the error count was returned as
in the following example, you can proceed.

00010001:80D9C6C8/0001                          ! output on VAX    1 error

00010001:80D9C6C8/00000001                      ! output on Alpha  1 error


You can now ZAP the error count by entering a zero and typing a carriage
return.  For example:


00010001:80D9C6C8/0001 0<cr>                    ! output on VAX    1 error

00010001:80D9C6C8/00000001 0<cr>                ! output on Alpha  1 error

Now type the command EXIT and a carriage return.


>>   For chuckles, some of the kernel hacks can also set non-zero error
>>   counts -- try setting a non-zero error count on the null device. :-)

So can the above!  Just type in some value other than zero.

>>   Time to add this question to the OpenVMS FAQ -- I've been seeing this
>>   question far too often of late.  If anyone has a pointer to the hack
>>   -- which will be version dependent and might just crash the system
>>   should something go wrong -- please let me know via email and I'll add
>>   that information to the FAQ...

I've forwarded this technique to 'Hoff' for the FAQ.  

--
VAXman- OpenVMS APE certification number: AAA-0001           VAXman@TMESIS.COM
