HP3000-L Archives

June 1998, 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:
Reply To:
Ted Ashton <[log in to unmask]>
Date:
Wed, 10 Jun 1998 10:21:39 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (120 lines)
Thus it was written in the epistle of Curtis Larsen,
> Perl?  What's Perl?  <wicked maniacal laugh>
>
> Seriously though -- what would Perl have over standard MPE JCL in doing
> this?
> (Quick -- somebody write a version of this app in both MPE JCL and Perl
> then compare the two)
> ...And why is this language so gosh-darn popular, anyway?
>
> Just wonderin'.
>
> Curtis ("Maybe I really SHOULD read that Camel book...") Larsen
>

With bait like that, how am I to resist?  Here, take it, I really oughtn't
have . . .

------------------------>8------------------------------------------
#!perl -w

# Grab the OS version
my $version = $ENV{'HPVERSION'};
# Only print 23 lines before asking "Continue?" unless run with -full
$= = ($ARGV[0] eq '-full') ? 5000 : 23;

# Get the current installed patch info
open(SWINFO,'/SYS/PUB/HPSWINFO');
{
  undef local $/;
  $swinfo = <SWINFO>;
}
close SWINFO;

# Open the catalog file
open(CAT,'CATALOG');
# Go through it line by line
while (<CAT>) {
  # Only look at lines starting with "Patch Name:"
  next unless /^Patch Name:/;
  # Only look at lines for the MPE version
  next unless m[$version/(\S+)]oi;
  $patch = $1;
  # Skip it if we already have it
  next if $swinfo =~ /$patch/s;
  # Otherwise, read the description from the following line
  $description = <CAT>;
  $description =~ s/^\s*Desc\S*:\s*//;
  # and write the name and description on the list
  write;
}

# Pause just before each new page
sub pause {
  # Don't pause before the first page
  unless (defined($dopause)) {
    $dopause = 1;
  } else {
    print "Continue? ";
    chomp($_ = <>);
    if (/^n/i) {
      exit;
    }
  }
  return '';
}

# Here is what each page should look like
format STDOUT_TOP =
@~
&pause
---------------------------- Missing Patches -------------------------------
Patch       Description
.
format STDOUT =
@<<<<<<<<<  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$patch,     $description
.
------------------------>8------------------------------------------

Snip it out, save it as PATCHLST and then do

perl PATCHLST

to get a list of missing patches and their descriptions or

perl "PATCHLST -full" > LISTFILE

to get the list without page breaks.

Notes:
  1)  This is quick-hack material.  One hour of coding and testing including
      going and getting the catalog file off of i3107ffs.external.hp.com
      (which was not being at all cooperative).
  2)  One of Perl's mottos is "There is more than one way to do it."  This is
      one way.
  3)  I didn't have it ask one by one about each file.  That would be an easy
      change.  In fact, it might be worthwhile to create a file of patches you
      never want to see and not print those either.  If I do that, I'll pass
      it on.  However, I've documented what most of the lines do above, so as
      to make it as easy as possible to learn from the code and extend it
      yourself.  Feel free to send me questions about it.
  4)  I didn't put it in since my 3000 can't reach the 'net, but it is very
      doable to have perl also go get the catalog file and the patches you
      request.  Check out the LWP module.  Probably better stick with PATCHXL
      or AutoPat for installation, though ;-).
  5)  Yes, you really oughta give the camel book (the perl5 version) a scan.
      Might change your life--it did mine.
  6)  Jeff already answered well with regard to why it's popular.

So, now you've got the perl version.  Give it a quick run and then whip up the
corresponding JCL :-).  (this is in the "better you than me, mate" catagory :-)

Ted
--
Ted Ashton ([log in to unmask]), Info Serv, Southern Adventist University
          ==========================================================
But leaving those of the Body, I shall proceed to such Recreation as adorn
the Mind; of which those of the Mathematicks are inferior to none.
                        -- Leybourn, William (1626-1700)

ATOM RSS1 RSS2