HP3000-L Archives

April 1999, 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:
Glenn Cole <[log in to unmask]>
Reply To:
Date:
Thu, 15 Apr 1999 17:46:50 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (76 lines)
Cary Marshall asks:

> I'd like to test for the existence of the file in the jobstream right
> after the execution of the program that creates the file, but I have
> a question about the time portion of the file name.  For example, if
> the file is created at 1:06 PM, (the program uses an  ACCEPT TIME to
> ascertain the time), and the job finishes at 1:10 PM, is it even possible
> to then find the file?  That is, is there a way to construct the correct
> file name at some time later than when the file was created?

Yes, this is possible.

The solution shown below uses MPEX, just because it's easier.  You can do
something similar in MPE as well, but it's more of a manual effort (as
opposed to MPEX's built-in support for such tasks) and the MPE-only
solution likely would run marginally slower.


For example,

        %listf FA5####A(credate=today),6 >temp

lists to a temporary file called "temp" the names of all files created
today whose name begins with "FA5", is followed by 4 digits, and ends in
"A".  Even better, it sets the variable MPEXNUMSUCCEEDED to the number of
files that match!

At this point you want the most recent filename, but it's at the end of the
list.  You can use

        :print temp; start=-1 > temp2

to select the last line (i.e., the most recent filename).  Now that we have
the desired filename as the first record in temp2, we can put that in a
variable, and do what we want from there.

Here's an example snippet from a job stream that may use this:

        !# select only the right-most digit from today's date
        !setvar today_1dig  rht( "!hpdate",1 )
        !
        !# get a list of filenames that were created today
        !run mpex.pub.vesoft; info=&
        !    "listf FA![today_1dig]####A(credate=today),6 >temp"
        !
        !# MPEX kindly sets MPEXNUMSUCCEEDED to the num that qualify
        !if MPEXNUMSUCCEEDED <= 0
        !   echo ![chr(27)+"&dB"] No files found
        !else
        !
        !   # get the MOST RECENT filename, which is at the end of the list
        !   print temp; start=-1 > temp2
        !
        !   # ...and put the name into a variable
        !   input fa_filename < temp2
        !
        !   # Have at it!
        !   # Here, we just print the first few lines
        !
        !   print !fa_filename; end=3
        !
        !endif

Again, this only works if you have MPEX.  With straight MPE,
the MPEX step would need to be replaced by a more liberal LISTF,
and an on-the-fly command file to examine the file using
finfo(filename,"intcreated").  It can be done, but it's more work.

Good luck!

--Glenn

.......................................................................

Item Subject: cc:Mail Text

ATOM RSS1 RSS2