; PRTAC
;---------------------------------------------------------------
;! prints contents and summaries of the accounting file
;# Task General
;-----------------------------------------------------------------------
;;  Copyright (C) 1995, 1997, 1999-2001, 2003-2004
;;  Associated Universities, Inc. Washington DC, USA.
;;
;;  This program is free software; you can redistribute it and/or
;;  modify it under the terms of the GNU General Public License as
;;  published by the Free Software Foundation; either version 2 of
;;  the License, or (at your option) any later version.
;;
;;  This program is distributed in the hope that it will be useful,
;;  but WITHOUT ANY WARRANTY; without even the implied warranty of
;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;  GNU General Public License for more details.
;;
;;  You should have received a copy of the GNU General Public
;;  License along with this program; if not, write to the Free
;;  Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
;;  MA 02139, USA.
;;
;;  Correspondence concerning AIPS should be addressed as follows:
;;         Internet email: aipsmail@nrao.edu.
;;         Postal address: AIPS Project Office
;;                         National Radio Astronomy Observatory
;;                         520 Edgemont Road
;;                         Charlottesville, VA 22903-2475 USA
;-----------------------------------------------------------------------
PRTAC     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
PRTAC:  Task to print the accounting log file
USERID         -32000.     32000.0 User to print: 32000 -> all
                                      0 -> login complete list
PRTASK                             Restrict to task name(s)
PRTIME             0.0             Restrict to times closer than
                                   PRTIME days; 0 => infinity
OPTYPE                             'INIT' (AIPS Manager only)
                                   'DDT ' Last DDT test only
DOCRT             -3.0       132.0 > 0 => output on terminal
                                   > 72 => terminal width
DOALL             -1.0         1.0 > 0 => display versions
                                   separately, else lump them
OUTPRINT
                                   Printer disk file to save
----------------------------------------------------------------
PRTAC
Type: Task
Use:  Prints contents of accounting file.  If a single user is to be
      printed, then a full list of his activities is printed.  Summaries
      by POPS number, user number, and task name (sorted by CPU and
      occurences) are printed for the requested user or for all users.
      This task can also be run as a stand-alone program and offers in
      that mode a number of extra options.
Adverbs:
  USERID......Selects which user is printed (any user is available even
              on systems with user-owned catalogs).  32000 => print
              summaries only for all users.  0 => login user.  (See
              above)
  PRTASK......Selects the programs whose accounting stats are to be
              printed.  Any program name whose first characters match
              the first non-blank characters of PRTASK will be selected.
              Thus, PRTASK = 'UV' will cause the stats of UVMAP, UVSUB,
              UVCOP, etc. to be printed.  ' ' => all tasks by this rule.
  PRTIME......Selects the time range to be included in the statistics
              and printed.  Include all times more recent than PRTIME
              days, with 0 => infinity.
  OPTYPE......'DDT ' causes only the last regular DDT run to be
              printed.  'Y2K' for the last Y2K run and 'Y2KH' for the
              last HUGE Y2K run.
              For the AIPS Manager only (user number 1).  If OPTYPE =
              'INIT', the file will be initialized if the password is
              entered correctly.  Requires DOCRT true and prints
              whatever is requested first.
  DOCRT......False (<= 0) use the line printer if OUTPRINT = ' '
                   else write named OUTPRINT file only.
                   When OUTPRINT is not blank, DOCRT=-2 suppresses the
                   page-feed character on page headers and DOCRT=-3
                   suppresses page headers and most other header
                   information.
             True  (> 0) use the terminal interactively.  The task will
                   use the actual terminal width as a display limit
                   unless 72 < DOCRT < width.  In that case, the display
                   limit will be DOCRT characters.
  DOALL.......> 0 => list the OLD, NEW, TST versions separately in all
              the summary listings. <= 0 => display only the sum of the
              versions
  OUTPRINT....Disk file name in which to save the line printer output.
              ' ' => use scratch and print immediately for interactive
              jobs - batch jobs use OUTPRINT = 'PRTFIL:BATCHjjj.nnn'
              (jjj = job #, nnn = user #). When OUTPRINT is not blank,
              multiple outputs are concatenated and the file is not
              actually printed.
----------------------------------------------------------------
PRTAC usage in stand-alone mode:

To run the program in stand-alone mode, exit AIPS (if needed) to reach
the shell input level.  Then enter RUN PRTAC.

You will then be prompted for an operation:
   ROPT    Reset parameters to defaults
   SOPT    Set print control parameters
   GO      Print contents of accounting file
   INIT    Initialize the AC file(s)
   QUIT    Exit the program
   HOST    Enter a new host (only after SOPT has set HOST mode)

SOPT options are:
  1. Restrict to a specific task name   blank => all, no min match
  2. Restrict to range of POPS numbers  0 0 => all
  3. Restrict to one user number:       0 => all
        (-999 restricts to an outdated list of NRAO staff)
  4. Restrict to jobs starting after YYYY MM DD HH MM SS
        0 0 0 0 0 0 => 1900 1 1 0 0 0
  5. Restrict to tasks with cpu > x (seconds)  0 => all
  6. Choose types of displays: full LIST, summaries by USERS, POPS,
        TASKS, separate by versions
        (F or T for false or true no default - initial value
        and ROPT value FTTTT
  7. File name to keep printer output   blank => print on printer
  8. Name of computer: blank => current one,
        All => all of this site from HOSTS.LIST, else choose a computer
        An AIPS Manager password is required for the last 2 and the
        last one then allows you to loop over selected computers with
        the HOST option

GO reads the accounting file and does the display.  You can change
options with ROPT or HOST and do additional displays to the same
file (only).  If All hosts are being done, GO will loop over host
names and prompt you on each one asking whether it should be done.
Answer n or N for "no", a or A for "all with no more prompts"; any
other answer will do the current host.  All hosts are summed together
in the summary displays in this mode.  This is appropriate for the new
environment in which each user (more or less) has his/her own
workstation.

INIT prompts for the AIPS Manager password even if one was already
entered.  It then prompts for a time before which the entries are to
be deleted.  0 0 0 0 0 0  => 2050 1 1 0 0 0
After that it does the one computer or loops over all hosts if that
was specified in SOPT.  Again it prompts before each computer and
accepts no or all as answers.

Note that this prompting by machine allows you to keep a computer in
$AIPS_ROOT/HOSTS.LIST even if it is presently unavailable (or, more
exactly, its $NET0/<HOST_NAME>/ACD000000; file is presently
unavailable).  There is another stand-alone program DRCHK that helps
you check the contents of the HOSTS.LIST, DADEVS.LIST, and NETSP files
to make sure that they are consistent and meaningful.
