HP3000-L Archives

January 1995, Week 2

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:
John Caruso <[log in to unmask]>
Reply To:
John Caruso <[log in to unmask]>
Date:
Tue, 10 Jan 1995 11:51:56 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (69 lines)
In article <H000006600116291@mhs>, Isaac Blake wrote:
>
>All these are nice, and I would like to see some return variables set for
>checking in the CI.  For example you have to either parse the showjob, or do a
>tell to see if a job is running.
 
I wrote a command file, SCAN, to handle this type of requirement.  The
calling sequence is:  SCAN <command>, <search>, <varname>.  The specified
<command> will be executed, and if the text of <search> occurs anywhere
in the output of that command SCAN will return TRUE, otherwise it returns
FALSE.  The return value is stored in the variable whose name is given
by <varname> (SCAN_RESULT is the default).
 
We've found this very useful in our system management jobs and in other
command files.  Some examples:
 
     :SCAN "showjob job=@j", "MAINTJOB,MANAGER.UTIL", maint_running
     :IF maint_running THEN
     :   << whatever >>
     :ENDIF
 
     :SCAN "dsline @", ": REMOTESYS.UMD.EDU", dsline_open
     :IF dsline_open THEN
     :  << more whatever >>
     :ENDIF
 
Here's the command file:
 
------- cut here ---------------------------------------------
PARM !Command="", !Search_Text="", !VAR_Found_Text="SCAN_RESULT"
COMMENT
COMMENT PARAMETERS:
COMMENT    INPUT Command, Search_Text: STRING;
COMMENT    OUTPUT VARIABLE VAR_Found_Text: BOOLEAN
COMMENT
SETVAR !VAR_Found_Text FALSE
PURGE SCANNERS,TEMP > $NULL
BUILD SCANNERS;REC=-80,,V,ASCII;DISC=1023,1,1;MSG;TEMP
FILE SCANNERS,OLDTEMP
SETVAR _Save_MSG_Fence!HPUSERCMDEPTH HPMSGFENCE
SETVAR HPMSGFENCE 2
CONTINUE
!Command > *SCANNERS
SETVAR HPMSGFENCE _Save_MSG_Fence!HPUSERCMDEPTH
DELETEVAR _Save_MSG_Fence!HPUSERCMDEPTH
SETVAR _Line_Total FINFO("*SCANNERS", "EOF")
SETVAR _Current_Line 1
SETVAR _Keep_Going _Line_Total > 0
SETVAR _Line ""
WHILE _Keep_Going DO
   INPUT _Line < *SCANNERS
   IF POS("!Search_Text", _Line) > 0 THEN
      SETVAR !VAR_Found_Text TRUE
      SETVAR _Keep_Going FALSE
   ENDIF
   SETVAR _Current_Line _Current_Line + 1
   SETVAR _Keep_Going _Keep_Going AND (_Current_Line <= _Line_Total)
ENDWHILE
PURGE SCANNERS,TEMP
RESET SCANNERS
DELETEVAR _Line_Total, _Keep_Going, _Current_Line, _Line
------- cut here ---------------------------------------------
 
---------------------------------------------------------------------
 John Caruso                                    [log in to unmask]
 Unix/VMS System Administrator                  caruso@UMUC (Bitnet)
 University of Maryland University College      (301) 985-7447
---------------------------------------------------------------------

ATOM RSS1 RSS2