From:	CSBVAX::CSBVAX::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 13-DEC-1988 00:33
To:	MRGATE::"ARISIA::EVERHART"
Subj:	An updated version of the SHOWDEV utility


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Mon, 12 DEC 88 20:50:52 PDT
Received: from CUNYVM.CUNY.EDU ([128.228.1.2]) by KL.SRI.COM with TCP; Mon, 12 Dec 88 20:24:30 PST
Received: from YMIR.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.1) with BSMTP id 5615; Mon, 12 Dec 88 23:23:55 EDT
Date: Mon, 12 Dec 88 19:00 PST
Message-id: <0091D3C91C9EC6E020601022@YMIR.BITNET>
From: Ned Freed <NED%YMIR.BITNET@CUNYVM.CUNY.EDU>
Subject: An updated version of the SHOWDEV utility
To: info-vax@kl.sri.com
X-VMS-To: IN%"info-vax@kl.sri.com"

The following archive contains an updated version of SHOWDEV, a DCL procedure
that displays almost all the information $GETDVI returns about a device. The
information is formatted to fit on a single 24x80 terminal screen. I had to
update SHOWDEV for my own use,  and since I find it quite useful, I thought it
would also be appropriate to post it as well.

SHOWDEV does not display any GETDVI items unique to VMS 5.0; I have to be able
to run it on both 4.7 and 5.0 at present. It would be possible to put in
conditional display of 5.0-specific items but I didn't bother doing it.

I'd appreciate reports of any problems people have with SHOWDEV.

                                 Ned Freed, ned@ymir.bitnet
                                 Harvey Mudd College


$! ...................... Cut between dotted lines and save....................
$! VAX/VMS archive file created by VMS_SHARE V06.03 20-Oct-1988.
$!
$! VMS_SHARE was written by James Gray (Gray:OSBUSouth@Xerox.COM) from
$! VMS_SHAR by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au).
$!
$! To unpack, simply save, concatinate all parts into one file and
$! execute (@) that file.
$!
$! This archive was created by user NED
$! on 12-DEC-1988 18:51:50.95.
$!
$! It contains the following 1 file:
$!        SHOWDEV.COM
$!
$!==============================================================================
$ SET SYMBOL/SCOPE=( NOLOCAL, NOGLOBAL )
$ VERSION = F$GETSYI( "VERSION" )
$ IF VERSION .GES "V4.4" THEN GOTO VERSION_OK
$ WRITE SYS$OUTPUT "You are running VMS ''VERSION'; ", -
    "VMS_SHARE V06.03 20-Oct-1988 requires VMS V4.4 or higher."
$ EXIT 44
$VERSION_OK:
$ GOTO START
$
$UNPACK_FILE:
$ WRITE SYS$OUTPUT "Creating ''FILE_IS'"
$ DEFINE/USER_MODE SYS$OUTPUT NL:
$ EDIT/TPU/COMMAND=SYS$INPUT/NODISPLAY/OUTPUT='FILE_IS'/NOSECTION -
    VMS_SHARE_DUMMY.DUMMY

b_part := CREATE_BUFFER( "{Part}", GET_INFO( COMMAND_LINE, "file_name" ) );
s_file_spec := GET_INFO( COMMAND_LINE, "output_file" );SET( OUTPUT_FILE
, b_part, s_file_spec );
b_errors := CREATE_BUFFER( "{Errors}" );i_errors := 0;
pat_beg_1 := ANCHOR & "-+-+-+ Beginning";
pat_beg_2 := LINE_BEGIN & "+-+-+-+ Beginning";
pat_end := ANCHOR & "+-+-+-+-+ End";
pat_trail := " " & LINE_END;POSITION( BEGINNING_OF( b_part ) ); LOOP b
:= SEARCH( pat_trail, FORWARD); EXITIF b=0; POSITION( END_OF( b ) )
; LOOP MOVE_HORIZONTAL( -1 ); EXITIF CURRENT_CHARACTER <> ' '; ERASE_CHARACTER
( 1 ); EXITIF CURRENT_OFFSET=0; ENDLOOP; ENDLOOP; POSITION( BEGINNING_OF
( b_part ) ); i_append_line := 0; LOOP EXITIF MARK( NONE ) = END_OF( b_part )
; s_x := ERASE_CHARACTER( 1 );
  IF s_x = "+" THEN r_skip := SEARCH( pat_beg_1, FORWARD, EXACT ); IF r_skip <
> 0 THEN
      s_x := ""; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ERASE_LINE; ENDIF; ENDIF;
  IF s_x = "-" THEN r_skip := SEARCH( pat_end, FORWARD, EXACT ); IF r_skip <
> 0 THEN
      s_x := ""; MOVE_HORIZONTAL( -CURRENT_OFFSET ); m_skip := MARK( NONE )
; r_skip := SEARCH( pat_beg_2, FORWARD, EXACT ); IF r_skip <> 0 THEN POSITION
( END_OF( r_skip ) ); MOVE_HORIZONTAL( -CURRENT_OFFSET ); MOVE_VERTICAL( 1 )
; MOVE_HORIZONTAL( -1 ); ELSE POSITION( END_OF( b_part ) ); ENDIF; ERASE
( CREATE_RANGE( m_skip, MARK( NONE ), NONE ) ); ENDIF; ENDIF;
  IF s_x = "V" THEN
    s_x := ""; IF i_append_line <> 0 THEN APPEND_LINE; MOVE_HORIZONTAL
( -CURRENT_OFFSET ); ENDIF; i_append_line := 1; MOVE_VERTICAL( 1 ); ENDIF;
  IF s_x = "X" THEN
    s_x := ""; IF i_append_line <> 0 THEN APPEND_LINE; MOVE_HORIZONTAL
( -CURRENT_OFFSET ); ENDIF; i_append_line := 0; MOVE_VERTICAL( 1 ); ENDIF;
  IF s_x <> "" THEN i_errors := i_errors + 1; s_text := CURRENT_LINE; POSITION
( b_errors );
    COPY_TEXT( "The following line could not be unpacked properly:" )
; SPLIT_LINE; COPY_TEXT( s_x ); COPY_TEXT( s_text ); POSITION( b_part )
; MOVE_VERTICAL( 1 ); ENDIF; ENDLOOP; POSITION( BEGINNING_OF( b_part ) ); LOOP
  r_x := SEARCH( "`", FORWARD, EXACT ); EXITIF r_x = 0; POSITION( r_x )
; ERASE_CHARACTER( 1 );
  IF CURRENT_CHARACTER = "`" THEN MOVE_HORIZONTAL( 1 ); ELSE COPY_TEXT( ASCII
( INT( ERASE_CHARACTER( 3 ) ) ) ); ENDIF; ENDLOOP; IF i_errors = 0 THEN SET
( NO_WRITE, b_errors, ON ); ELSE POSITION( BEGINNING_OF( b_errors ) );
  COPY_TEXT( FAO( "The following !UL errors were detected while unpacking !AS"
, i_errors, s_file_spec ) ); SPLIT_LINE;
  SET( OUTPUT_FILE, b_errors, "SYS$COMMAND" );ENDIF; EXIT;
$ DELETE VMS_SHARE_DUMMY.DUMMY;*
$ CHECKSUM 'FILE_IS
$ WRITE SYS$OUTPUT " CHECKSUM ", -
  F$ELEMENT( CHECKSUM_IS .EQ. CHECKSUM$CHECKSUM, ",", "failed!,passed." )
$ RETURN
$
$START:
$ FILE_IS = "SHOWDEV.COM"
$ CHECKSUM_IS = 1862423531
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X$       verif = 'F$VERIFY(0)'
X$ ! ShowDev - A command file to show all information about a device.
X$ !
X$ ! Written by Kevin Carosso, @ Hughes S&CG, PWB/Engineering.  12-Oct-1983
X$ ! Extensive modifications by Ned Freed, 12-Dec-1988
X$ !
X$ P1 = P1 + "," + P2 + "," + P3 + "," + P4 + "," + -
X       P5 + "," + P6 + "," + P7 + "," + P8
X$ P1 = f$edit(P1,"COLLAPSE") - ",," - ",," - ",," - ",," - -
X                               ",," - ",," - ",," - ",,"
X$ !
X$ Ask:
X$       if P1 .nes. "" then goto Start
X$               inquire P1 "Device name"
X$`009`009P1 = f$edit(P1,"COLLAPSE")
X$`009`009goto Ask
X$ Start:
X$`009device_number = 0
X$ DoLoop:
X$`009device = f$element(device_number,",",P1)
X$`009if device .eqs. "," then goto DoExit
X$`009if device .eqs. "" then goto DoNext
X$`009if F$GETDVI(device,"EXISTS") then goto Get_info
X$`009`009write SYS$OUTPUT "No such device ''device'"
X$`009`009goto DoNext
X$ Get_info:
X$`009date = F$EXTRACT(0,11,F$TIME())
X$`009l1 = F$LOCATE (".",F$TIME())
X$`009l2 = l1 - 12
X$`009time = F$EXTRACT (12,l2,F$TIME ())
X$`009ver = F$EDIT(F$GETSYI ("VERSION"),"COLLAPSE")
X$`009write SYS$OUTPUT ""
X$`009write SYS$OUTPUT -
X"    VAX/VMS ''ver' device information for ''device', on ''date' at ''time'"
X$`009write SYS$OUTPUT ""
X$ !
X$ FAOSPACES = "                    "
X$ FAONULL[0,32] = 0
X$ FAO1 = F$GETDVI(device,"DEVNAM")
X$ FAO2 = F$GETDVI(device,"OWNUIC")
X$`009Line = F$FAO("Device name: !13AS   " + -
X`009`009     "Owner: !17AS   " + -
X`009`009     "Transactions: !10UL", -
X`009`009F$EXTRACT(0,13-F$LENGTH(FAO1),FAOSPACES)+FAO1, -
X`009`009F$EXTRACT(0,17-F$LENGTH(FAO2),FAOSPACES)+FAO2, -
X                F$GETDVI(device, "TRANSCNT"))
X$`009write SYS$OUTPUT Line
X$ !
X$ FAO2 = F$GETDVI(device,"PID") - FAONULL
X$`009Line = F$FAO("Unit number:      !8UL   " + -
X`009`009     "Owner PID: !13AS   " + -
X`009`009     "Operations:   !10UL", -
X`009`009F$GETDVI(device,"UNIT"), -
X`009`009F$EXTRACT(0,13-F$LENGTH(FAO2),FAOSPACES)+FAO2, -
X`009`009F$GETDVI(device, "OPCNT"))
X$`009write SYS$OUTPUT Line
X$ !
X$ FAO2 = F$GETDVI(device, "ACPPID") - FAONULL
X$`009Line = F$FAO("Serial number:    !8UL   " + -
X`009`009     "ACP PID: !15AS   " + -
X`009`009     "References:   !10UL", -
X`009`009F$GETDVI(device,"SERIALNUM"), -
X`009`009F$EXTRACT(0,15-F$LENGTH(FAO2),FAOSPACES)+FAO2, -
X`009`009F$GETDVI(device,"REFCNT"))
X$`009write SYS$OUTPUT Line
X$ !
X$ FAO1 = F$GETDVI(device,"SPLDEVNAM")
X$ FAO2 = F$GETDVI(device,"ACPTYPE")
X$`009Line = F$FAO("Spooled to: !14AS   " + -
X`009`009     "ACP type: !14AS   " + -
X`009`009     "Mount count:  !10UL", -
X`009`009F$EXTRACT(0,14-F$LENGTH(FAO1),FAOSPACES)+FAO1, -
X`009`009F$EXTRACT(0,14-F$LENGTH(FAO2),FAOSPACES)+FAO2, -
X`009`009F$GETDVI(device,"MOUNTCNT"))
X$`009write SYS$OUTPUT Line
X$ !
X$`009Line = F$FAO("Protection:  !43AS" + -
X`009`009     "Error count:  !10UL", -
X`009"(" + -
X`009F$GETDVI(device,"VPROT") - "YSTEM"  - "WNER" - "ROUP" - "ORLD" + -
X`009")", -
X`009`009F$GETDVI(device,"ERRCNT"))
X$`009write SYS$OUTPUT Line
X$`009write SYS$OUTPUT ""
X$ !
X$ FAO2 = F$STRING(F$GETDVI(device,"DEVTYPE")) + "/" + -
X         F$STRING(F$GETDVI(device,"DEVCLASS"))
X$`009Line = F$FAO("Sectors:     !10UL   " + -
X                     "Type/class: !11AS   " + -
X                     "Free blocks: !10UL", -
X                F$GETDVI(device,"SECTORS"), -
X`009`009F$EXTRACT(0,11-F$LENGTH(FAO2),FAOSPACES)+FAO2, -
X`009`009F$GETDVI(device, "FREEBLOCKS"))
X$`009write SYS$OUTPUT Line
X$ !
X$`009Line = F$FAO("Tracks:      !10UL   " + -
X                     "Alloc class: !10UL   " + -
X                     "Max blocks:  !10UL", -
X                F$GETDVI(device,"TRACKS"), -
X`009`009F$GETDVI(device,"ALLOCLASS"), -
X`009`009F$GETDVI(device,"MAXBLOCK"))
X$`009write SYS$OUTPUT Line
X$ !           `032
X$`009Line = F$FAO("Cylinders:   !10UL   " + -
X                     "Record size: !10UL   " + -
X                     "Max files:   !10UL", -
X                F$GETDVI(device,"CYLINDERS"), -
X                F$GETDVI(device,"RECSIZ"), -
X`009`009F$GETDVI(device,"MAXFILES"))
X$`009write SYS$OUTPUT Line
X$ !
X$`009Line = F$FAO("Cluster size: !9UL   " + -
X                     "Buffer size: !10UL   " + -
X                     "Host count:   !9UL", -
X                F$GETDVI(device,"CLUSTER"), -
X`009`009F$GETDVI(device,"DEVBUFSIZ"), -
X`009`009F$GETDVI(device,"HOST_COUNT"))
X$`009write SYS$OUTPUT Line
X$`009write SYS$OUTPUT ""
X$ !
X$ FAO1 = F$GETDVI(device,"FULLDEVNAM")
X$ FAO2 = F$GETDVI(device,"LOCKID")
X$`009Line = F$FAO("Full device name: !23AS   " + -
X`009`009     "Lock id: !22AS", -
X`009`009F$EXTRACT(0,23-F$LENGTH(FAO1),FAOSPACES)+FAO1, -
X`009`009F$EXTRACT(0,22-F$LENGTH(FAO2),FAOSPACES)+FAO2)
X$`009write SYS$OUTPUT Line
X$ !
X$ FAO1 = F$GETDVI(device,"LOGVOLNAM")
X$ FAO2 = F$GETDVI(device,"VOLNAM")
X$`009Line = F$FAO("Logical volume name: !20AS   " + -
X`009`009     "Volume name: !18AS", -
X`009`009F$EXTRACT(0,20-F$LENGTH(FAO1),FAOSPACES)+FAO1, -
X`009`009F$EXTRACT(0,18-F$LENGTH(FAO2),FAOSPACES)+FAO2)
X$`009write SYS$OUTPUT Line
X$ !
X$ FAO1 = F$GETDVI(device,"ROOTDEVNAM")
X$`009Line = F$FAO("Root device name: !23AS   " + -
X`009`009     "Volume count:        !10UL", -
X`009`009F$EXTRACT(0,23-F$LENGTH(FAO1),FAOSPACES)+FAO1, -
X`009`009F$GETDVI(device,"VOLCOUNT"))
X$`009write SYS$OUTPUT Line
X$ !
X$ FAO1 = F$GETDVI(device,"NEXTDEVNAM")
X$`009Line = F$FAO("Next device name: !23AS   " + -
X`009`009     "Volume number:       !10UL", -
X`009`009F$EXTRACT(0,23-F$LENGTH(FAO1),FAOSPACES)+FAO1, -
X`009`009F$GETDVI(device,"VOLNUMBER"))
X$`009write SYS$OUTPUT Line
X$ !
X$ FAO1 = F$GETDVI(device,"HOST_NAME")
X$ if FAO1 .eqs. "" then goto NO_PRIMARY_HOST
X$ FAO1 = FAO1 + ", "
X$ if .not.F$GETDVI(device,"HOST_AVAIL") then FAO1 = FAO1 + "un"
X$ FAO1 = FAO1 + "available"
X$ NO_PRIMARY_HOST:
X$ FAO2 = F$GETDVI(device,"HOST_TYPE")
X$`009Line = F$FAO("Primary host name: !22AS   " + -
X`009`009     "Primary host type: !12AS", -
X`009`009F$EXTRACT(0,22-F$LENGTH(FAO1),FAOSPACES)+FAO1, -
X`009`009F$EXTRACT(0,12-F$LENGTH(FAO2),FAOSPACES)+FAO2)
X$`009write SYS$OUTPUT Line
X$ !
X$ FAO1 = F$GETDVI(device,"ALT_HOST_NAME")
X$ if FAO1 .eqs. "" then goto NO_SECONDARY_HOST
X$ FAO1 = FAO1 + ", "
X$ if .not.F$GETDVI(device,"ALT_HOST_AVAIL") then FAO1 = FAO1 + "un"
X$ FAO1 = FAO1 + "available"
X$ NO_SECONDARY_HOST:
X$ FAO2 = F$GETDVI(device,"ALT_HOST_TYPE")
X$`009Line = F$FAO("Secondary host name: !20AS   " + -
X`009`009     "Secondary host type: !10AS", -
X`009`009F$EXTRACT(0,20-F$LENGTH(FAO1),FAOSPACES)+FAO1, -
X`009`009F$EXTRACT(0,10-F$LENGTH(FAO2),FAOSPACES)+FAO2)
X$`009write SYS$OUTPUT Line
X$`009write SYS$OUTPUT ""
X$ !
X$`009Line = F$FAO("Device dependent info 1: !10XL         " + -
X`009`009     "Device char longword 1:  !10XL", -
X`009`009F$GETDVI(device,"DEVDEPEND"), -
X`009`009F$GETDVI(device,"DEVCHAR"))
X$`009write SYS$OUTPUT Line
X$ !
X$`009Line = F$FAO("Device dependent info 2: !10XL         " + -
X                     "Device char longword 2:  !10XL", -
X`009`009F$GETDVI(device,"DEVDEPEND2"), -
X`009`009F$GETDVI(device,"DEVCHAR2"))
X$`009write SYS$OUTPUT Line
X$ !
X$ ! All true or false ones follow:
X$ !
X$`009Line = ""
X$`009if F$GETDVI(device,"ALL") then Line = Line + ",All"
X$`009if F$GETDVI(device,"AVL") then Line = Line + ",Avl"
X$`009if F$GETDVI(device,"CCL") then Line = Line + ",Ccl"
X$`009if F$GETDVI(device,"CONCEALED") then Line = Line + ",Concealed"
X$`009if F$GETDVI(device,"DIR") then Line = Line + ",Dir"
X$`009if F$GETDVI(device,"DMT") then Line = Line + ",Dmt"
X$`009if F$GETDVI(device,"DUA") then Line = Line + ",Dua"
X$`009if F$GETDVI(device,"ELG") then Line = Line + ",Elg"
X$`009if F$GETDVI(device,"FOD") then Line = Line + ",Fod"
X$`009if F$GETDVI(device,"FOR") then Line = Line + ",For"
X$`009if F$GETDVI(device,"GEN") then Line = Line + ",Gen"
X$`009if F$GETDVI(device,"IDV") then Line = Line + ",Idv"
X$`009if F$GETDVI(device,"MBX") then Line = Line + ",Mbx"
X$`009if F$GETDVI(device,"MNT") then Line = Line + ",Mnt"
X$`009if F$GETDVI(device,"NET") then Line = Line + ",Net"
X$`009if F$GETDVI(device,"ODV") then Line = Line + ",Odv"
X$`009if F$GETDVI(device,"OPR") then Line = Line + ",Opr"
X$`009if F$GETDVI(device,"RCK") then Line = Line + ",Rck"
X$`009if F$GETDVI(device,"RCT") then Line = Line + ",Rct"
X$`009if F$GETDVI(device,"REC") then Line = Line + ",Rec"
X$`009if F$GETDVI(device,"REMOTE_DEVICE") then Line = Line + ",Remote"
X$`009if F$GETDVI(device,"RND") then Line = Line + ",Rnd"
X$`009if F$GETDVI(device,"RTM") then Line = Line + ",Rtm"
X$`009if F$GETDVI(device,"SDI") then Line = Line + ",Sdi"
X$`009if F$GETDVI(device,"SERVED_DEVICE") then Line = Line + ",Served"
X$`009if F$GETDVI(device,"SHR") then Line = Line + ",Shr"
X$`009if F$GETDVI(device,"SPL") then Line = Line + ",Spl"
X$`009if F$GETDVI(device,"SQD") then Line = Line + ",Sqd"
X$`009if F$GETDVI(device,"SWL") then Line = Line + ",Swl"
X$`009if F$GETDVI(device,"TRM") then Line = Line + ",Trm"
X$`009if F$GETDVI(device,"WCK") then Line = Line + ",Wck"
X$ !
X$`009Line = Line - ","
X$`009write SYS$OUTPUT "Characteristics: ''Line'"
X$ DoNext:
X$       device_number = device_number + 1
X$`009goto DoLoop
X$ DoExit:
X$`009verif = F$VERIFY (verif)
$ GOSUB UNPACK_FILE
$ EXIT
$!.............................................................................

