GETTING MORE FROM MPE
                by Eugene and Vladimir Volokh, VESOFT
                (1135 S. Beverly Dr.,LA,CA,90035,USA)
        Presented at 1981 HPIUG Conference, Orlando, FL, USA
 Published in "Thoughts & Discourses on HP3000 Software", 1st-4rd ed.


THE BIRTH OF MPEX

In  1980, we were working as application programmers at an HP3000 site
in  Los  Angeles;  the  application  system we  were developing was an
Accounts  Payable  system  in  FORTRAN,  but for the  purposes  of our
discussion,  it could just as well have been any application system in
any language.

The  system was an average-sized one, starting with about 20 programs,
growing   to  25, 30, and finally stabilizing at about 35.  And, while
working  on it, I discovered a rather disconcerting fact about the  HP
3000:

  THE HP3000 IS NOT MADE FOR APPLICATION SYSTEMS DEVELOPMENT.

After  all,   consider  this:  on  the  HP,  you  can compile a single
program,  list a single program, edit a single program, purge it, copy
it,  rename it, release it; but, when it comes to  working  on  entire
application systems, the HP just can't cut the mustard.

For  instance,   let us say one changes the COPYLIB of a COBOL system;
to  put these changes into effect, it is necessary  to  recompile  the
entire   application  system.   The  only  way to do this in MPE is to
recompile  the system program by program, a  very  time-consuming  and
error-prone  task.  What you really want to do is to execute a command
such as

  %COBOL GL@.SOURCE, GL@.PUB

i.e.  'compile   via  COBOL  all  the  files that start with GL in the
SOURCE  group into files with the same name in PUB'.   Similarly,  you
may   sometimes  want  to  list  to  the  line  printer  all  of  your
application  sources.  Instead of doing a /TEXT and /LIST ALL, OFFLINE
of  every source file in your application system, you  would  like  to
type a command like

  %EDIT GL@.SOURCE, LIST ALL,OFFLINE

Other  things   that you ought to be able to do (but are not permitted
to by MPE) on entire application systems spring to mind:

  %EDIT GL@.SOURCE, WHILE; FINDQ "QTY-SOLD"; LIST

to  find all the places where a given variable is  mentioned  in  your
application system, or

  %FCOPY GL@.SOURCE,GL@.ARCHIVE,NEW

to do an online backup of your application sources.

This  is   how VESOFT's MPEX/3000 was born -- out of a need to perform
certain  operations not just on single files, but on ENTIRE  FILESETS,
like GL@.SOURCE.


                           THE MPEX FILESET

As  was   discussed  above,  the MPEX fileset is the heart and soul of
MPEX.   Note that I say "MPEX fileset," not just "fileset."   This  is
because   MPEX  filesets  go far beyond the filesets available in MPE.
In addition to ordinary MPE filesets like

  GL@.SOURCE
  K#######.@.@
  @.@.@

MPEX  filesets can also be "arithmetic expressions" of  MPE  filesets,
where operators may be + (union) and - (exclusion):

  AP@+GL@.SOURCE         <<all the files in either fileset>>
  AP@+GL@.SOURCE-@COPY.@ <<except those that end with COPY>>

Thus, an MPEX command like

  %PURGE K#######.@.@+LOG####.PUB.SYS

will  purge all EDITOR/TDP K-files and all  system  log  files  (%  is
MPEX's prompt, and will be used to indicate MPEX commands).

All  the  filesets that have been mentioned so far select files on the
basis  of  their  names  ONLY.   But, it is  often desirable to select
attributes   other than file names; for instance, you may wish to find
all the files in the system that are bigger than, say, 10,000 sectors.
This can be accomplished by a command such as

  %LISTF @.@.@(DISCSPACE>10000),2

The  part of the fileset  that  is  enclosed  in  parentheses  is  the
selection   criterion,  on  the basis of which files are selected from
the  main fileset.  There are many such selection criteria,  and  they
may be ANDed together, as in this command:

  %LISTF @.@.@(DISCSPACE>10000 and ACCDATE<1/1/83),2

which  finds   all  the files in the system (@.@.@) that use more than
10,000 sectors of disc space and haven't been accessed  since  January
1,   1983.   Other  selection criteria available are CODE (file code),
CREATOR  (file creator),  CREDATE  (creation  date),  DEVICE  (logical
device   on  which  file  resides), MODDATE (last modify date), OUTPRI
(SPOOL  file output priority), PMCAP  (program  file  privileged  mode
capability),   RSTDATE  (last  restore  date), SAVABLE (amount of disc
space  savable), and SECURITY (file released vs. secured).   Thus,  an
extreme example of an MPEX fileset may be found in a command like:

  %EDIT GL@.SOURCE+AP@-@COPY.@(CODE="EDTCT"), LIST ALL,OFFLINE

which  lists  to the line printer all files in GL@.SOURCE and AP@ that
have file code EDTCT except those that end with "COPY."

Thus,  the MPEX fileset is a very powerful tool that can select  files
based on a number of different relevant criteria.


            FROM PROGRAMMER'S TOOL TO SYSTEM MANAGEMENT TOOL

The  first  few MPEX commands that were talked about (COBOL, EDIT, and
FCOPY)  are mostly programmer  and  project  leader  tools,  that  can
greatly   enhance  the program development process.  However, MPEX and
MPEX  filesets offer quite a bit for the account and  system  manager,
too.    One command that has already been mentioned, PURGE, is often a
handy command for the system manager.  With a command like

  %PURGE K#######.@.@+LOG####.PUB.SYS

which  purges all EDITOR/TDP K-files and system log files, the  system
manager   can save quite a bit of space occupied by these files, which
are usually useless.  Or, the system manager can do a

  :STORE @.@.@;*TAPE;DATE<1/1/83
  :RUN MPEX.PUB.VESOFT
  %PURGE @.@.@(ACCDATE<1/1/83)

to  archive to tape all the files that  haven't  been  accessed  since
January   1,  1983  and  then  purge  them.   Other uses for the PURGE
command include

  %PURGE @.@.ACCOUNT

to  clear out all the files in the specified account without  removing
the   accounting structure.  This command can often be used instead of
:PURGEACCT  ACCOUNT, which destroys the accounting structure, and thus
makes files from that account difficult to restore.

Another  feature of the PURGE command, useful for system operators, is
based  on the fact that MPEX allows spool-file  filesets  as  well  as
permanent file filesets.  Thus a command like

  %PURGE $STDLIST.@.@-@.@.PROD(SPOOL.OUTPRI=1)

will  purge  all the $STDLISTs in the system that have output priority
1  except those in the PROD account (the :SPOOL  at  the  end  of  the
fileset indicates that this is a spool-file fileset).

In  addition   to the PURGE command, other MPE commands that have been
extended  to allow  filesets  include  RELEASE,  SECURE,  RENAME,  and
ALTSEC.  However, not only do these commands accommodate filesets, but
they  also make the account or system manager's life easier by waiving
HP's  restriction  that  these  commands  may  be  performed   by  the
creator  of  the  file  only. After all, if a  user has read and write
access  to a file, he can copy   it  and  purge  the  original  --  he
should  certainly  be  allowed  to RENAME it.  Thus, by replacing HP's
rather  illogical creator-only restriction by  one that permits anyone
who  has  read,  write,  and  execute   access  to   RELEASE,  SECURE,
RENAME,   and  ALTSEC   a  file,  MPEX  makes   life  easier  for  its
users  without compromising system security.


           MORE FOR THE SYSTEM MANAGER -- THE LISTF COMMAND

MPE's  :LISTF   command  already  permits  filesets;  however,  MPEX's
extended   %LISTF  command  permits  MPEX's  extended filesets, with +
filesets, - filesets, and selection  criteria.   Thus,  as  was  shown
above,   you  can  use  the %LISTF command on a fileset with selection
criteria  to find all files that use more than  a  certain  amount  of
disc   space,  or  all  files that haven't been accessed since a given
date,  etc.  This ability to list all files by disc space  used,  last
access   date,  etc.  makes  MPEX a very powerful system manager tool,
especially  in the area of saving disc space -- one of  our  customers
reported  that he saved 50 megabytes of disc space by using the %LISTF
command alone!

But,  there is more to the %LISTF command than  just  the  ability  to
list   MPEX filesets.  Say you use the last access date as a selection
criterion;  it is only reasonable that you should be able to list  the
last access date in addition to selecting on it.  With a command like

  %LISTF @.@.@(ACCDATE<1/1/83),3

you  can!    New  modes,  mode 3 to list creator id, last access date,
last  modify date, creation date, and last restore  date;  mode  4  to
list   various  disc  space  utilization information (including device
class,  extent map, suggested blocking factor, etc.); and  mode  5  to
list   program  file  information  (capabilities, maxdata, stack size,
group/account  that last ran this  program,  etc.)  have  been  added,
letting   the  MPEX  user list much file information that is otherwise
unavailable.

Thus,  the %LISTF command, with the ability to specify  MPEX  filesets
and its new modes, is a very powerful system manager tool.


                  ALTERING FILE ATTRIBUTES WITH MPEX

To  complement  the ability to select on many file attributes and list
those  attributes via the new modes of the %LISTF command,  MPEX  also
allows its users to alter vital file attributes.

For  instance,   let  us  say  that  one  wants to move a database set
(called  GLDB05) to device 2 to minimize head contention.  With  MPEX,
you can do this very easily:

  %ALTFILE GLDB05, DEV=2

Of  course,   this  command, like all MPEX commands, can be applied to
filesets as well as single files.

Or, let us say that the file  DATAFILE,  which  has  room  for  10,000
records,  is currently at 9987, and is in danger of imminent overflow.
With MPEX, you can expand the file with one command:

  %ALTFILE DATAFILE, FLIMIT=15000

Alternatively,  if  the file has room for 15,000 records, but contains
only  600 records, much of the room allocated for this file is wasted.
With MPEX, one can do a

  %ALTFILE DATAFILE, FLIMIT=1000

to decrease the file limit, a

  %ALTFILE DATAFILE, SQUEEZE

to  set the file limit to the end of file (saving  as  much  space  as
possible), or a

  %ALTFILE DATAFILE, EXTENTS=32

to  increase   the  number of extents of the file, thus decreasing the
size  of each individual extent and  thus  minimizing  the  amount  of
space   wasted  by  the file without decreasing the file's file limit.
The  EXTENTS keyword is especially applicable to V/3000  forms  files,
which  are built with file limits of 4000, 8000,  or 16,000 and only 8
extents;  thus, a small V/3000 forms file  can waste from 500 to 2,000
sectors of disc space!  A command of the form

  %ALTFILE @.@.@(CODE=VFORM), EXTENTS=32

will  change   all  the  V/3000  forms  files in the system to have 32
extents,  thus potentially saving a lot of disc space.  These keywords
(FLIMIT,  SQUEEZE, and EXTENTS) in addition to  the  BLKFACT  keyword,
which   changes  a  file's  blocking  factor,  and BLKFACT=BEST, which
automatically  sets the file's blocking factor to the one yielding the
most  disc space savings, are also very  powerful  disc  space  saving
options;  one MPEX user reported that by using the %LISTF and %ALTFILE
commands they saved 150 megabytes of disc space!

In  addition to the attributes mentioned above, other file  attributes
can be changed; for instance, let us say that your trusted programmer,
John,      leaves      your      shop.      Naturally,     being     a
security-conscious   system  manager,  you immediately remove the user
JOHN  from the system, only to find that he has created many files and
several  databases.  What you want is to change the creator id of  all
files created by JOHN to MGR.  With MPEX, this is easy:

  %ALTFILE @.@(CREATOR="JOHN"), CREATOR=MGR

Other  file   attributes,  such  as  file  code, lockword, and various
program  file attributes, can also be changed with this  command,  one
of the most powerful in the MPEX arsenal.


ACCESSING MPEX FROM WITHIN EDITOR

One  major   problem  with  HP's  EDITOR   is that one cannot compile,
prepare,  or execute programs from within it.  Thus, to make a  simple
program   modification,  the programmer has to enter EDITOR, /TEXT the
file,  make the modification, /KEEP the file,  /EXIT  EDITOR,  compile
it,  find a compilation error, re-enter EDITOR, re-/TEXT the file, and
so   on.  What would be really desirable is the ability to compile the
file   from  EDITOR without /EXITing and having to re-text the  source
file when one re-enters EDITOR.

MPEX,  however,   permits  its users to compile, :PREP, :RUN, and even
execute  UDCs from within it.  And, VESOFT also provides a  method  of
executing   MPEX commands from within EDITOR (by prefixing them with a
%).    Thus,  a  programmer  may  "live"  in  EDITOR,  doing  all  his
compilation   and  testing  from  within  EDITOR via MPEX.  An example
programmer session would thus be:

  :RUN EDITOR.PUB.VESOFT;LIB=P <<special version of EDITOR>>
  /TEXT SRCFILE
  << make modifications >>
  /KEEP
  /%COBOL SRCFILE,PRGFILE   <<MPEX command, includes :PREP>>
  << compile fails, workfile still contains SRCFILE,
     make more modifications without re-/TEXTing the file >>
  /KEEP
  /%COBOL SRCFILE,PRGFILE   << compile now succeeds >>
  /%RUN PRGFILE

Thus,  the programmer saves the overhead of entering EDITOR,  /EXITing
EDITOR,  and re-/TEXTing the file every time he needs to do a compile.
Thus,   even  if one does not use any of the fileset-handling features
of  MPEX (which are also available from within EDITOR via the  same  %
interface), one can still derive great benefit from MPEX.


SUMMARY

Thus,  MPEX provides the user with many desirable and needed features,
including the ability to

* Compile, EDIT, FCOPY, RENAME, PURGE, RELEASE filesets.

* Select on the basis of various file attributes.

* List various file attributes.

* Change various file attributes.

*  Waive  certain  annoying  and   unneeded security provisions in the
  RENAME, RELEASE, SECURE, and ALTSEC commands.

* PURGE filesets of spool files.

*  Execute MPEX commands,  compiles,  :PREPs,  :RUNs,  and  UDCs  from
  within the EDITOR.

* Save a lot of disc space.

* And much, much more.

MPEX  thus   proves  itself to be an exceptionally powerful and useful
tool for the program developer and the system manager.

Go to Adager's index of technical papers