HP3000-L Archives

May 2004, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Dave Powell, MMfab" <[log in to unmask]>
Reply To:
Dave Powell, MMfab
Date:
Mon, 17 May 2004 13:26:23 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (180 lines)
I'm not sure if we'll ever get the 'devinfo' & 'spoolinfo' mpe functions
that were requested on the recent improvements ballot, but in the meantime I
have slapped together a couple of command files that might help at some
sites.

Both set variables for some output from mpe commands (showdev & spoolf;show)
and optionally let you wait for the device or spoolfile to have the status
you want.  So for example, you can wait for a tape drive to become
available, check whether it has a writeable tape in it, check whether a
printer is spooled, wait for a terminal to be logged on or off, etc.

The device info file follows.  Its more-or-less tested, but not really
complete -- I can't really write the fine print to capture showdev output
for things we don't do here, like associating & downing devices, or using
IBM labeled tapes.  I can post the spoolfile info cmdfile if anyone is
interested.

:print devwait.syscmd.shr
option  nolist
parm _DEV        =   ""
parm _GOAL       =   'AVAIL'
parm _LIMIT      =   1
parm _SECONDS    =   5
parm _VOLUME     =   ' '

IF   BOUND (DEV_ERRORS)   OR   BOUND (DEV_OK)
     DELETEVAR   DEV_@
ENDIF
FILE  DEVSTATT   =   DEVSTATT, OLDTEMP
IF   FINFO ('*DEVSTATT','EXISTS')
     PURGE DEVSTATT, TEMP
ENDIF

SETVAR   DEV_ERRORS      0
SETVAR   DEV_OK          FALSE
SETVAR   DEV_VALID       FALSE

IF   '!_DEV'     =   "" &
OR    NOT NUMERIC ('!_LIMIT') &
OR    NOT NUMERIC ('!_SECONDS') &
OR    POS ( LFT ('|' + UPS('!_VOLUME') + '     ', 7), &
          '|      |LOUD  |QUIET ')  =   0  THEN
     SETVAR  DEV_ERRORS      DEV_ERRORS  +  1
     SETVAR  DEV_CONTINUE    FALSE
     SETVAR  DEV_STATUS      "*ERROR*"
     ECHO !HPFILE inputs:
     ECHO    1:  LDEV# or device-class(required).  For a class, &
                 shows the highest ldev#.
     ECHO    2:  Status to wait for  (default = 'AVAIL').
     ECHO    3:  # of times to check (default = 1).  0 or 1 &
                 mean one pass with no pause.
     ECHO    4:  # of seconds to pause between tries &
                 (default = 5).  '0' is permitted.
     ECHO    5:  'volume' controls :echoes of status messages
     ECHO        ' '     Show final status only (default)
     ECHO        'QUIET' No messages
     ECHO        'LOUD'  Messages before each pause, and at end.
     ECHO Output:
     ECHO    DEV_STATUS variable - Ldev status when we are done, &
             or '*INVALID*'.
     ECHO    DEV_VALID  variable - true if the ldev exists.
     ECHO    DEV_OK     variable - true if exists at start & has &
             desired status at end.
     ECHO    DEV_NUM    Ldev# of the device.  May matter &
             if requested a device-class.
     ECHO    Other DEV_@ variables indicating ownership, errors, etc.
     ECHO Byproducts:
     ECHO    DEVSTATT temp file, JUNK variable.
     RETURN
ENDIF

BUILD DEVSTATT; CIR; REC=,,F,ASCII; DISC=1; TEMP

SETVAR   DEV_LOOP_CNT    0
SETVAR   DEV_CONTINUE    TRUE

WHILE    DEV_CONTINUE    DO
     SETVAR  DEV_LOOP_CNT    DEV_LOOP_CNT + 1
     IF  DEV_LOOP_CNT        >=  !_LIMIT
         SETVAR  DEV_CONTINUE    FALSE
     ENDIF
     IF  CIERROR     =   1581
         SETJCW      CIERROR     0
     ENDIF
     CONTINUE
     SHOWDEV  !_DEV      >   *DEVSTATT
     IF  CIERROR = 1581  OR  FINFO('*DEVSTATT','EOF') = 0
         SETVAR  DEV_STATUS      '*INVALID*'
         SETVAR  DEV_CONTINUE    FALSE
         SETVAR  DEV_VALID       FALSE
         IF  (DEV_LOOP_CNT = 1)
             SETVAR  DEV_ERRORS  DEV_ERRORS  +  1
         ELSEIF  ('!_GOAL'  =  '*INVALID*')
             SETVAR  DEV_OK      TRUE
         ENDIF
     ELSE
         INPUT   DEV_STATUS_REC  <   *DEVSTATT
         SETVAR  DEV_STATUS_REC  LFT (DEV_STATUS_REC, 80)
         SETVAR  DEV_STATUS      WORD (STR (DEV_STATUS_REC,11,15))
         SETVAR  DEV_VALID       TRUE
         IF  DEV_STATUS      =   UPS ('!_GOAL')
             SETVAR  DEV_CONTINUE    FALSE
             SETVAR  DEV_OK          TRUE
         ENDIF
     ENDIF
     IF  DEV_CONTINUE
         IF  UPS('!_VOLUME') =   'LOUD'
             ECHO LDEV![RHT('       !_DEV',8)]  &
                  Status=![LFT('!DEV_STATUS         ',12)] &
                  after![RHT('   !DEV_LOOP_CNT',4)] passes  &
                  Continue-flag=![LFT('!DEV_CONTINUE   ',5)]
         ENDIF
         PAUSE   !_SECONDS
     ENDIF
ENDWHILE
SETVAR   DEV_OWNER_JOB_ID    ""
SETVAR   DEV_OWNER_FILES     0
IF   DEV_VALID
     SETVAR  DEV_NUM         WORD (DEV_STATUS_REC)
     SETVAR  DEV_OWNER       RTRIM (STR (DEV_STATUS_REC,25,18))
     SETVAR  JUNK            STR (DEV_STATUS_REC, 9, 1)
     SETVAR  DEV_ACCEPTS_JOBS    (JUNK='J') OR (JUNK='A')
     SETVAR  DEV_ACCEPTS_DATA    (JUNK='D') OR (JUNK='A')
     SETVAR  DEV_WRITE_ENABLED   STR (DEV_STATUS_REC,20,3) = '(W)'
     IF  LFT(DEV_OWNER,1)    =   "#"
         SETVAR  DEV_OWNER_JOB_ID    WORD(DEV_OWNER) - ':'
         IF  WORD (DEV_OWNER,,3)     =   'FILES'
             SETVAR  DEV_OWNER_FILES     ![WORD (DEV_OWNER,,2)]
         ENDIF
     ENDIF
ELSE
     SETVAR  DEV_OWNER       ""
     SETVAR  DEV_NUM         0
     SETVAR  DEV_ACCEPTS_JOBS    FALSE
     SETVAR  DEV_ACCEPTS_DATA    FALSE
     SETVAR  DEV_WRITE_ENABLED   FALSE
ENDIF
IF   UPS('!_VOLUME')     <>  'QUIET'
     ECHO LDEV![RHT('       !_DEV',8)]  &
          Status=![LFT('!DEV_STATUS         ',12)] &
          after![RHT('   !DEV_LOOP_CNT',4)] passes  &
          OK-flag=![LFT('!DEV_OK   ',5)] &
          (done)
ENDIF
RETURN
#    'DEVWAIT'   command-file return some status info on a device
#                and/or wait for it to have a requested status.
#                Orig version 11/21/2003,    Dave Powell,  MMfab.
#
#    -   If you think a device might become UNAVAIL, then
#        AVAIL, and you are afraid you might catch it before
#        it becomes UNAVAIL, try something like this:
#            :DEVWAIT 7 UNAVAIL 5 1
#            :DEVWAIT 7 AVAIL   50   5
#
#    -   To verify that a tape drive is ready for a backup, check
#        that 'DEV_WRITE_ENABLED' is true and status is AVAIL.
#
#    -   Max seconds to wait is ( _LIMIT - 1) * _SECONDS.
#
#    -   For immediate answer, specify _LIMIT = 1.  In this
#        case, _SECONDS does not matter.  Ex:
#        'devwait 6 SPOOLED 1 999'
#
#    -   It counts as an error to ask about a device that does
#        not exist at the start, but not to ask about a network
#        session terminal ldev that disappears between checks
#        if the session logs off.
#        Example: DEVWAIT 34 *INVALID* 200 5 LOUD
#
#    ----------------------------------------------
#
#    Still to do:
#    ?   Special status if the device is 3000 :)
#    ?   Wait till 2007 if the device is HP3000 and requested
#        status is 'UNSUPPORTED' :(

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2