From:	SMTP%"felix.maurer@gd.swissptt.inet.ch" 18-SEP-1996 21:31:02.72
To:	EVERHART
CC:	
Subj:	Reseting error count without rebooting

Date: Wed, 18 Sep 1996 11:29:38 +0200
From: Felix Maurer <felix.maurer@gd.swissptt.inet.ch>
Subject: Reseting error count without rebooting
To: open-vms-sig@DECUS.Org
Errors-to: open-vms-sig-owner@DECUS.Org
Warnings-to: open-vms-sig-owner@DECUS.Org
Message-id: <323FC102.6397@gd.swissptt.inet.ch>
Organization: PTT C33
MIME-version: 1.0
X-Mailer: Mozilla 2.0 (Win16; I)
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7bit
Comments: Send OPEN-VMS-SIG subscribe/unsubscribe requests to mailserv@DECUS.Org

Hello,

I am looking for an OpenVMS utility to clear devices error counts. As devices (SCSI) 
are being fixed online without rebooting, it would be much easier to get a view of 
our 30 AXP systems.

I found the following macro routine, which works fine on VAX's, but it want compile 
on AXP:

	.TITLE ERR
	.SBTTL PROGRAM TO RESET THE ERROR COUNTER OF A SPECIFIED DEVICE
	.LIBRARY	/SYS$LIBRARY:LIB/
	.LINK		"SYS$SYSTEM:SYS.STB" /SE

		$CCBDEF
		$UCBDEF

DEVICE:		.ASCID		/DEVICE/	; logical name to translate
CHANNEL:	.BLKL		1		; assigned channel
DIFF:		.BLKL		1		; aux. field

DUMMY:		.BLKB		255		; dummy for translation result

TABELLE:	.ASCID		/LNM$PROCESS/	; logical name translation

ERG1LEN:	.BLKB		1		; output length of translation

ITEM:		.WORD		255		
		.WORD		2
		.ADDRESS	DUMMY		; translation result
		.ADDRESS	ERG1LEN		; length of string
		.LONG		0		; item list finish

		.ENTRY		START, 0

		$TRNLNM_S -			; translate logical name
			 	TABNAM=TABELLE,-
				LOGNAM=DEVICE,-
				ITMLST=ITEM
		BLBC		R0, ERROR	; if not possible, terminate

		$ASSIGN_S	CHAN=CHANNEL,-	; try to connect a channel
				DEVNAM=DEVICE
		BLBC		R0, ERROR

		$DASSGN_S	CHAN=CHANNEL	; if not possible, terminate
		BLBC		R0, ERROR

; jump with CMKRNL privileges into subroutine

		$CMKRNL_S	ROUTIN=GETUCBINFO
		RET

ERROR:		$EXIT_S		R0		; in case of an error
						; terminate and write
						; error message

GETUCBINFO:	.WORD		0		; go, it means start with
						; CMKRNL privileges
		MOVL		G^CTL$GL_CCBBASE, R1
						; get address of high table
						; address end
		SUBL3		CHANNEL, R1, DIFF
						; building difference to
						; actually UCB pointer
		MOVL		@DIFF, R2	; get value of UCB device
						; address
		MOVW		#0, UCB$W_ERRCNT(R2)
						; reset errorcounter
		MOVL		#SS$_NORMAL, R0	; normal successfull completion
		RET

		.END START


So far I found that system service CTL$GL_CCBBASE has been replaced by 
IOC$CHAN_TO_CCB and that UCB$W_ERRCNT seems to be UCB$L_ERRCNT. I also added the 
required section statements, but i still have no success. The procedure looks like 
this at the moment:

;	Remarque:
;
;	for AXP LINK with the command $ link/sysexe err
;
	.TITLE ERR
	.SBTTL PROGRAM TO RESET THE ERROR COUNTER OF A SPECIFIED DEVICE
	.LIBRARY	/SYS$LIBRARY:LIB/

	.PSECT  RWDATA,NOEXE,WRT,QUAD	; for AXP, FMA

		$CCBDEF
		$UCBDEF

DEVICE:		.ASCID		/DEVICE/	; logical name to translate
CHANNEL:	.BLKL		1		; assigned channel
DIFF:		.BLKL		1		; aux. field

DUMMY:		.BLKB		255		; dummy for translation result

TABELLE:	.ASCID		/LNM$PROCESS/	; logical name translation

ERG1LEN:	.BLKB		1		; output length of translation

ITEM:		.WORD		255		
		.WORD		2
		.ADDRESS	DUMMY		; translation result
		.ADDRESS	ERG1LEN		; length of string
		.LONG		0		; item list finish

	.PSECT  CODE,EXE,NOWRT    ; for AXP
		.ENTRY		START, 0

		$TRNLNM_S -			; translate logical name
			 	TABNAM=TABELLE,-
				LOGNAM=DEVICE,-
				ITMLST=ITEM
		BLBC		R0, ERROR	; if not possible, terminate

		$ASSIGN_S	CHAN=CHANNEL,-	; try to connect a channel
				DEVNAM=DEVICE
		BLBC		R0, ERROR

		$DASSGN_S	CHAN=CHANNEL	; if not possible, terminate
		BLBC		R0, ERROR

; jump with CMKRNL privileges into subroutine

		$CMKRNL_S	ROUTIN=GETUCBINFO
		RET

ERROR:		
	.JSB_ENTRY
		$EXIT_S		R0		; in case of an error
						; terminate and write
						; error message

GETUCBINFO:
	.JSB_ENTRY
				; new code ?	
		CALLS		CHANNEL, G^IOC$CHAN_TO_CCB
		POPL		R1
		BLBC		R1, ERROR
		SUBL3		CHANNEL, R1, DIFF
		MOVL		@DIFF, R2
		MOVW		#0, UCB$L_ERRCNT(R2)
		MOVL		#SS$_NORMAL, R0
		RET

		.END START


As I have no idea of macro language, is there someone out there who could help me.
Any sugestions are welcome.

Felix Maurer
