*************************************************************
*M* STATS GATHER SYSTEM PERFORMANCE STATISTICS FROM PM'S RAW DATA.
*************************************************************
*P*      NAME:    STATS
*P*      PURPOSE: TO GATHER AND DISPLAY SYSTEM PERFORMANCE DATA ON
*P*               VARIOUS ASPECTS OF CP-V.
*P*      DESCRIPTION: STATS PERFORMS TWO BASIC FUNCTIONS. IT CAN BE
*P*               USED TO DISPLAY SELECTED PERFORMANCE DATA IN REAL
*P*               REAL TIME AND CAN CREATE CHRONOLOGICAL AND SORTED
*P*               SNAPSHOT RECORDS OF PERFORMANCE DATA FOR LATER
*P*               PROCESSING BY THE SUMMARY PROCESSOR.
*P*               STATS WILL PERIODICALLY TAKE SNAPSHOTS OF DATA
*P*               IN THE MONITOR ROOT, ANALYZING AND PROCESSING THE
*P*               DATA TO PRODUCE THE VARIOUS DISPLAYS AND SNAPSHOT
*P*               FILE.
*P*      REFERENCE: SYSTEM MANAGEMENT REFERENCE MANUAL.
****************************************************************
         PCC      0                 ENHANCED FOR D00 BY A REITH
CSDATA   CSECT    0
CSPROC   CSECT    1
LISTALL  SET      0                 FLAG TO DISPLAY PROCS
LISTB    SET      0                 FLAG TO DISPLAY BTERMS PROC
UFLAGS   SET      1
         SYSTEM   UTS
         SYSTEM   BPM
         TITLE    'STATS D00 - PERFORMANCE MONITOR'
*
*        MODULE DEFINITIONS
*
         DEF      CSDATA            MAIN DATA CSECT
         DEF      CSPROC            MAIN PROCEDURE CSECT
         DEF      LSTAR             ENTRY TO COMMAND PROCESSING
         DEF      STATS             MODULE INITIALIZATION ENTRY
         DEF      PATCH             PATCH SPACE
         PAGE
*
*        MODULE REFERENCES
*
*
*        USER STATES
*
         REF      SRT               REAL TIME EXECUTE
         REF      SC0               BRGD X'BF' <PRIO < X'F6'
         REF      SC1               PRIO X'F6'
         REF      SC2               PRIO X'F7'
         REF      SC3               PRIO X'F8'
         REF      SC4               PRIO X'F9'
         REF      SC5               PRIO X'FA'
         REF      SC6               PRIO X'FB'
         REF      SC7               PRIO X'FC'
         REF      SC8               PRIO X'FD'
         REF      SC9               PRIO X'FE'
         REF      SC10              PRIO X'FF'
         REF      SCU               CURRENT USER
         REF      STOB              TERM OUTPUT BLOCKED
         REF      STOBO             TERM OUTPUT OUT OF CORE
         REF      SIOW              I/O WAIT
         REF      SIOMF             MF TOO HIGH
         REF      SW                WAIT (SLEEP)
         REF      STI               TERM INPUT
         REF      STIO              TERM INPUT OUT OF CORE
         REF      SNULL             NULL
*
*        GENERAL SYSTEM REFERENCES
*
         REF      SMUIS             MAX # OF USERS IN SYSTEM
         REF      S:CUIS            CURRENT # OF USERS IN SYSTEM
         REF      S:BUIS            BATCH USERS IN SYSTEM
         REF      S:OUIS            ONLINE USERS IN SYSTEM
         REF      S:GUIS            GHOST USERS IN SYSTEM
         REF      S:BUAIS           MAX BATCH USERS ALLOWED ON SYSTEM
         REF      S:OUAIS           MAX ONLINE USERS ALLOWED ON SYSTEM
         SREF     NSCPU             # OF SECONDARY CPUS
         SREF     SX:SPP            PHYSICAL PAGE # FOR SCPUS
         SREF     SB:STATE          STATE OF SCPUS
         SREF     SH:MAXQ           MAX QUAN FOR SCPUS
         REF      SL:TB             #CHAR FOR TERM BLOCK
         REF      SL:UB             #CHAR FOR TERM UNBLOCK
         REF      SL:QUAN           MAX QUANTUM
         REF      SL:QMIN           MIN QUANTUM
         REF      SL:SQUAN          SWAP QUANTUM
         REF      LPART             # OF BATCH PARTITIONS DEFINED
         REF      PLH:SID           SYSID OF JOB IN BATCH PARTITION
         REF      PLH:QN            BATCH PARTITION QUANTUM TIME
         REF      NOPPGM            USED TO CHECK FOR STATS LOADED
*,*                                 WITH CORRECT MONSTK
         REF      SITEID            SITE ID
         REF      CURBQ             #IOQ ENTRIES IN USE
         REF      GRANPACK          # GRANULES (PACK)
         REF      GRANSYM           # GRANULES (SYMB)
         REF      GRANRAD           # GRANULES (RAD)
         SREF     BUFCNT            #COCBUFS/LINE IN USE
         SREF     LNOL              # OF COC LINES
         REF      M:DO              DO DCB
         REF      M:LO              LO DCB
         REF      M:SI              SI DCB
         PAGE
*
*        CLOCK REFERENCES
*
         REF      C:TINC            C:CTUN-C:TINC IS # OF CLOCK TICKS
         REF      C:CTUN                 SINCE LAST CLOCK3-ZERO.
         REF      C:TIC             # CLOCK-TICKS FROM SYSTEM STARTUP
*,*                                      TO LAST CLOCK3-ZERO.
*
*        PMDAT REFERENCES
*
         REF      C:RT90            90% RESPONSE TIME
         REF      C:ETM             EXECUTION TIME MULTIPLIER
         REF      C:CIT             # OF INTERACTIONS
         REF      C:CITI            # OF INTERACTIVE INTERACTIONS
         REF      C:SCI             CPU TIME INTERACTIVE INTERACTIONS
         PAGE
         REF      C:CAL             # OF CALS ISSUED
         REF      C:CTW             #OF TERM WRITES
         REF      C:RTRW            # OF I/O TO TAPES AND RADS
         REF      C:CSC             # OF SYMB & COOP READS & WRITES
         REF      C:SCO             ON LINE USERS TIME
         REF      C:MSO             ON LINE MONITOR SERVICES
         REF      C:SCB             BATCH USERS TIME
         REF      C:MSB             BATCH MONITOR SERVICES
         REF      C:SCG             COMPUTE TIME - GHOST
         REF      C:MSG             MONITOR SERVICE TIME - GHOST
         REF      C:IDLE            MASTER CPU IDLE TIME
         REF      C:IDLES           MASTER CPU I/O WAIT TIME
         REF      C:IDLEW           MASTER CPU SWAP WAIT TIME
         REF      C:IDLESW          MASTER CPU I/O & SWAP WAIT TIME
         REF      C:MPOOL           #OF MPOOLS IN USE
         REF      C:CFU             # OF CFUS IN USE
         REF      C:TRUNC           # OF TRUNCS
         REF      C:PROCN           PROCESSOR INDEX CELL
*
*        DISTRIBUTION TABLES
*
         REF      CH:DI1            PROC & JIT INSWAP TIME
         REF      CH:DI2            REST OF USER INSWAP TIME
         REF      CH:DI3            INSWAP TIME FROM END OF JIT
         REF      CH:DOT            OUTSWAP TIME
         REF      CH:DOS            #USERS OUT/SWAP
         REF      CH:DRT            RESPONSE TIME
         REF      CH:DIT            INTERACTION TIME
         REF      CH:DTT            TURN AROUND TIME
         REF      CH:DT             THINK & TYPE TIME
         REF      CH:DC             COMPUTE TIME
         REF      CH:DLI            INPUT LENGTH
         REF      CH:DLO            OUTPUT LENGTH
         REF      C:COS             #OUTSWAPS
         REF      C:SRT             RESPONSE TIME
         REF      C:SIT             INTERACTION TIME
         REF      C:STT             TASK TURNAROUND TIME
         REF      C:ST              THINK TYPE TIME
         REF      C:SC              INTERACTIVE COMPUTE TIME
         REF      C:CI              # CHARS INPUT
         REF      C:CO              # CHARS OUTPUT
*
*        SECONDARY CPU PERFORMACE DATA
*
         SREF     C:SIDLE           SECONDARY CPU IDLE TIME
         SREF     C:SUSER           SECONDARY CPU USER EXEC TIME
         SREF     C:SCHED           SECONDARY CPU # OF SCHEDULES
*
*        SHARED PROCESSOR REFERENCES
*
         REF      P:NAME            TEXT NAMES OF SHARED PROCESSORS
         REF      PPROCS            # OF SHARED PROCS+1
         REF      ENDPMPRC          #PROCS MEASURED-DEFED IN PMDAT
         REF      BGNPMPRC          MAXOVLY+5(#MONOVERLAYS+1)
*
*        USER TABLES
*
         REF      UH:FLG            USER FLAGS
         REF      UB:ACP            COMMAND PROC ASSOC WITH USER
         REF      UB:ASP            SP SHARED PROC ASSOC WITH USER
         REF      UB:APR            PROC ASSOC WITH USER
         REF      UB:DB             DEBUGGER ASSOC WITH USER
         REF      UB:PCT            #OF PAGES ASSOC WITH USERS
         REF      UB:US             USER STATE TABLE
*
*        JIT REFERENCES
*
         REF      J:JIT             THE JIT
         REF      J:OVHTIM          SERVICE TIME IN CURRENT QUANTUM
         REF      J:DELTAT          NEG. QUANTUM REMAINING
         REF,1    JB:PRIV           USER PRIVILEGE
*
*        READ AHEAD AND AIR REFERENCES
*
         SREF     RA:AGET           # OF AIR ATTEMPTS
         SREF     RA:SGET           # OF AIR HITS
         SREF     RA:ABNTA          #OF AIRS TIMED OUT
         SREF     SL:AIRTO          TIMEOUT VALUE FOR AIR
         SREF     RA:AINIT          # READ AHEAD ATTEMPTS
         SREF     RA:SINIT          # READ AHEAD STARTS
         SREF     RA:SCHK           # READ AHEAD USED
         SREF     RA:IOW            #I/O WAITS FOR READ AHEAD & AIR
         SREF     RA:IOWA           #I/O WAITS FOR AIR
         SREF     RA:ABNNN          # READ AHEAD NOT USED
         SREF     RA:ABNTR          # READ AHEADS TIMED OUT
         SREF     SL:RATOR          TIMEOUT VALUE FOR READ AHEAD
*
*        MASKS
*
         REF      DOUBLEZERO        DOUBLEWORD OF ZEROS
         REF      M17               MASK
         REF      M16               MASK
         REF      M24               MASK
         REF      Y002              MASK
         REF      X1                MASK
         PAGE
*
*        REGISTER DEFINITIONS
*
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R5       EQU      5
R6       EQU      6
R7       EQU      7
R8       EQU      8
R9       EQU      9
R10      EQU      10
R11      EQU      11
R12      EQU      12
R13      EQU      13
R14      EQU      14
R15      EQU      15
         PAGE
*
*        VIRTUAL PAGE EQUATES
*
F        EQU      X'10000'          BUFFER FOR MONITOR DATA
BSIZE    EQU      X'5FFF'           SIZE OF BUFFER AREA
G        EQU      X'16000'          SAD AREA FOR MONITOR
VPAJIT   EQU      X'F000'           SAD PAGE FOR MONITOR JIT
SVPA1    EQU      X'F200'           SAD PAGE FOR SCPU #1
SVPA2    EQU      X'F400'           SAD PAGE FOR SCPU #2
SVPA3    EQU      X'F600'           SAD PAGE FOR SCPU #3
CTIME    EQU      F                 DATE/TIME OVERWRITE FOR FILE
#HIS     EQU      2                 SYSTEM AND 1 PROCESSOR
         PAGE                        PROC DEFINITIONS
TYPE     CNAME
         PROC
         DISP      %
         USECT    CSDATA
         LIST     LISTALL
TEXTADD  SET      %
LF(2)    TEXTC    ' ',AF(1)
         USECT    CSPROC
LF(1)    LI,R2    TEXTADD
         LB,R1    *R2
         CAL1,1   DO
         LIST     1
         PEND
MOVEM    CNAME
         PROC
         LOCAL    X
LF       EQU      %
         DISP     %
         LIST     LISTALL
         LCI      AF(3)
X        SET      0
         DO       AF(3)
         LM,AF(1) G+X,AF(2)
         STM,AF(1) F+X,AF(2)
X        SET      X+AF(3)
         FIN
         LIST     1
         PEND
         PAGE                        DATA PROCS
RESERVE  CNAME
         PROC
         DISP     %
         LIST     LISTALL
LF(1)    DO1      AF(1)             SET DATA BLOCK = 0
         DATA     0
         LIST     1
         PEND
*
STRING   CNAME                       TEXT STRING WITHOUT LISTING
         PROC
         DISP     %
         LIST     LISTALL
LF(1)    TEXT     AF
         LIST     1
         PEND
*
STRINGC  CNAME                       TEXTC STRING WITHOUT LISTING
         PROC
         DISP     %
         LIST     LISTALL
LF(1)    TEXTC    AF
         LIST     1
         PEND
*
DATUM    CNAME
         PROC
         DISP     %
         LIST     LISTALL
LF(1)    EQU      %
I        DO       NUM(AF)
         DATA     AF(I)
         FIN
         LIST     1
         PEND
*
         PAGE
#DRS     SET      0
DLIST    SET      (,,,,)
DISTBL   CNAME
         PROC
*
*        AF(1) = NEW DISTRIBUTION TABLE IN MONITOR BUFFER AREA
*        AF(2) = OLD DISTRIBUTION TABLE
*        AF(3) = SNAPSHOT DISTRIBUTION TABLE
*        AF(4) = SNAPSHOT DISTRIBUTION TOTAL
*        AF(5) = NUMBER OF DISTRIBUTIONS IN GROUP
*
DLIST    SET      DLIST,(AF(1)+F,AF(2),AF(3),AF(4),AF(5))
#DRS     SET      #DRS+1
         PEND
         SPACE    3
DBUILD   CNAME
         PROC
*
*        GENERATES TABLE ENTRIES FOR DISTBL PROC
*
SS%      SET      %
         USECT    CSPROC
         DISP     %
         LIST     LISTALL
         LOCAL    I
LF(1)    EQU      %
I        DO       #DRS
         DATA     DLIST(I+1,1)      NEW DIST TABLES IN MONITOR
         FIN
LF(2)    EQU      %
I        DO       #DRS
         DATA     DLIST(I+1,2)      OLD DIST IN STATS
         FIN
LF(3)    EQU      %
I        DO       #DRS
         DATA     DLIST(I+1,3)      SNAPSHOT DIST TABLES IN STATS
         FIN
LF(4)    EQU      %
I        DO       #DRS
         DATA     DLIST(I+1,4)      DIST TOTALS FOR SNAPSHOTS
         FIN
LF(5)    EQU      %
I        DO       #DRS
         DATA,1   DLIST(I+1,5)      #OF DIST IN GROUP
         FIN
         BOUND    4
         USECT    SS%
         LIST     1
         PEND
         PAGE
*        GENERATION OF INDICES FOR ACTION ROUTINES IN GET TABLES
*
:L3VTR   CNAME
         PROC
         LOCAL    SZ
SZ       SET      AF(1)-L3START
         ERROR,7,SZ>X'FF'           'TRANSFER VECTOR TOO LARGE'
         DISP     SZ
LF(1)    EQU      SZ
         PEND
         PAGE
COMLIST  SET      (0,0)
#COMMANDS SET     0
COMTBL   CNAME
         PROC
*                 AF(1) - SINGLE CHAR BY WHICH COMMAND IS IDENTIFIED
*                 AF(2) - ROUTINE ENTRY MUST BE > THAN LSTAR
         LOCAL    Z
COMLIST  SET      COMLIST,(AF(1),AF(2))
#COMMANDS SET     #COMMANDS+1
         PEND
         SPACE    1
COMBUILD CNAME
         PROC
*        GENERATES TABLES FROM LIST CREATED BY COMTBL
         LOCAL    I
SS%      SET      %
         USECT    CSPROC
         DISP     %
         LIST     LISTALL
LF(1)    EQU      %
I        DO       #COMMANDS+1
         DATA,1   COMLIST(I,1)
         FIN
         BOUND    4
LF(2)    EQU      %
         DATA,2   COMLIST(1,2)
I        DO       #COMMANDS
         DATA,2   COMLIST(I+1,2)-LSTAR
         FIN
         BOUND    4
         USECT    SS%
         DISP     %
         LIST     1
         PEND
         PAGE
#PRTFLGS SET      0
#SUSE    SET      0
#GRP     SET      0
ALLFLGS  SET      0
GFLGS    SET      1,2,4,8,X'10',X'20',X'40'
IX       DO       NUM(GFLGS)
ALLFLGS  SET      ALLFLGS|GFLGS(IX)
         FIN
#DS      SET      0
DT       SET      0
BLEQU    EQU      '       '
NLIST    SET      (BLEQU,0,0,0,0,0,0,0,0,0,0,0,0,0)
FLIST    SET      0,0
TERMS    CNAME    0
STERMS   CNAME    1
GTERMS   CNAME    2
         PROC
         LOCAL    P,G2,G3,G4,G5,G6,G7,G8,G9,G10,G11,G12,G13,;
                  I,Z,IP,TX
#PRTFLGS SET      #PRTFLGS+1
         DO1      NAME>0
FLIST(NAME)  SET  FLIST(NAME)+1     SUSE,GRP
P        SET      S:KEYS(3,*0,FLAG,BUILD,GET,SCALE,SIDE,SLENGTH,;
                  DIV,DECPT,COLS,DIGITS,LINES,HEAD)
G2,G4,G5,G6,G7,G8,G9,G10,G11,G12,G13     SET     0
         DO1      P(3)<=NUM(AF)
G2       SET      1                 FLAG
G3       SET      X'80'             BUILD
         DO       P(4)<=NUM(AF)
I        DO       NUM(AF(P(4)))-1
TX       SET      AF(P(4),I+1)
Z        SET      GFLGS(TX)
G3       SET      G3|Z
         FIN
         FIN
         DO1      P(5)<=NUM(AF)
G4       SET      AF(P(5),2)        GET
         DO1      P(6)<=NUM(AF)
G5       SET      AF(P(6),2)        SCALE
         DO1      P(7)<=NUM(AF)
G6       SET      AF(P(7),2)        SIDE
         DO1      P(8)<=NUM(AF)
G7       SET      AF(P(8),2)        SLENGTH
         DO1      P(9)<=NUM(AF)
G8       SET      1                 DIV
         DO1      P(10)<=NUM(AF)
G9       SET      1                 DEC
         DO1      P(11)<=NUM(AF)
G10      SET      AF(P(11),2)-1     COLS
         DO1      P(12)<=NUM(AF)
G11      SET      AF(P(12),2)       DIGITS
         DO       P(13)<=NUM(AF)
LF(1)    EQU      AF(P(13),2)       LINES
G12      SET      AF(P(13),2)
         DO       NAME=2
DT       SET      DT+AF(P(13),2)
         DO       #DS(1)=0
#DS      SET      AF(P(13),2)
         ELSE
#DS      SET      #DS,AF(P(13),2)
         FIN
         FIN
         FIN
LF(2)    SET      #PRTFLGS
         DO1      P(14)<=NUM(AF)
G13      SET      AF(P(14),2)       HEAD
NLIST    SET      NLIST,(AF(1),G2,G3,G4,G5,G6,G7,G8,G9,G10,;
                  G11,G12,G13)
#SUSE    SET      FLIST(1)
#GRP     SET      FLIST(2)
         PEND
         PAGE
BTERMS   CNAME
         PROC
         LOCAL    I,X
SS%      SET      %
         USECT    CSDATA
         DISP     %
         LIST     LISTALL+LISTB
         BOUND    8
ATERM    EQU      %
I        DO       #PRTFLGS+1
         TEXT     NLIST(I,1)
         FIN
APRIN    EQU      %
I        DO       #PRTFLGS+1
         DATA,1   NLIST(I,2)
         FIN
         BOUND    4
BUILDT   EQU      %
I        DO       #PRTFLGS+1
         DATA,1   NLIST(I,3)
         FIN
         BOUND    4
AGET     EQU      %
I        DO       #PRTFLGS+1
         DATA     NLIST(I,4)
         FIN
ASCAL    EQU      %
I        DO       #PRTFLGS+1
         DATA     NLIST(I,5)
         FIN
ASIDE    EQU      %
I        DO       #PRTFLGS+1
         DATA     NLIST(I,6)
         FIN
ASIDL    EQU      %
I        DO       #PRTFLGS+1
         DATA     NLIST(I,7)
         FIN
ADIV     EQU      %
I        DO       #PRTFLGS+1
         DATA,1   NLIST(I,8)
         FIN
         BOUND    4
ADEC     EQU      %
I        DO       #PRTFLGS+1
         DATA,1   NLIST(I,9)
         FIN
         BOUND    4
ASAM     EQU      %
I        DO       #PRTFLGS+1
         DATA,1   NLIST(I,10)
         FIN
         BOUND    4
ADIGITS  EQU      %
I        DO       #PRTFLGS+1
         DATA,1   NLIST(I,11)
         FIN
         BOUND    4
ALINES   EQU      %
I        DO       #PRTFLGS+1
         DATA,1   NLIST(I,12)
         FIN
         BOUND    4
AHEAD    EQU      %
I        DO       #PRTFLGS+1
         DATA     NLIST(I,13)
         FIN
ASAVE    EQU      %
I        DO       #PRTFLGS+1
         DATA,1   0
         FIN
         BOUND    4
ASUMN    EQU      %
         DO1      #PRTFLGS+1
         DATA     0
ASUMO    EQU      %
         DO1      #PRTFLGS+1
         DATA     0
         USECT    SS%
         DISP     %
         LIST     1
         PEND
         PAGE                        NAMES FOR PROCESSOR SEARCH
         BOUND    8
PROCS    EQU      %-2
         STRINGC  'BASIC'
         STRINGC  'DELTA'
         STRINGC  'EDIT'
         STRINGC  ':P00'            FDP, FORTRAN DEBUG PACKAGE
         STRINGC  'FORT'
         STRINGC  ':P11'            FORTRAN LIBRARY NAME
         STRINGC  'LINK'
         STRINGC  'LOADER'
         STRINGC  'LOGON'
         STRINGC  'METASYM'
         STRINGC  'PCL'
         STRING   '    '
         STRINGC  'TEXT'
#PROCS   EQU      DA(%)-DA(PROCS)-1
         PAGE
AVAL1    EQU      %-1               POINTERS TO CONTROL PARAM
         DATUM    VHRMN,VMIN
         DATUM    S:BUAIS+F,S:OUAIS+F
         DATUM    AVBATP,AVONLP
         DATUM    SL:TB+F,SL:UB+F
         DATUM    SL:QMIN+F,SL:SQUAN+F
         DATUM    ABQUAN,SL:QUAN+F
         DATUM    VNSCPU,VSCPUA
         DATUM    SL:RATOR+F,SL:AIRTO+F
*SCALING FACTORS
ASCAL1   EQU      %-1
         DATUM    1,1               0=*2 ; OTHERS DIVISION
         DATUM    1,1
         DATUM    2,2               CONVERT PAGES TO K
         DATUM    1,1
         DATUM    0,0
         DATUM    0,0
         DATUM    1,1
         DATUM    1000,1000
         PAGE
*        GENERATION OF INDICES FOR ACTION ROUTINES FOR GET TABLES
*
PLUS     :L3VTR   L3PLUS            X=X+OP(DISP)
PLUSB    :L3VTR   L3PLUSBY          X=X+BYTE OP(DISP)
MINUS    :L3VTR   L3MINUS           X=X-OP(DISP)
TIMES    :L3VTR   L3TIMES           X=X*OP
DIVIDE   :L3VTR   L3DIVID           X=X/OP ROUNDED
ADDTO    :L3VTR   L3ADDTO           OP=OP+X
SAVESUM  :L3VTR   L3SAVES           SUM(R3)=X
NEXT     :L3VTR   L3NEXT            ANEW(R5)=X;R5=R5+1;DISP=0
DONE     :L3VTR   L3DONE
IDISP    :L3VTR   L3IDISP           DISP=OP IMMEDIATE
SAVEZERO :L3VTR   L3SAVEZ           OP=X;X=0
FLAG     :L3VTR   L3FLAG            X=#USERS W. BIT(S) OP
SUMQUEUE :L3VTR   L3SMQ
SUMALL   :L3VTR   L3SUMALL
TABLE    :L3VTR   L3TABLE
SUMDISP  :L3VTR   L3SUMDISP
MPGET7   :L3VTR   L3GET7
MPGET8   :L3VTR   L3GET8
MPGETS   :L3VTR   L3GETS
         PAGE
*
GROUP31  EQU      %                 SUMMARY DISPLAY
**
         GEN,8,24  PLUS,C:SIT+F     SUM OF INTERACTION TIMES
         GEN,8,24  DIVIDE,=500      IN SECONDS
         GEN,8,24  SAVEZERO,VOSIT   SAVE FOR A DIVISOR
**
         GEN,8,24  PLUS,C:ST+F      THINK - TYPE TIME
         GEN,8,24  DIVIDE,=500      CONVERT TO SECONDS
         GEN,8,24  SAVEZERO,VTYP   SAVE FOR A DIVISOR
**
         GEN,8,24  PLUS,C:CIT+F     # INTERACTIONS
         GEN,8,24  SAVEZERO,VCIT    SAVE FOR DIVISOR
**
         GEN,8,24  PLUS,C:CITI+F    # INTERACTIVE INTERACTIONS
         GEN,8,24  SAVEZERO,VCITI   SAVE FOR DIVISOR
**
         GEN,8,24  PLUS,C:SCI+F     SUM INTERACTIVE COMPUTING
         GEN,8,24  SAVEZERO,VSCI
**
         GEN,8,24  PLUS,S:BUIS+F
         GEN,8,24  SAVEZERO,BATCH   SAVE #OF BATCH USERS
**
         GEN,8,24  PLUS,S:GUIS+F
         GEN,8,24  SAVEZERO,GHOSTS  SAVE # GHOSTS
**
         GEN,8,24  TABLE,UB:ACP+F   ASSOCIATED CONTROL PROCESSORS
         GEN,8,24  SUMDISP,DLOGON
         GEN,8,24  SAVEZERO,LOGON   SAVE # IN LOGON
**
         GEN,8,24  IDISP,0
         GEN,8,24  PLUS,S:CUIS+F    GET TOTAL #
         GEN,8,24  MINUS,S:BUIS+F   MINUS BATCH USERS
         GEN,8,24  MINUS,GHOSTS     MINUS GHOSTS
         GEN,8,24  MINUS,LOGON      MINUS USERS IN LOGON PROCESSOR
         GEN,8,24  SAVEZERO,VLUS
**
         GEN,8,24  PLUS,VLUS        STROBE AT END OF SAMPLE
         GEN,8,24  PLUS,VOLUS       STROBE AT BEGIN OF SAMPLE
         GEN,8,24  TIMES,=5         *10/2 SCALED AND AVERAGED
         GEN,8,24  SAVEZERO,VUAVE   AVERAGE # OF LOGGED USERS
**
         GEN,8,24  PLUS,C:SCB+F
         GEN,8,24  SAVEZERO,VBCPU
**
         GEN,8,24  PLUS,C:SCO+F
         GEN,8,24  SAVEZERO,VCPU
**
         GEN,8,24  PLUS,VTIC
         GEN,8,24  MINUS,VOTIC
         GEN,8,24  SAVEZERO,DTIC
**
         GEN,8,24  PLUS,VBCPU
         GEN,8,24  MINUS,VOBCPU
         GEN,8,24  SAVEZERO,DBAT
**
         GEN,8,24  PLUS,VCPU
         GEN,8,24  MINUS,VOCPU
         GEN,8,24  SAVEZERO,DONL
**
         GEN,8,24  PLUS,VTIC
         GEN,8,24  MINUS,VOTIC
         GEN,8,24  DIVIDE,=500      INTERVAL IN SECONDS
         GEN,8,24  TIMES,VUAVE      APPROX USER LOGGED SECONDS
         GEN,8,24  DIVIDE,=10
         GEN,8,24  PLUS,VOSIT
         GEN,8,24  SAVEZERO,VSIT
*
         GEN,8,24  PLUS,C:RTRW+F
         GEN,8,24  SAVEZERO,VRTRW
*
         GEN,8,24  PLUS,C:MSB+F
         GEN,8,24  SAVEZERO,VBSR
*
         GEN,8,24  PLUS,C:MSO+F
         GEN,8,24  SAVEZERO,VLSR
*
         GEN,8,24  PLUS,VTIC
         GEN,8,24  TIMES,BATCH
         GEN,8,24  SAVEZERO,TICBAT
*
         GEN,8,24  PLUS,VTIC
         GEN,8,24  TIMES,VLUS
         GEN,8,24  SAVEZERO,TICUSR
*
*        DIVISORS FOR THIS GROUP DEFINED BY INSTRUCTIONS AT:
*                 ASUMRYN - FOR OVERALL STATISTICS IN SUMMARY
*                 ASUMRYO - FOR SAMPLE STATISTICS IN SUMMARY
*
* 1                                 # BATCH STREAMS
         GEN,8,24  PLUS,BATCH
         GEN,8,24  TIMES,=10
         GEN,8,24  NEXT,0
* 2                                 # ONLINE USERS
         GEN,8,24  PLUS,VLUS
         GEN,8,24  TIMES,=10
         GEN,8,24  NEXT,0
* 3                                 % CPU/BATCH USER
         GEN,8,24  PLUS,DBAT
         GEN,8,24  TIMES,=1000
         GEN,8,24  DIVIDE,DTIC
         GEN,8,24  DIVIDE,BATCH
         GEN,8,24  NEXT,0
* 4                                 % ONLINE USER
         GEN,8,24  PLUS,DONL
         GEN,8,24  TIMES,=1000
         GEN,8,24  DIVIDE,DTIC
         GEN,8,24  DIVIDE,VLUS
         GEN,8,24  NEXT,0
* 5                                 BATCH EXECUTION/SERVICE
         GEN,8,24  PLUS,C:SCB+F
         GEN,8,24  MINUS,C:MSB+F
         GEN,8,24  NEXT,0
* 6                                 ONLINE EXECUTION/SERVICE
         GEN,8,24  PLUS,C:SCO+F
         GEN,8,24  MINUS,C:MSO+F
         GEN,8,24  NEXT,0
* 7                                 CPU MSEC PER I/O
         GEN,8,24  PLUS,C:SCB+F     TOT BATCH TICS
         GEN,8,24  PLUS,C:SCO+F     +TOT ONLINE TICS
         GEN,8,24  TIMES,=2         *2=CPU MSEC
         GEN,8,24  NEXT,0
* 8                                 ONLINE TIME MIX
         GEN,8,24  PLUS,C:SCO+F     TOT ONLINE TICS
         GEN,8,24  MINUS,C:SCI+F    -INTERACTIVE TICS
         GEN,8,24  NEXT,0
* 9                                 ONLINE INTENSITY
         GEN,8,24  PLUS,C:SCO+F     ONLINE TICS
         GEN,8,24  TIMES,=60        *60 SECS
         GEN,8,24  NEXT,0
* 10                                TASKS PER MINUTE
         GEN,8,24  PLUS,VCIT        # TASKS
         GEN,8,24  TIMES,=60        *60 SECS
         GEN,8,24  NEXT,0
* 11                                % INTERACTIVE TASKS
         GEN,8,24  PLUS,VCITI       # INTERACTIVE TASKS
         GEN,8,24  TIMES,=100       *100 %
         GEN,8,24  NEXT,0
* 12                                90 % RESPONSE
         GEN,8,24  PLUS,C:RT90+F
         GEN,8,24  TIMES,=10
         GEN,8,24  NEXT,0
* 13                                TASK TURNAROUND
         GEN,8,24  PLUS,C:STT+F
         GEN,8,24  DIVIDE,=500      IN SECS
         GEN,8,24  NEXT,0
* 14                                ETMF FOR WHAT ITS WORTH
         GEN,8,24  PLUS,C:ETM+F
         GEN,8,24  TIMES,=10
         GEN,8,24  NEXT,0
         GEN,8,24  DONE,0
         PAGE
GROUP32  EQU      %                 CPU % DISPLAY
* 1               BATCH EXECUTION   SLAVE, MAPPED
         GEN,8,24  PLUS,C:SCB+F
         GEN,8,24  ADDTO,TOTAL
         GEN,8,24  MINUS,C:MSB+F
         GEN,8,24  NEXT,0
* 2               BATCH SERVICE     MASTER, MAPPED
         GEN,8,24  PLUS,C:MSB+F
         GEN,8,24  NEXT,0
* 3               ONLINE EXECUTION  SLAVE, MAPPED
         GEN,8,24  PLUS,C:SCO+F
         GEN,8,24  ADDTO,TOTAL
         GEN,8,24  MINUS,C:MSO+F
         GEN,8,24  NEXT,0
* 4               ONLINE SERVICE    MASTER, MAPPED
         GEN,8,24  PLUS,C:MSO+F
         GEN,8,24  NEXT,0
* 5                                 GHOST COMPUTE
         GEN,8,24 PLUS,C:SCG+F
         GEN,8,24 ADDTO,TOTAL
         GEN,8,24 MINUS,C:MSG+F
         GEN,8,24 NEXT,0
* 6                                 GHOST SERVICE
         GEN,8,24 PLUS,C:MSG+F
         GEN,8,24 NEXT,0
* 7               MONITOR SERVICE   MASTER, UNMAPPED
         GEN,8,24 PLUS,VJOVHTIM
         GEN,8,24 PLUS,VJDELTAT
         GEN,8,24  ADDTO,TOTAL
         GEN,8,24 NEXT,0
* 8                                 IDLE
         GEN,8,24 PLUS,C:IDLE+F
         GEN,8,24  ADDTO,TOTAL
         GEN,8,24 NEXT,0
* 9                                 SWAP WAIT
         GEN,8,24 PLUS,C:IDLES+F
         GEN,8,24  ADDTO,TOTAL
         GEN,8,24 NEXT,0
* 10                                I/O WAIT
         GEN,8,24  PLUS,C:IDLEW+F
         GEN,8,24  ADDTO,TOTAL
         GEN,8,24  NEXT,0
* 11                                I/O WAIT AND SWAP WAIT
         GEN,8,24  PLUS,C:IDLESW+F
         GEN,8,24  ADDTO,TOTAL
         GEN,8,24  NEXT,0
* 12                                TOTAL
         GEN,8,24  PLUS,TOTAL
         GEN,8,24  NEXT,0
*
         GEN,8,24  PLUS,VTIC
         GEN,8,24  SAVESUM,0
         GEN,8,24  DONE,0
         PAGE
GROUP33  EQU      %                 BATCH % CPU TIME BY PROCESSOR
         GEN,8,24 TABLE,11
         GEN,8,24 SUMALL,C:SCB+F
*
         GEN,8,24  PLUS,C:SCB+F
         GEN,8,24  MINUS,TOTAL
         GEN,8,24  NEXT,0
*
         GEN,8,24  PLUS,VTIC
         GEN,8,24  SAVESUM,0
         GEN,8,24  DONE,0
         PAGE
GROUP34  EQU      %                 ONLINE % CPU BY PROCESSOR
         GEN,8,24 TABLE,11
         GEN,8,24 SUMALL,C:SCO+F
*
         GEN,8,24  PLUS,C:SCO+F
         GEN,8,24  MINUS,TOTAL
         GEN,8,24  NEXT,0
*
         GEN,8,24  PLUS,VTIC
         GEN,8,24  SAVESUM,0
         GEN,8,24  DONE,0
         PAGE                        GET TABLES FOR PROCESSOR USERS
GROUP35  EQU      %                 USERS - COUNT USERS ASSOC W. PROC
         GEN,8,24 SUMQUEUE,DBAS
         GEN,8,24 NEXT,0
         GEN,8,24 SUMQUEUE,DDEL
         GEN,8,24 NEXT,0
         GEN,8,24 SUMQUEUE,DEDI
         GEN,8,24 NEXT,0
         GEN,8,24 SUMQUEUE,D:P00
         GEN,8,24 NEXT,0
         GEN,8,24 SUMQUEUE,DFOR
         GEN,8,24 NEXT,0
         GEN,8,24 SUMQUEUE,D:P11
         GEN,8,24 NEXT,0
         GEN,8,24 SUMQUEUE,DLINK
         GEN,8,24 NEXT,0
         GEN,8,24 SUMQUEUE,DLOAD
         GEN,8,24 NEXT,0
         GEN,8,24 SUMQUEUE,DMET
         GEN,8,24 NEXT,0
         GEN,8,24 SUMQUEUE,DPCL
         GEN,8,24 NEXT,0
         GEN,8,24 SUMQUEUE,DTEXT
         GEN,8,24 NEXT,0
* 12              USERS IN CORE
         GEN,8,24 FLAG,JIC          JIT IN CORE FLAG
         GEN,8,24  NEXT,0
*
         GEN,8,24 DONE,0
         PAGE                        GET TABLES FOR I/O RATES
GROUP36  EQU      %                 I/O REQUESTS /MIN DISPLAY
* 1               # SERVICE REQUESTS
         GEN,8,24  PLUS,C:CAL+F
         GEN,8,24 PLUS,DCALT
         GEN,8,24 NEXT,0
* 2               # INTERACTIONS
         GEN,8,24 PLUS,C:CIT+F
         GEN,8,24 NEXT,0
* 3               # CHARACTERS IN
         GEN,8,24 PLUS,C:CI+F
         GEN,8,24 NEXT,0
* 4               # CHARACTERS OUT
         GEN,8,24 PLUS,C:CO+F
         GEN,8,24 NEXT,0
* 5               # TERMINAL WRITES
         GEN,8,24  PLUS,C:CTW+F
         GEN,8,24  NEXT,0
* 6               # I/O ACCESSES
         GEN,8,24 PLUS,C:RTRW+F
         GEN,8,24 NEXT,0
* 7               # TRUNCS
         GEN,8,24 PLUS,C:TRUNC+F
         GEN,8,24 NEXT,0
* 8               # AIR ATTEMPTS
         GEN,8,24 PLUS,RA:AGET+F
         GEN,8,24 NEXT,0
* 9               # AIR HITS
         GEN,8,24 PLUS,RA:SGET+F
         GEN,8,24 NEXT,0
* 10              # SYMBIONT ACCESSES
         GEN,8,24 PLUS,C:CSC+F
         GEN,8,24 NEXT,0
* 11              # INSWAPS
         GEN,8,24  PLUS,TDI2
         GEN,8,24  PLUS,INSWT
         GEN,8,24  SAVEZERO,INSWT
         GEN,8,24  PLUS,INSWT
         GEN,8,24  NEXT,0
* 12              # OUTSWAPS
         GEN,8,24 PLUS,C:COS+F
         GEN,8,24  NEXT,0
**
         GEN,8,24  PLUS,VTIC
         GEN,8,24  SAVESUM,0
         GEN,8,24 DONE,0
         PAGE                        GET TABLES FOR TIMING AVERAGES
GROUP37  EQU      %                 TASK/INTERVAL DISPLAY
         GEN,8,24  PLUS,C:SIT+F     INTERACTION TIME
         GEN,8,24 DIVIDE,=500
         GEN,8,24  NEXT,0
*
         GEN,8,24  PLUS,C:ST+F      THINK TYPE TIME
         GEN,8,24  DIVIDE,=500
         GEN,8,24  NEXT,0
*
         GEN,8,24  PLUS,C:STT+F     TURNAROUND TIME
         GEN,8,24  DIVIDE,=500
         GEN,8,24  NEXT,0
*
         GEN,8,24  PLUS,C:SIT+F     COMPLETION TIME
         GEN,8,24  MINUS,C:ST+F     MINUS THINK/TYPE
         GEN,8,24  DIVIDE,=500
         GEN,8,24  NEXT,0
*
         GEN,8,24  PLUS,C:SRT+F     COMPUTE TIME
         GEN,8,24  TIMES,=2
         GEN,8,24  NEXT,0
*
         GEN,8,24  PLUS,C:SC+F      CPU TIME
         GEN,8,24  TIMES,=2
         GEN,8,24  NEXT,0
*
         GEN,8,24  PLUS,C:CIT+F     # INTERACTIONS IN INTERVAL
         GEN,8,24  SAVESUM,0
         GEN,8,24  DONE,0
         PAGE
GROUP38  EQU      %                 QUEUE - COUNT STATE QUEUE TOTALS
         GEN,8,24  PLUS,VLUS
         GEN,8,24  NEXT,0
*
         GEN,8,24  PLUS,LOGON
         GEN,8,24  NEXT,0
*
         GEN,8,24  PLUS,BATCH
         GEN,8,24  NEXT,0
*
         GEN,8,24  PLUS,GHOSTS
         GEN,8,24  NEXT,0
*                 # INPUTTING
         GEN,8,24  PLUSB,STI
         GEN,8,24  PLUSB,STIO
         GEN,8,24  NEXT,0
*                 # OUTPUTTING
         GEN,8,24  PLUSB,STOB
         GEN,8,24  PLUSB,STOBO
         GEN,8,24  NEXT,0
*                 # COMPUTING
         GEN,8,24 PLUSB,SRT
         GEN,8,24 PLUSB,SC0
         GEN,8,24 PLUSB,SC1
         GEN,8,24 PLUSB,SC2
         GEN,8,24 PLUSB,SC3
         GEN,8,24 PLUSB,SC4
         GEN,8,24 PLUSB,SC5
         GEN,8,24 PLUSB,SC6
         GEN,8,24 PLUSB,SC7
         GEN,8,24 PLUSB,SC8
         GEN,8,24 PLUSB,SCU
         GEN,8,24 NEXT,0
*                 COMPUTE BOUND
         GEN,8,24 PLUSB,SC9
         GEN,8,24 PLUSB,SC10
         GEN,8,24 NEXT,0
*                 I/O USERS
         GEN,8,24 PLUSB,SIOW
         GEN,8,24 PLUSB,SIOMF
         GEN,8,24 NEXT,0
*                 SLEEPING USERS
         GEN,8,24 PLUSB,SW
         GEN,8,24  NEXT,0
         GEN,8,24  DONE,0
         PAGE
GROUP39  EQU      %                 SECONDARY CPU USAGE
         GEN,8,24 MPGET7,C:SUSER+F
         GEN,8,24 MPGET8,C:SIDLE+F
         GEN,8,24 MPGETS,0
         GEN,8,24 PLUS,VTIC
         GEN,8,24 SAVESUM,0
         GEN,8,24 DONE,0
         PAGE
GROUP40  EQU      %                 EVNT RATE FOR SCPU
         GEN,8,24 PLUS,C:CAL+F
         GEN,8,24 NEXT,0
         GEN,8,24 TABLE,NSCPU
         GEN,8,24 SUMALL,DCALT
         GEN,8,24 TABLE,NSCPU+1
         GEN,8,24 SUMALL,C:SCHED-1+F
         GEN,8,24 PLUS,VTIC
         GEN,8,24 SAVESUM,0
         GEN,8,24 DONE,0
         PAGE
GROUP41  EQU      %                 READ AHEAD/AIR DISPLAY
* 1               # AIR ATTEMPTS
         GEN,8,24 PLUS,RA:AGET+F
         GEN,8,24 NEXT,0
* 2               # AIR HITS
         GEN,8,24 PLUS,RA:SGET+F
         GEN,8,24 NEXT,0
* 3               #TIMEOUTS AIR
         GEN,8,24 PLUS,RA:ABNTA+F
         GEN,8,24 NEXT,0
* 4               #RAHD ATTEMPTS
         GEN,8,24 PLUS,RA:AINIT+F
         GEN,8,24 NEXT,0
* 5               #RAHD STARTS
         GEN,8,24 PLUS,RA:SINIT+F
         GEN,8,24 NEXT,0
* 6               #RAHD USED
         GEN,8,24 PLUS,RA:SCHK+F
         GEN,8,24 NEXT,0
* 7               # I/O WAITS FOR RAHD
         GEN,8,24 PLUS,RA:IOW+F
         GEN,8,24 MINUS,RA:IOWA+F
         GEN,8,24 NEXT,0
* 8               #RAHD NOT USED
         GEN,8,24 PLUS,RA:ABNNN+F
         GEN,8,24 NEXT,0
* 9               #RAHD TIMEOUTS
         GEN,8,24 PLUS,RA:ABNTR+F
         GEN,8,24 NEXT,0
*
         GEN,8,24 PLUS,VTIC
         GEN,8,24 SAVESUM,0
         GEN,8,24 DONE,0
         PAGE
GROUP42  EQU      %                 RESOURCES IN USE DISPLAY
* 1                                 # MPOOLS
         GEN,8,24 PLUS,C:MPOOL+F
         GEN,8,24 NEXT,0
* 2                                 #COCBUFS
         GEN,8,24 PLUS,DBUFCNT
         GEN,8,24 NEXT,0
* 3                                 # IOQ ENTRIES
         GEN,8,24 PLUS,CURBQ+F
         GEN,8,24 NEXT,0
* 4                                 # CFUS
         GEN,8,24 PLUS,C:CFU+F
         GEN,8,24 NEXT,0
* 5                                 # GRAN PACK
         GEN,8,24 PLUS,GRANPACK+F
         GEN,8,24 NEXT,0
* 6                                 # GRAN SYMB
         GEN,8,24 PLUS,GRANSYM+F
         GEN,8,24 NEXT,0
* 7                                 # GRAN RAD
         GEN,8,24 PLUS,GRANRAD+F
         GEN,8,24 NEXT,0
         GEN,8,24 DONE,0
         PAGE
*        SNAPSHOT DISTRIBUTION POINTERS
*        AF(1) = NEW DISTRIBUTION TABLE IN MONITOR AREA
*        AF(2) = OLD DISTRIBUTION TABLE
*        AF(3) = SNAPSHOT DISTRIBUTION TABLE
*        AF(4) = DISTRIBUTION TOTAL
*        AF(5) = # OF DISTRIBUTIONS IN GROUP
         DISTBL   CH:DI1,ODI1,SDI1,TDI1,1
         DISTBL   CH:DI3,ODI3,SDI3,TDI3,1
         DISTBL   CH:DOT,ODOT,SDOT,TDOT,1
         DISTBL   CH:DOS,ODOS,SDOS,TDOS,1
         DISTBL   CH:DRT,ODRT,SDRT,TDRT,1
         DISTBL   CH:DIT,ODIT,SDIT,TDIT,1
         DISTBL   CH:DTT,ODTT,SDTT,TDTT,#HIS
         DISTBL   CH:DT,ODT,SDT,TDT,#HIS
         DISTBL   CH:DC,ODC,SDC,TDC,#HIS
         DISTBL   CH:DLI,ODLI,SDLI,TDLI,#HIS
         DISTBL   CH:DLO,ODLO,SDLO,TDLO,#HIS
*
*        LFS ARE NAMES OF POINTER TABLES
*
CHDI,ODI,SDI,TDI,SZDI ;
         DBUILD
         PAGE
AHEAD4   EQU      %-1               POINTERS TO SYS DIST HEADINGS
         DATUM    TSC3,TB1,TS3,TB1  LINE 3 (REVERSE ORDER)
         DATUM    TSC2,TB1,TS2,TB1  LINE 2 (REVERSE ORDER)
         DATUM    TSC1,TB1,TS1,TB1  LINE 1 (REVERSE ORDER)
AHEAD4A  EQU      %-1               POINTERS TO PROC DIST HEADINGS
         DATUM    TSC3,TB1,TP3,TB1  LINE 3 (REVERSE ORDER)
         DATUM    TSC2,TB1,TP2,TB1  LINE 2 (REVERSE ORDER)
         DATUM    TPC1,TB1,TP1,TB1  LINE 1 (REVERSE ORDER)
ADIST4   EQU      %-1               POINTERS TO SYS SUMS
         DATUM    SDLO,SDLI
         DATUM    SDC,SDTT,SDT,SDIT,SDRT
ADIST4A  EQU      %-1               POINTERS TO PROC SUMS
         DATUM    SDLO+8,SDLI+8
         DATUM    SDC+8,SDTT+8,SDT+8,SDIT+8
ATOT4    EQU      %-1               SYSTEM DISTRIB TOTALS
         DATUM    TDLO,TDLI
         DATUM    TDC,TDTT,TDT,TDIT,TDRT
ATOT4A   EQU      %-1               PROC DISTRIB TOTALS
         DATUM    TDLO+1,TDLI+1,TDC+1,TDTT+1,TDT+1
         PAGE
AHEAD5   EQU      %-1               POINTERS TO SWAP DISP HEADINGS
         DATUM    TOT3,TB1,TIN3,TB1  LINE 3 (REV ORDER)
         DATUM    TOT2,TB1,TIN2,TB1  LINE 2 (REV ORDER)
         DATUM    TOT1,TB1,TIN1,TB1  LINE 1 (REV ORDER)
ADIST5   EQU      %-1               POINTERS TO SNAPSHOT DISTRIB
         DATUM    SDI3,SDI2,SDI1,SDOT,SDOS   5 COLUMNS (REV ORDER)
ATOT5    EQU      %-1               SWAP DISTRIBUTION TOTALS
         DATUM    TDI3,TDI2,TDI1,TDOT,TDOS
         PAGE
*CONTROL PARAMETER SIDINGS
TH30     STRINGC  ' PARAM '
T1A      STRINGC  'HOUR:MINUTES         '
         STRINGC  'INTERVAL IN MINUTES  '
         STRINGC  'MAX # BATCH USERS    '
         STRINGC  'MAX # ONLINE USERS   '
         STRINGC  'AVERAGE BATCH SIZE K '
         STRINGC  'AVERAGE ONLINE SIZE K'
         STRINGC  '# CHAR TERM BLOCK    '
         STRINGC  '# CHAR TERM UNBLOCK  '
         STRINGC  'MSEC W/O INTERRUPT   '
         STRINGC  'MSEC SWAP QUANTUM    '
         STRINGC  'AVE BATCH QUANTUM    '
         STRINGC  'MSEC ONLINE COMPUTE  '
         STRINGC  '# CPU ACTIVE         '
         STRINGC  'AVE SCPU QUANTUM MSEC'
         STRINGC  'RAHD TIMEOUT SEC     '
         STRINGC  'AIR TIMEOUT SEC      '
*                 SINGLE ITEM SIDING
T2A      STRINGC  '# OF INTERACTIONS ='
T2B      STRINGC  'MINS SINCE STARTUP='
T2C      STRINGC  'NUMBER OF USERS   ='
T2D      STRINGC  'NUMBER OF ONLINE  ='
T2E      STRINGC  'NUMBER OF BATCH   ='
T2F      STRINGC  'NUMBER OF GHOSTS  ='
T2G      STRINGC  '90% RESPONSE TIME ='
         PAGE
*USE GROUP HEADERS & SIDINGS
TH31     STRINGC  ' SUMMARY              ALL    SNAP'
TS311    STRINGC  'BATCH STREAMS    '
         STRINGC  'ONLINE USERS     '
         STRINGC  '% CPU/BATCH USER '
         STRINGC  '% CPU/ONLINE USER'
         STRINGC  'BATCH EXEC/SERV  '
         STRINGC  'ONLINE EXEC/SERV '
         STRINGC  'CPU MSEC PER I/O '
         STRINGC  'ONLINE TIME MIX  '
         STRINGC  'ONLINE INTENSITY '
         STRINGC  'ONLINE TASKS/MIN '
         STRINGC  '% INTERACTIVE    '
         STRINGC  '90% RESPONSE MSEC'
         STRINGC  'TURNAROUND    SEC'
         STRINGC  'ETMF             '
*
TH32     STRINGC  ' CPU %         ALL  SNAP'
TS321    STRINGC  'BATCH EXEC  '
         STRINGC  'BATCH SERV  '
         STRINGC  'ONLINE EXEC '
         STRINGC  'ONLINE SERV '
         STRINGC  'GHOST EXEC  '
         STRINGC  'GHOST SERV  '
         STRINGC  'MONITOR SERV'
         STRINGC  'IDLE        '
         STRINGC  'SWAP WAIT   '
         STRINGC  'I/O WAIT    '
         STRINGC  'I/O&SWP WAIT'
         STRINGC  'TOTAL       '
 PAGE
TH34     STRINGC  ' ONLINE % ALL  SNAP'
TH33     STRINGC  ' BATCH %  ALL  SNAP'
         USECT    CSDATA
TS331    STRING   '       '
         STRING   '       '
         STRING   '       '
         STRING   '       '
         STRING   '       '
         STRING   '       '
         STRING   '       '
         STRING   '       '
         STRING   '       '
         STRING   '       '
         STRINGC  'USER   '
         STRINGC  'SHARED '
         USECT    CSPROC
TH35     STRINGC  ' USERS   #'
TS351    STRINGC  'BASIC  '
         STRINGC  'DELTA  '
         STRINGC  'EDIT   '
         STRINGC  ':P00   '
         STRINGC  'FORTRAN'
         STRINGC  ':P11   '
         STRINGC  'LINK   '
         STRINGC  'LOADER '
         STRINGC  'METASYM'
         STRINGC  'PCL    '
         STRINGC  'TEXT   '
         STRINGC  'IN CORE'
         PAGE
TH36     STRINGC  ' I/O PER MIN   ALL  SNAP'
TS361    STRINGC  'SERVICE REQ '
         STRINGC  'INTERACTIONS'
         STRINGC  'CHAR IN     '
         STRINGC  'CHAR OUT    '
         STRINGC  'TERM WRITES '
         STRINGC  'I/O ACCESSES'
         STRINGC  '# TRUNCS    '
         STRINGC  'AIR ATTEMPTS'
         STRINGC  'AIR HITS    '
         STRINGC  'SYMBIONT    '
         STRINGC  'IN SWAPS    '
         STRINGC  'OUT SWAPS   '
*
TH37     STRINGC  ' TASK/INTERVAL   ALL   SNAP'
TS371    STRINGC  'INTERACT SEC '
         STRINGC  'THINK-TY SEC '
         STRINGC  'TURNARND SEC '
         STRINGC  'COMPLETE SEC '
         STRINGC  'RESPONSE MSEC'
         STRINGC  'CPU   MSEC   '
*
TH38     STRINGC  ' QUEUE    #'
TS381    STRINGC  'LOGGED  '
         STRINGC  'LOGGING '
         STRINGC  'BATCH   '
         STRINGC  'GHOST   '
         STRINGC  'TERM IN '
         STRINGC  'TERM OUT'
         STRINGC  'COMPUTE '
         STRINGC  'COMP BND'
         STRINGC  'I/O     '
         STRINGC  'SLEEP   '
TH39     STRINGC  ' SCPU USE %    ALL  SNAP'
TS391    STRINGC  'SCPU #1 EXEC'
         STRINGC  'SCPU #1 IDLE'
         STRINGC  'SCPU #1 TOT '
         STRINGC  'SCPU #2 EXEC'
         STRINGC  'SCPU #2 IDLE'
         STRINGC  'SCPU #2 TOT '
         STRINGC  'SCPU #3 EXEC'
         STRINGC  'SCPU #3 IDLE'
         STRINGC  'SCPU #3 TOT '
         USECT    CSDATA
TH40     STRINGC  ' EVENT RATE/MIN  ALL  SNAP'
TS401    STRINGC  'MASTER  CALS  '
TS402    STRINGC  'SCPU #1 CALS  '
         STRINGC  'SCPU #2 CALS  '
         STRINGC  'SCPU #3 CALS  '
TS40M    STRINGC  'MASTER  SCHEDS'
         STRINGC  'SCPU #1 SCHEDS'
         STRINGC  'SCPU #2 SCHEDS'
         STRINGC  'SCPU #3 SCHEDS'
         USECT    CSPROC
TH41     STRINGC  ' RAHD-AIR/MIN    ALL  SNAP'
TS411    STRINGC  '#AIR  ATTEMPTS'
         STRINGC  '#AIR  HITS    '
         STRINGC  '#AIR  TIMEOUTS'
         STRINGC  '#RAHD ATTEMPTS'
         STRINGC  '#RAHD STARTS  '
         STRINGC  '#RAHD USED    '
         STRINGC  '#RAHD I/O WAIT'
         STRINGC  '#RAHD NOT USED'
         STRINGC  '#RAHD TIMEOUTS'
TH42     STRINGC  ' RESOURCES IN USE   #'
TS421    STRINGC  'MPOOLS        '
         STRINGC  'COCBUFS       '
         STRINGC  'IOQ ENTRIES   '
         STRINGC  'CFUS          '
         STRINGC  'GRAN PACK     '
         STRINGC  'GRAN SYMB     '
         STRINGC  'GRAN RAD      '
         PAGE
*  LOG SIDING
         BOUND    8
TD1D     EQU      %-4
         STRINGC  '   <1'
         STRINGC  '   <2'
         STRINGC  '   <5'
         STRINGC  '  <10'
         STRINGC  '  <20'
         STRINGC  '  <50'
         STRINGC  ' <100'
         STRINGC  ' <200'
         STRINGC  ' <500'
         STRINGC  '  <1K'
         STRINGC  '  <2K'
         STRINGC  '  <5K'
         STRINGC  ' <10K'
         STRINGC  '  &UP'
*  LINEAR SIDING
TD4A     EQU      %-4
         STRINGC  '   <5'
         STRINGC  '  <10'
         STRINGC  '  <15'
         STRINGC  '  <20'
         STRINGC  '  <25'
         STRINGC  '  <30'
         STRINGC  '  <35'
         STRINGC  '  <40'
         STRINGC  '  <45'
         STRINGC  '  <50'
         STRINGC  '  <55'
         STRINGC  '  <60'
         STRINGC  '  <65'
         STRINGC  '  &UP'
         PAGE
TD5C     EQU      %-4
         STRINGC  '   =0'
         STRINGC  '   =1'
         STRINGC  '   =2'
         STRINGC  '   =3'
         STRINGC  '   =4'
         STRINGC  '   =5'
         STRINGC  '   =6'
         STRINGC  '   =7'
         STRINGC  '   =8'
         STRINGC  '   =9'
         STRINGC  '  =10'
         STRINGC  '  =11'
         STRINGC  '  =12'
         STRINGC  '  &UP'
         PAGE
TB1      STRINGC  '     '
*
TS1      STRINGC  '<--------SYSTEM--------->'
TS2      STRINGC  ' RESP INTR TYPE TURN  CPU'
TS3      STRINGC  '   MS  SEC  SEC  SEC   MS'
*
TSC1     STRINGC  '<-SYSTEM->'
TSC2     STRINGC  ' INLN OTLN'
TSC3     STRINGC  ' CHAR CHAR'
*
TP1      STRINGC  '<--PROCESSOR-->'
TP2      STRINGC  ' TYPE TURN  CPU'
TP3      STRINGC  '  SEC  SEC   MS'
*
TPC1     STRINGC  '<PROCESS->'
*
TIN1     STRINGC  '<--OUT SWAP--->'
TIN2     STRINGC  '            TOT'
TIN3     STRINGC  '#USERS       MS'
*
TOT1     STRINGC  '<---IN SWAP--->'
TOT2     STRINGC  '  JIT REST  TOT'
TOT3     STRINGC  '   MS   MS   MS'
         PAGE                        TEXT FOR SPECIAL PRINTOUTS
AT3      STRINGC  ' INTERVAL FROM '
AT4      STRINGC  ' TO '
AT5      STRINGC  ' PROCESSOR #'
AT11     STRINGC  ' RECORD # '
AT13     STRINGC  ' STATISTICS ON-LINE '
AT14     STRINGC  ' PARAMETERS AT '
AT21     STRINGC  'STATS SNAPSHOT FILE  STARTED'
AT22     STRINGC  'STATS SNAPSHOT FILE  COMPLETED'
AT24     STRINGC  'STATS SNAPSHOT.:STATS  FILE ERROR'
AT18     STRINGC  'GHOSTSI FILE ERROR - RESTART'
AT19     STRINGC  'GHOSTDO FILE ERROR - RESTART'
AT20     STRINGC  'GHOSTLO FILE ERROR - RESTART'
AT25     STRINGC  ' STATS LOADED WITH WRONG MONSTK'
         BOUND    8
OFF      STRING   '  -      OFF'
         BOUND    8
ON       STRING   '  -  ON     '
TOT4     STRINGC  ' TOT#'
         PAGE
*
*        GENERATION OF TABLES REQUIRED FOR PROCESSING DISPLAYS
*
*        THERE ARE 2 MAJOR PROCS USED. THE FIRST IS REFERENCED
*        BY TERMS,STERMS,GTERMS AND CREATES ENTRIES
*        IN VARIOUS LISTS.
*        THE TABLES THEMSELVES ARE GENERATED BY THE CALL TO
*        BTERMS AFTER THE LAST CALL TO THE LIST BUILDING PROC.
*
*        THE LIST BUILDING PROC IS CALLED BY TERMS FOR THOSE KEYWORDS
*        THAT ARE SPECIALLY CASED I.E PARAM,
*        SYSTEM,PROC,SWAP,SNAPSHOT,REPORT
*        STERMS IS USED FOR THE SINGLE ITEMS DISPLAYS FOR WHICH
*        NO VALUES ARE SAVED IN THE SNAPSHOT BUFFER
*        ALL OTHER DISPLAYS ARE CALLED BY GTERMS
*        THE DISPLAYS WILL BE SUBSEQUENTLY PROCESSED FOR OUTPUT
*        ACCORDING TO THE ORDER IN WHICH THEY ARE GENNERATED
*        BY THE PROC.
*
*        LF(1) IS A SYMBOL WHICH IS EQUATED TO THE NUMBER
*        OF ITEMS IN THE GIVEN DISPLAY AS INDICATED BY THE
*        KEYWORD LINES. IT IS MANDATORY IN ALL GTERMS CALLS
*        AND THE SUM OF ALL THE VALUES IS USED IN ALLOCATING THE
*        SNAPSHOT BUFFER AREAS.
*        LF(2) IS THE INDEX FOR THE KEYWORD'S ENTRY IN THE
*        PARALLEL TABLES GENERATED.
*        AF(1) MUST BE THE TEXT NAME OF THE ITEM. ENOUGH
*        BLANKS MUST BE INCLUDED TO MAKE IT A DOUBLE WORD ENTRY
*        IN THE ATERM TABLE
*
*        THE FOLLOWING IS A DESCRIPTION OF THE KEYWORDS,
*        THE TABLES GENERATED AND THE MEANING OF THE KEYWORDS
*        NOTE THE PROC THAT GENERATES THE ENTRIES DOES NOT
*        PERFORM ERROR CHECKING AND THE TABLES GENERATED ARE NOT
*        DISPLAYED . TO LIST THE TABLES FOR INFORMATION
*        PURPOSES THE FLAG LISTB IN THE BEGINING  OF THE MODULE SHOULD
*        BE SET TO 1
*
* KEYWORD: BUILD,VALUE
* PURPOSE: TO IDENTIFY THE GROUP TO WHICH A DISPLAY BELONGS
* TABLE:   BUILDT
* ENTRY SIZE: BYTE
* VALID #: 1-7
* VALUE GENERATED: # SPECIFIED IS TRANSLATED TO A BIT
*                    COUNTING FROM RT TO LEFT I.E GROUP 1
*                      IS BIT 7; THE BIT 0 IS SET FOR
*                      GROUPS IN WHICH THE KEYWORD IS USED
*
* KEYWORD: FLAG
* PURPOSE: TO IDENTIFY DEFAULT DISPLAYS
* TABLE:   APRIN
* ENTRY SIZE: BYTE
* VALUE GENERATED: IF KEYWORD PRESENT A 1 IS STORED IN THE ENTRY
*
* KEYWORD: GET,ADDRESS
* PURPOSE: TO IDENTIFY STARTING ADDRESS OF GROUP PSEUDO OPS FOR
*          PROCESSING DISPLAYS OR FETCHING SINGLE ITEM VALUE
* TABLE:   AGET
* ENTRY SIZE: WORD
* VALUE GENERATED: VALUE SPECIFIED
* REQUIREMENTS: MUST BE SPECIFIED FOR ALL GTERMS AND STERMS
*               NOT USED FOR TERMS
*
* KEYWORD: SCALE,VALUE
* PURPOSE: TO IDENTIFY SCALING FACTOR TO BE APPLIED TO ALL ITEMS
*          IN A GROUP DISPLAY OR SINGLE ITEM
* TABLE:   ASCAL
* ENTRY SIZE: WORD
* VALUE GENERATED: THE VALUE SPECIFIED
* REQUIREMENTS: MUST BE SPECIFIED FOR STERMS AND GTERMS
*
* KEYWORD: DIV
* PURPOSE: TO IDENTIFY THOSE DISPLAYS IN WHICH THE GIVEN VALUE IS
*          IS DIVIDED BY SOME TOTAL VALUE I.E.,A % DISPLAY
* TABLE: ADIV
* ENTRY SIZE: BYTE
* VALUE GENERATED: A 1 IS STORED IN THE ENTRY IF THE KEYWORD IS PRESENT
*
* KEYWORD: DECPT
* PURPOSE: TO IDENTIFY THOSE DISPLAYS IN WHICH A DECIMAL POINT IS TO BE
*          INSERTED BEFORE THE LAST DIGIT
* TABLE: ADEC
* ENTRY SIZE: BYTE
* VALUE GENERATED: A 1 IS STORED IN THE ENTRY IF THE KEYWORD IS PRESENT
*
* KEYWORD: DIGITS,VALUE
* PURPOSE: TO IDENTIFY MAXIMUM # OF DIGITS IN THE VALUE TO BE DISPLAYED
* TABLE: ADIGITS
* ENTRY SIZE: BYTE
* VALUE GENERATED: THE VALUE SPECIFIED
* REQUIREMENTS: MUST BE SPECIFIED FOR STERMS AND GTERMS
*
* KEYWORD: COLS,VALUE
* PURPOSE: TO INDICATED THE # OF COLUMNS IN A DISPLAY
* TABLE: ASAM
* ENTRY SIZE: BYTE
* VALUE GENERATED: A 0 IS INSERTED IF THE VALUE SPECIFIED IS 1
*                  A 1 IS INSERTED IF THE VALUE SPECIFIED IS 2
*
* KEYWORD: LINES,VALUE
* PURPOSE: TO INDICATE THE NUMBER OF LINES IN A GIVEN DISPLAY
* TABLE: ALINES
* ENTRY SIZE: BYTE
* VALUE GENERATED: VALUE SPECIFIED IS INSERTED IN ENTRY
*                     ALSO LF(1) IF PRESENT IS EQUATED TO VALUE
* REQUIREMENTS: MUST BE SPECIFIED FOR GTERMS ALSO MUST HAVE LF(1)
*
* KEYWORD: HEAD,ADDRESS
* PURPOSE: TO PROVIDE ADDRESS OF TEXTC HEADER TO BE OUTPUT FOR DISPLAY
* TABLE: AHEAD
* ENTRY SIZE: WORD
* VALUE GENERATED: THE ADDRESS SPECIFIED
* REQUIREMENTS: MUST BE SPECIFIED FOR GTERMS
*
* KEYWORD: SIDE,ADDRESS
* PURPOSE: TO PROVIDE STARTING ADDRESS OF SIDING FOR A DISPLAY
* TABLE: ASIDE
* ENTRY SIZE: WORD
* VALUE GENERATED: THE ADDRESS SPECIFIED
* REQUIREMENTS: MUST BE SPECIFIED FOR GTERMS
*
* KEYOWRD: SLENGTH,VALUE
* PURPOSE: TO PROVIDE LENGTH (# WORDS) IN EACH SIDING IN A DISPLAY
* TABLE: ASIDL
* ENTRY SIZE: WORD
* VALUE GENERATED: THE NUMERIC VALUE SPECIFIED
* REQUIREMENTS: MUST BE SPECIFIED FOR GTERMS
*
*        THE FOLLOWING TABLES ARE GENERATED FOR ALL ENTRIES AND
*        INITIALIZED TO ZERO:
*
* TABLE: ASAVE
* ENTRY SIZE: BYTE
* USAGE: ENTRIES IN RANGE OF GTERMS ITEMS ARE USED DYNAMICALLY
*          TO STORE STARTING INDEX FOR THE GROUP DISPLAYS
*          IN AOLD AND ANEW
* TABLE: ASUMN
* ENTRY SIZE: WORD
* USAGE: ENTIRES IN RANGE OF GTERMS ITEMS ARE USED TO STORE THE TOTAL
*        VALUES WHICH ARE TO BE DIVISORS FOR THOSE DISPLAYS
*        IN WHICH DIVISION IS REQUIRED
* TABLE: ASUMO
* ENTRY SIZE: WORD
* USAGE: SAME AS ASUMN - VALUES REPRESENT THOSE FROM PREVIOUS SAMPLE
*
*        IN GENERAL TO ADD A NEW DISPLAY THE GTERMS PROC
*        IS USED TO IDENTIFY THOSE PARAMETERS AS INDICATED ABOVE
*
*        ADDITIONAL TABLES TO BE GENERATED
*
*        THE PSEUDO OP INSTRUCTIONS THE START OF WHICH IS THE ADDRESS
*        IDENTIFIED BY THE KEYWORD GET.
*
*        THE HEADING WHOSE ADDRESS IS IDENTIFIED BY THE KEYWORD HEAD
*
*        THE SIDINGS WHOSE STARTING ADDRESS IS IDENTIFIED
*        BY THE KEYWORD SIDE AND EACH ENTRY OF WHICH IS SLENGTH WORDS
*        IN LENGTH.
         PAGE
D30      TERMS    'PARAM',(SIDE,T1A),(SLENGTH,6),(LINES,16),;
                          (HEAD,TH30),(DIGITS,6)
         STERMS   'CIT  ',(GET,C:CIT+F),(SCALE,1),(SIDE,T2A),(DIGITS,6)
         STERMS   'TIC  ',(FLAG),(BUILD,4),(GET,C:TIC+F),;
                          (SCALE,30000),(SIDE,T2B),(DIGITS,6)
         STERMS   'UC   ',(FLAG),(BUILD,4),(GET,S:CUIS+F),(SCALE,1),;
                          (SIDE,T2C),(DIGITS,6)
         STERMS   'OUC  ',(FLAG),(BUILD,4),(GET,S:OUIS+F),(SCALE,1),;
                         (SIDE,T2D),(DIGITS,6)
         STERMS   'BUC  ',(FLAG),(BUILD,4),(GET,S:BUIS+F),(SCALE,1),;
                         (SIDE,T2E),(DIGITS,6)
         STERMS   'GUC  ',(FLAG),(BUILD,4),(GET,S:GUIS+F),(SCALE,1),;
                         (SIDE,T2F),(DIGITS,6)
         STERMS   'RT90 ',(FLAG),(BUILD,4),(GET,C:RT90+F),(SCALE,1),;
                          (SIDE,T2G),(DIGITS,6)
D31,IXSUM ;
         GTERMS   'SUMMARY',(BUILD,4),(GET,GROUP31),(SCALE,10),;
                          (SIDE,TS311),(SLENGTH,5),(DIV),(DECPT),;
                          (COLS,2),(DIGITS,7),(LINES,14),(HEAD,TH31)
D32      GTERMS   'CPU  ',(FLAG),(BUILD,4),(GET,GROUP32),(SCALE,1000),;
                          (SIDE,TS321),(SLENGTH,4),(DIV),(DECPT),;
                          (COLS,2),(DIGITS,5),(LINES,12),(HEAD,TH32)
D36      GTERMS   'I/O  ',(FLAG),(BUILD,3,4,6),(GET,GROUP36),;
                          (SCALE,30000),(SIDE,TS361),(SLENGTH,4),;
                          (DIV),(COLS,2),(DIGITS,6),;
                          (LINES,12),(HEAD,TH36)
D37      GTERMS   'TASK ',(BUILD,3),(GET,GROUP37),(SCALE,1),;
                          (SIDE,TS371),(SLENGTH,4),(DIV),;
                          (COLS,2),(DIGITS,7),(LINES,6),(HEAD,TH37)
D41      GTERMS   'RAHD ',(BUILD,6),(GET,GROUP41),(SCALE,30000),;
                          (SIDE,TS411),(SLENGTH,4),(DIV),;
                          (COLS,2),(DIGITS,6),(LINES,9),(HEAD,TH41)
D39,IXSCPU ;
         GTERMS   'SCPU ',(BUILD,7),(GET,GROUP39),(SCALE,1000),;
                         (SIDE,TS391),(SLENGTH,4),(DIV),;
                         (DECPT),(COLS,2),(DIGITS,5),;
                         (LINES,9),(HEAD,TH39)
D40,IXEVNT ;
         GTERMS   'EVNT ',(BUILD,7),(GET,GROUP40),(SCALE,30000),;
                          (SIDE,TS401),(SLENGTH,4),(DIV),(COLS,2),;
                          (DIGITS,6),(LINES,8),(HEAD,TH40)
D33      GTERMS   'BATCH',(BUILD,3),(GET,GROUP33),(SCALE,1000),;
                          (SIDE,TS331),(SLENGTH,2),(DIV),(DECPT),;
                          (COLS,2),(DIGITS,5),(LINES,12),(HEAD,TH33)
D34      GTERMS   'ONLINE',(BUILD,3),(GET,GROUP34),(SCALE,1000),;
                         (SIDE,TS331),(SLENGTH,2),(DIV),(DECPT),;
                         (COLS,2),(DIGITS,5),(LINES,12),;
                         (HEAD,TH34)
D35      GTERMS   'USERS',(BUILD,3),(GET,GROUP35),(SCALE,1000),;
                          (SIDE,TS351),(SLENGTH,2),(COLS,1),;
                          (DIGITS,3),(LINES,12),(HEAD,TH35)
D38      GTERMS   'QUEUE',(BUILD,3),(GET,GROUP38),(SCALE,1),;
                          (SIDE,TS381),(SLENGTH,3),(COLS,1),;
                          (DIGITS,3),(LINES,10),(HEAD,TH38)
D42      GTERMS   'RESOURCE',(BUILD,3),(GET,GROUP42),(SCALE,1),;
                             (SIDE,TS421),(SLENGTH,4),(COLS,1),;
                             (DIGITS,7),(LINES,7),(HEAD,TH42)
,IXSYS   TERMS    'SYSTEM',(BUILD,1,2)
,IXPROC  TERMS    'PROC  ',(BUILD,2)
,IXSWAP  TERMS    'SWAP  ',(BUILD,5)
,IXSNAP  TERMS    'SNAPSHOT'
,IXREP   TERMS    'REPORT'
         BTERMS   ATERM,APRIN,BUILDT,AGET,ASCAL,ASIDE,ASIDL,ADIV,;
                  ADEC,ASAM,ADIGITS,ALINES,AHEAD,ASAVE,ASUMN,ASUMO
         PAGE
*        VALID COMMAND TABLE
*                 AF(1)-SINGLE CHAR BY WHICH COMMAND CAN BE IDENTIFIED
*                 AF(2)-ADDRESS OF ROUTINE MUST BE > LSTAR
*
         COMTBL   'A',LADD          ADD
         COMTBL   'B',LSETUP        BUILD
         COMTBL   'C',LCON          CONTROL!
         COMTBL   'D',LUSE          DISPLAY OR DROP
         COMTBL   'E',LEXIT         EXIT
         COMTBL   'F',LFILE         FILE
         COMTBL   'H',LHELP         HELP
         COMTBL   'L',LIST          LIST
         COMTBL   'P',LPRO          PROCEED
         COMTBL   'S',LSETP         SET C:PROCN
         COMTBL   'T',LTIME         TIME
         COMTBL   '*',LSTAR         COMMENT
COMCHAR,BRCOM     COMBUILD
         PAGE
         USECT    CSDATA
*FLAGS AND OTHER VARIABLES
TGRFLGS  DATA,1  ALLFLGS,GFLGS      GENERATES LIST OF FLAGS FOR GROUP
         BOUND    4
DCSX     DATUM    M:DO,M:LO,F:3
FCEXC    DATUM    0                 FLAG; 1 IF C! IN PROCESS
DEPTH    DATUM    0
TOTAL    DATUM    0
VDISP    DATUM    0
MDEPTH   DATUM    0
VINT     DATUM    0                 SNAPSHOT INTERVAL IN SECONDS
VMIN     DATUM    0                 SNAPSHOT INTERVAL IN MINUTES
VTIME    DATUM    0                 LAST TIME IN BCD
VTIME2   DATUM    0                 BINARY;LAST TIME
DTIME    STRINGC  '                '     OLD TIME/DATE
         DATUM    16                BYTE COUNT FOR TIME
TIME     STRING   '                '     CURRENT TIME
VHRMN    DATUM    0
VSIZE    DATUM    0                 SIZE OF NAME OR STRING
VBUFCNT  DATUM    1                 CHARACTER COUNT IN BUFFER
TEMP     DATUM    0
LCOUNT   DATUM    0                 SI LINE COUNT
ISNAP    DATUM    0                 # OF SNAPSHOTS DESIRED
ICOUNT   DATUM    0                 SNAPSHOT INDEX=1,...,C(ISNAP)
BFLG     DATUM    0                 BREAK FLAG=-1 IF BREAK OCCURRED.
PSDWZ    DATUM    0                 TCB/PSD WORD 0 POINTER
LINK     DATUM    0                 SUBROUTINE LINK LOCATION
GHOSTS   DATUM    0                 TEMP FOR # OF GHOST JOBS
BATCH    DATUM    0                 TEMP # OF BATCH USERS
LOGON    DATUM    0                 TEMP FOR LOGON PROCESSOR
ABQUAN   DATUM    0                 CURRENT AVERAGE BATCH QUAN
NLINE    DATUM    0                 LINE COUNTER
TICBAT   DATUM    0
TICUSR   DATUM    0
DTIC     DATUM    0                 TICS IN INTERVAL
DBAT     DATUM    0                 BATCH EXEC+SERV IN INTERVAL
DONL     DATUM    0                 ONLINE EXEC+SERV IN INTERVAL
AVBATP   DATUM    0                 AVERAGE # PAGES PER BATCH USER
AVONLP   DATUM    0                 AVERAGE # PAGES PER ONLINE USER
DBUFCNT  DATUM    0                 #COCBUFS IN USE
STCOUNT  EQU      %                 BYTE TABLE FOR COUNT OF USERS
         DATUM    0,0,0,0,0,0,0,0   IN VARIOUS STATES
VNSCPU   DATUM    1                 #CPUS  ACTIVE
VSCPUA   DATUM    0                 AVE SCPU MSEC QUANTUM
DCALT    DATUM    0                 TOTAL CAL COUNT FOR ALL SCPUS
DCAL1    DATUM    0,0,0             C:CAL VALUES FOR SCPU1,2,3
VSXSPP   DATUM    0,0,0,0           PRIVATE PAGE # FOR EACH SCPU
VJDELTAT DATUM    0
VJOVHTIM DATUM    0
VUAVE    DATUM    0                 AVERAGE OF VLUS,VOLUS
SNAPF    DATUM    0                 WRITE SNAPSHOT FILES
PRNTF    DATUM    0                 PRINT STATISTICAL REPORT
INSWT    DATUM    0                 ACCUM OF INSWAPS
C0FLAG   DATUM    0                 C0 PRIVILEGE USER
         BOUND    8
FTOGEND  DATUM    G+BSIZE,F         VALID PAGE AREA
PGMAP    DATUM    0,0               PAGE MAP BIT TABLE
NKEY     DATUM    0,0
BLANK    STRING   '       '
TXTDUMLM STRINGC  'M:DUMLM'
TIME1    DATUM    0
TIME2    DATUM    0
TIME3    DATUM    0
REGSV    DATUM    0                 STACK PTR FOR PAGING RTN
GVPFPT   DATUM    0                 GVP FPT
CVMFPT   DATUM    0,0               CVM FPT FOR PAGING RTN
         BOUND    8
PTEMP1   DATUM    0                 TEMP CELLS FOR SYSTEM,PROC,SWAP
PTEMP2   DATUM    0                 DISPLAYS
PTEMP3   DATUM    0
LDOLINK  DATUM    0
PROCNAME DATUM    0,0               PROCESSOR NAME BEING MONITORED
PROCNUM  DATUM    0                 INDEX OF PROCESSOR BEING MONITORED
SNAPLNK  DATUM    0                 LINK REGISTER FOR SNAPHIS
         PAGE
DO       GEN,8,24  X'11',M:DO           FPT FOR TERMINAL OUTPUT
         DATUM    X'34000000'
         PZE      *R2               BUFFER ADDRESS
         PZE      *R1               BUFFER SIZE
         DATUM    1
*
ADO      GEN,8,24  X'11',M:DO        FPT FOR TERMINAL OUTPUT
         DATUM    X'34000000'
         PZE      *R2               BUFFER ADDRESS
         PZE      *R1               BUFFER SIZE
         DATUM    0                 ZERO BYTE DISPLACEMENT
*
         PAGE
* SNAPSHOT SUMMARY BUFFER FOR HISTORY FILE PROCESSING.
*
         BOUND    8
SNAPSUM  EQU      %                 SNAPSHOT BUFFER
SNTIME   RES      4                 TEXT  TIME/DATE OF SNAPSHOT
SSITE    RESERVE  2                 SITE ID FROM MONITOR
         DATUM    STOT              LENGTH OF BUFFER IN WORDS
         DATUM    #GRP+1            # GROUPS + PARAM
         DATUM    SDIST1-SNAPSUM    START OF DISTRIBUTION AREA
         DATUM    D30
SDATAS   DATUM    #DS
SCONT    EQU      %-1
         RESERVE  D30
SNAPSUM2 EQU      %-1
         RESERVE  DT
*        SNAPSHOT DISTRIBUTIONS - SYSTEM ONLY
SDIST1   RESERVE  8                 FOR SDI1
SDIST2   RESERVE  8                 FOR SDI2
SDIST3   RESERVE  8*10              FOR SDI3 ->
SPDIST   RESERVE  8*5               FOR PROCESSOR DISTRIBUTIONS
SPNAME   RESERVE  20                PROCESSOR NAMES
SMONDES  RESERVE  1                 MONITOR DESIGNATOR FROM SYSVERS
SPROCNAM STRINGC  'NONE '           FOR PROCESSOR NAME BEING MONITORED
SPROCNUM RESERVE  1                 FOR PROCESSOR INDEX BEING MONITORED
STOT     EQU      %-SNAPSUM
STOTB    EQU      4*STOT            SNAPSHOT BUFFER BYTE COUNT
         PAGE
         BOUND    8
BUFFER   DO1      6
         STRING   '                    '     20 BLANKS
         BOUND    8
COMMAND  DO1      4                 COMMAND INPUT BUFFER
         STRING   '                    '     20 BLANKS
DECIMAL  DO1      4                 DECIMAL DATA INPUT BUFFER
         STRING   '                    '     20 BLANKS
         BOUND    8
BNAME    DO1      4                 SET UP 80 CHAR BUFFER
         STRING   '                    '     20 BLANKS
         BOUND    8
NUMBER   DATUM    X'40404040',X'40404040',X'40404040'
PATCH    RESERVE  20
         PAGE
AOLD2    EQU      %-2
         RESERVE  #SUSE
AOLD3    EQU      %-1
         RESERVE  DT
ANEW1    EQU      %-1
         RESERVE  D30
ANEW2    EQU      %-2
         RESERVE  #SUSE
ANEW3    EQU      %-1
         RESERVE  DT
         PAGE
*        OLD HALFWORD DISTRIBUTION FOR SYSTEM AND PROCESSORS
ODI1     RESERVE  8
ODI2     RESERVE  8
ODI3     RESERVE  8
ODOT     RESERVE  8
ODOS     RESERVE  8
ODRT     RESERVE  8
ODIT     RESERVE  8
ODTT     RESERVE  8*#HIS
ODT      RESERVE  8*#HIS
ODC      RESERVE  8*#HIS
ODLI     RESERVE  8*#HIS
ODLO     RESERVE  8*#HIS
*        DIFFERENCE HALFWORD DISTRIBUTIONS FOR SYSTEM AND PROCESSORS
SDI1     RESERVE  8
SDI2     RESERVE  8
SDI3     RESERVE  8
SDOT     RESERVE  8
SDOS     RESERVE  8
SDRT     RESERVE  8
SDIT     RESERVE  8
SDTT     RESERVE  8*#HIS
SDT      RESERVE  8*#HIS
SDC      RESERVE  8*#HIS
SDLI     RESERVE  8*#HIS
SDLO     RESERVE  8*#HIS
         PAGE
*        SNAPSHOT DISTRIBUTION TOTALS
TDI1     RESERVE  1
TDI2     RESERVE  1
TDI3     RESERVE  1
TDOT     RESERVE  1
TDOS     RESERVE  1
TDRT     RESERVE  1
TDIT     RESERVE  1
TDTT     RESERVE  #HIS
TDT      RESERVE  #HIS
TDC      RESERVE  #HIS
TDLI     RESERVE  #HIS
TDLO     RESERVE  #HIS
         PAGE
*INDIVIDUAL VALUES DERIVED FROM MONITOR AREA
DISPS    EQU      %-1               ENTRY NUMBER OF PROCESSOR
DBAS     DATUM    0                 IN MONITOR TABLE
DDEL     DATUM    0                 VALUES ARE DETERMINED
DEDI     DATUM    0                 IN THE INITIALIZATION
D:P00    DATUM    0                 FORTRAN DEBUG PACKAGE #
DFOR     DATUM    0
D:P11    DATUM    0                 FORTRAN LIBRARY
DLINK    DATUM    0
DLOAD    DATUM    0
DLOGON   DATUM    0
DMET     DATUM    0
DPCL     DATUM    0
DTEXT    DATUM    0
DUSE     DATUM    ENDPMPRC+1
         PAGE
*        NEW DATA                   TEMPORARY STORAGE
VCIT     DATUM    0
VCITI    DATUM    0
VLUS     DATUM    0
VSCI     DATUM    0
VSEC     DATUM    0
VSIT     DATUM    0
VTIC     DATUM    0
VTYP     DATUM    0
VRTRW    DATUM    0
VBSR     DATUM    0                 BATCH CPU SERVICE
VLSR     DATUM    0                 ONLINE CPU SERVICE
VBCPU    DATUM    0                 BATCH EXECUTION + SERVICE
VCPU     DATUM    0                 ONLINE EXECUTION + SERVICE
*        OLD DATA                   TEMPORARY STORAGE
VOCIT    DATUM    0
VOCITI   DATUM    0
VOLUS    DATUM    0
VOSCI    DATUM    0
VOSEC    DATUM    0
VOSIT    DATUM    0
VOTIC    DATUM    0
VOTYP    DATUM    0
VORTRW   DATUM    0
VOBSR    DATUM    0
VOLSR    DATUM    0
VOBCPU   DATUM    0
VOCPU    DATUM    0
         USECT    CSPROC
         PAGE
*F*      NAME:    STATS
*F*      PURPOSE:
*F*               INITIALIZATION OF THE ENVIRONMENT FOR THE STATS
*F*               PROCESSOR
         SPACE    2
*D*      NAME:    STATS
*D*      DESCRIPTION:
*D*               UPON ENTRY STATS ESTABLISHES TRAP CONTROL
*D*               FOR NAO AND TO IGNORE FIXED POINT OVERFLOW.
*D*               THEN THE SALUTATION IS OUTPUT.
*D*               A CALL TO STIME FORCES THE ALLOCATION OF PAGE 0.
*D*               A CALL TO INITABLES PERFORMS THE INITIALIZATION
*D*               FUNCTIONS FOR MULTIPROCESSING SYSTEMS IF REQUIRED
*D*               AND A CHECK TO INSURE THAT STATS HAS BEEN
*D*               LOADED WITH THE CORRECT MONSTK
*D*               FINALLY A PASS THROUGH LGET1 ROUTINE CAUSES
*D*               STATS TO TOUCH EACH PAGE THAT IS REQUIRED FOR DATA
*D*               COLLECTION. IN THIS WAY THE PROCESSOR MAPS ONTO ONLY
*D*               THOSE MONITOR PAGES THAT ARE ABSOUTELY REQUIRED.
*D*               THUS MINIMIZING THE # OF VIRTUAL PAGES FOR TRANSFER
*D*               OF DATA. THE DATA COLLECTED DURING THIS PASS IS NOT
*D*               USED IN THE STATISTICS REPORTING.
*D*               THEN IF STATS IS BEING RUN AS A GHOST:
*D*               1. M:SI IS OPENED TO FILE GHOSTSI IN THE RUNNING ACCT
*D*                  AN ERROR OR ABNORMAL CONDITION CAUSES A MESSAGE
*D*                  TO BE OUTPUT ON THE OC AND STATS EXITS.
*D*               2. M:DO IS OPENED INOUT TO FILE GHOSTDO
*D*                  IN ACCT :STATS. AN ERROR OR ABNORMAL CONDITION
*D*                  CAUSES STATS TO ATTEMPT TO OPEN THE FILE OUT
*D*                  AN ERROR IN WHICH CAUSES A MESSAGE TO BE OUTPUT
*D*                  ON THE OC AND STATS EXITS. ELSE STATS HAVING
*D*                  CREATED THE FILE, CLOSES IT AND RETURNS TO REOPEN
*D*                  IT INOUT AND PFIL TO THE EOF.
*D*               3. M:LO IS OPENED INOUT TO THE FILE
*D*                  GHOSTLO IN ACCT :STATS AND THE SAME GENERAL
*D*                  PROCEDURE IS FOLLOWED AS DESCRIBED FOR M:DO
*D*               4. CONTROL IS TRANSFERRED TO INIT4 TO ESTABLISH
*D*                  VFC ON M:LO AND THEN FALLS INTO LSTAR
*D*                  TO BEGIN COMMAND PROCESSING.
*D*               IF THE PROCESSOR IS BEING RUN IN BATCH/ONLINE:
*D*               1. BREAK CONTROL IS ESTABLISHED AND CONTROL
*D*                  IS TRANSFERRED TO INIT4.
         SPACE    1
STATS    EQU      %
         M:TRAP   NOPAGE,(IGNORE,FX),(TRAP,NAO)
         TYPE     ' STATS D00 HERE'
         BAL,R6   STIME
         BAL,R11  INITABLES
         BAL,R7   LGET1             FORCE THE ALLOCATION OF PAGES
         LC       J:JIT
         BCS,4    GHINIT            RUNNING AS GHOST
         M:INT    LBREAK            BATCH/ONLINE EST BREAK CONTROL
         B        INIT4             FINISH UP
         PAGE
*
*        ABN/ERR ROUTINES FOR DCB OPENS
*
INITSI   M:TYPE   (MESS,AT18)
         B        LEXIT
INITDO   M:TYPE   (MESS,AT19)
         B        LEXIT
INITLO   M:TYPE   (MESS,AT20)
         B        LEXIT
*
INITDO1  M:OPEN   M:DO,(FILE,'GHOSTDO',':STATS'),(OUT),;
                  (ERR,INITDO),(ABN,INITDO),(SAVE)
         M:CLOSE  M:DO,(SAVE)
         B        INIT1A
*
INITLO1  M:OPEN   M:LO,(FILE,'GHOSTLO',':STATS'),(OUT),;
                  (ERR,INITLO),(ABN,INITLO),(SAVE)
         M:CLOSE  M:LO,(SAVE)
         B        INIT2A
         PAGE
*
*        INITIALIZATION IF STATS RUNNING AS GHOST
*
GHINIT   M:OPEN   M:SI,(FILE,'GHOSTSI'),(ERR,INITSI),(ABN,INITSI)
INIT1A   M:OPEN   M:DO,(FILE,'GHOSTDO',':STATS'),(INOUT),;
                  (ERR,INITDO1),(ABN,INITDO1),(SAVE)
         M:PFIL   M:DO,(EOF)
INIT2A   M:OPEN   M:LO,(FILE,'GHOSTLO',':STATS'),(INOUT),;
                  (ERR,INITLO1),(ABN,INITLO1),(SAVE)
         M:PFIL   M:LO,(EOF)
INIT4    EQU      %
         M:DEVICE M:LO,(VFC)
         PAGE
*D*      NAME:    LSTAR
*D*      INTERFACE:
*D*               READSI - TO READ INPUT COMMANDS
*D*      DESCRIPTION:
*D*               THIS ROUTINE IS USED TO PROCESS THE COMMANDS FOR
*D*               STATS.  UPON ENTRY THE MAJOR COMMAND PROMPT
*D*               CHARACTER (-) IS SET AND A CALL IS MADE TO READSI
*D*               TO OBTAIN THE COMMAND.  IF NONE THEN CONTROL
*D*               RETURNS TO THE TOP TO READ AGAIN.
*D*               OTHERWISE THE PROMPT CHARACTER IS CHANGED TO '>'
*D*               AND A SEARCH IS MADE OF THE COMCHAR TABLE, A BYTE
*D*               TABLE OF SINGLE CHARACTER IDENTIFIERS.  IF NOT FOUND, AN
*D*               ILLEGAL COMMAND MESSAGE IS OUTPUT VIA M:DO
*D*               AND CONTROL RETURNS TO THE BEGINNING OF LSTAR
*D*               WHEN FOUND THE PARALLEL ENTRY IN BRCOM IS FETCHED AND
*D*               CONTROL IS TRANSFERRED TO THE APPROPRIATE ROUTINE.
*D*               THIS ENTRY REPRESENTS A WORD DISPLACEMENT FROM LSTAR
*D*               TO THE APPROPRIATE ROUTINE FOR PROCESSING THE COMMAND
*D*               THE COMCHAR AND BRCOM TABLES ARE GENERATED  WITH THE
*D*               PROC COMBUILD.
         SPACE    1
LSTAR    M:PC     '-'               RETURN TO COMMAND LEVEL
         LI,R0    0
         STW,R0   FCEXC
         LD,R0    BLANK
         STD,R0   COMMAND
         LI,1     80                BYTE COUNT, COMMAND INPUT
         LI,2     COMMAND
         BAL,R6   READSI
         CI,R4    0                 TEST BYTE POINTER
         BL       LSTAR             REPEAT IF NAME ZERO LENGTH
         AI,R4    1                 BYTE DISPLACEMENT-->BYTE COUNT
         STW,R4   VSIZE             STORE FIELD LENGTH
         M:PC     '>'               CHANGE PROMPT CHARACTER
         LI,R3    1                 INDEX INTO COMMANDS
         LI,R1    #COMMANDS         NUMBER OF VALID ENTRIES
         LB,R2    COMMAND           GET FIRST CHARACTER
COMNXT   CB,R2    COMCHAR,R3        IS IT THIS ONE
         BE       COMFND            YES
         AI,R3    1
         BDR,R1   COMNXT
         TYPE     'ILLEGAL COMMAND'
         B        LSTAR
COMFND   LH,R3    BRCOM,R3          GET DISPLACEMENT
         B        LSTAR,R3          BRANCH TO ROUTINE
         PAGE
*D*      NAME:    LHELP
*D*      DESCRIPTION:
*D*               THIS ROUTINE PROCESSES THE H(ELP) COMMAND.
*D*               A BRIEF DESCRIPTION OF THE VARIOUS COMMAND AND
*D*               THEIR MEANINGS ARE OUTPUT VIA M:DO.
*D*               CONTROL RETURNS TO LSTAR TO OBTAIN THE NEXT COMMAND.
         SPACE    1
LHELP    LI,R0    100
         STW,R0   NLINE
         BAL,R7   SPAGE
         TYPE     '  DESCRIPTION OF STATS COMMANDS'
         TYPE     'A(DD)      - ADD PRINT FLAGS'
         TYPE     'B 0        - RESET PRINT FLAGS'
         TYPE     'B(UILD) 1  - SET FLAG SYSTEM DISTRIBUTION'
         TYPE     'B 2        - SET FLAGS SYSTEM & PROCESSOR DISPLAYS'
         TYPE     'B 3        - SET FLAGS 7 GROUPS'
         TYPE     'B 4        - SET FLAGS CPU,I/O & SINGLE ITEMS'
         TYPE     'B 5        - SET FLAG SWAP DISTRIBUTION'
         TYPE     'B 6        - SET FLAGS I/O AND RAHD/AIR'
         TYPE     'B 7        - SET FLAGS SCPU AND EVNT'
         TYPE     'C(ONTROL!) - LIST SOME OF CONTROL PARAMS'
         TYPE     'DI(SPLAY)  - REPORT & UPDATE SNAPSHOT FILE'
         TYPE     'D(ROP)     - RESET PRINT FLAGS'
         TYPE     'E(ND)      - EXIT STATS'
         TYPE     'F(ILE)     - UPDATE SNAPSHOT FILE  & REPORT'
         TYPE     'L(IST)     - LIST CURRENT PRINT FLAG STATUS'
         TYPE     'T(IME)     - PRINT CURRENT TIME'
         TYPE     'S(ETPROC)  - SET PROCESSOR NUMBER FOR MONITORING'
         TYPE     '  DCB USAGE'
         TYPE     'M:SI - INTERACTIVE INPUT COMMANDS'
         TYPE     'M:LO - REPORTS'
         TYPE     'M:DO - INTERACTIVE OUTPUT'
         TYPE     'F:3  - SNAPSHOT FILE'
         LI,R0    100
         STW,R0   NLINE
         BAL,R7   SPAGE
         B        LSTAR             GO TO LSTAR
         PAGE
*D*      NAME:    LADD
*D*      DESCRIPTION:
*D*               THIS ROUTINE TURNS ON THE FLAGS FOR THE SPECIFIED
*D*               ITEMS.  THE VALID ITEMS ARE LISTED IN THE ATERM TABLE
*D*               DEFINED WITHIN THE BTERMS PROC. THE NUMERIC VALUES
*D*               1-7 AND THE KEYWORD 'ALL' ARE ALSO LEGAL.
*D*               IF THE ITEM IS INVALID A MESSAGE IS OUTPUT AND
*D*               CONTROL RETURNED TO READ ANOTHER ITEM
*D*               IF FOUND THE APPROPRIATE (PARALLEL)
*D*               FLAG IS SET IN APRIN
*D*               IF A NUMERIC VALUE OR ALL IS INPUT THEN THE SETEM
*D*               ROUTINE SETS THE APPROPRIATE GROUP OF FLAGS
*D*               BY CHECKING EACH ITEM'S ENTRY IN THE BUILDT TABLE
*D*               TO DETERMINE IF IT BELONGS TO THE PARTICULAR GROUP.
         SPACE    1
LADD     EQU      %
         TYPE     'ENTER ITEMS TO BE ADDED'
LADD1    LI,R0    1
LADD1A   BAL,R7   SNAME             GET ITEM
         B        LSTAR             NONE
         BAL,R7   SFIND             FIND MATCH
         B        LADD2             NOT LEGAL
         STB,R0   APRIN,R3          SET FLAG
         B        LADD1A
LADD2    EQU      %                 CHECK FOR NUMBER OR ALL
         LI,R2    ALLFLGS           SET ALLFLG
         LW,R7    BNAME             GET ENTRY
         CW,R7    ='END '           IS IT END
         BE       LSTAR             YES DONE
         CW,R7    ='ALL '           ALL
         BE       ADAL              YES
         SLS,R7   -24               POSITION
         AI,R7    -X'F0'            SEE IF NUMERIC
         BLEZ     LADD3             NOT LEGAL
         CI,R7    NUM(GFLGS)
         BLE      ADSOME            OK
LADD3    TYPE     'NO SUCH NAME'
         B        LADD1
ADSOME   LB,R2    TGRFLGS,R7        GET APPROPRIATE FLAGS
ADAL     LI,R11   LADD1             RETURN ADDRESS
SETEM    LI,R1    #PRTFLGS          GET # OF ENTRIES
         LI,R3    1
SETNXT   CB,R2    BUILDT,R3         IS THIS TERM IN GROUP
         BAZ      %+2               NO
         STB,R0   APRIN,R3          YES,SET OR RESET FLAG
         AI,R3    1
         BDR,R1   SETNXT
         B        *R11              RETURN
         PAGE
*D*      NAME:    LCON
*D*      DESCRIPTION:
*D*               THIS ROUTINE PROCESSES THE C(ONTROL!) COMMAND
*D*               AND OUTPUTS THE ELEMENTS OF THE PARAM DISPLAY
*D*               VIA M:DO IMMEDIATELY VIA CALS TO LGET1 AND LOUT1.
*D*               CONTROL GOES TO LSTAR TO PROCESS THE NEXT COMMAND.
         SPACE    1
LCON     LI,R1    1                 SET PRINT FLAG UNCONDITIONALLY
         STW,R1   PRNTF
         BAL,R7   GDAT              GET DATA
         LI,R0    1                 FCEXC = 1
         STW,R0   FCEXC
         BAL,R7   SPAGE
         LI,R1    AT14
         BAL,R7   SOUTA
         LI,R1    CTIME
         BAL,R7   SOUTA
         BAL,R7   SEND
         BAL,R7   LGET1
         BAL,R7   LOUT1             PRINT SELECTED DATA
         LI,R0    0
         STW,R0   FCEXC             RESET FLAG
         B        LSTAR             CONTROL PROMPT
         PAGE
*D*      NAME:    LEXIT
*D*      DESCRIPTION:
*D*               THIS ROUTINE PROCESSES THE END COMMAND AND IS USED
*D*               BY STATS TO EXIT AFTER ENCOUNTERING ERROR CONDITIONS.
*D*               ALL OPEN DCBS (M:LO,M:DO,F:3) ARE CLOSED WITH SAVE
*D*               AND STATS EXITS.
         SPACE    1
LEXIT    LI,R4    -4
         LW,R7    Y002
LXNXT    LW,R5    DCSX+4,R4         GET DCB ADDRESS
         CW,R7    0,R5              IS IT CLOSED
         BAZ      %+2               YES
         M:CLOSE  *R5,(SAVE)        NO,CLOSE IT
         BIR,R4   LXNXT
         M:EXIT
         PAGE
*D*      NAME:    LDROP
*D*      DESCRIPTION:
*D*               THIS ROUTINE PROCESSES THE D(ROP) COMMAND
*D*               BY RESETTING THE FLAGS FOR THE SPECIFIED ITEMS.
*D*               THE VALID ITEMS ARE LISTED IN THE ATERM TABLE DEFINED
*D*               WITHIN THE BTERMS PROC.  IF THE ITEM IS INVALID A
*D*               MESSAGE IS OUTPUT. ANOTHER ITEM IS THEN READ.
*D*               IF FOUND THE APPROPRIATE FLAG IN APRIN IS RESET.
*D*               UPON ENCOUNTRING END OR CR/LF CONTROL RETURNS
*D*               TO LSTAR TO PROCESS THE NEXT COMMAND.
         SPACE    1
LDROP    EQU      %
         TYPE     'ENTER ITEMS TO BE DROPPED'
         LI,R0    0
LDROP1A  BAL,R7   SNAME             GET ENTRY
         B        LSTAR             NONE
         BAL,R7   SFIND             FIND ENTRY
         B        LDROP2            NO FOUND
         STB,R0   APRIN,R3          RESET FLAG
         B        LDROP1A
LDROP2   LW,R7    BNAME
         CW,R7    ='END'
         BE       LSTAR
         TYPE     'NO SUCH NAME'
         B        LDROP1A
         PAGE
*D*      NAME:    LIST
*D*      DESCRIPTION:
*D*               THIS ROUTINE PROCESSES THE L(IST) COMMAND AND
*D*               OUTPUTS VIA M:DO THE STATUS OF THE VARIOUS ITEMS AS
*D*               DEFINED IN THE ATERM TABLE.
         SPACE    1
LIST     EQU      %
         MTW,1    PRNTF             SET PRINT FLAG
         LI,R0    100
         STW,R0   NLINE
         BAL,R7   SPAGE
         TYPE     ' FLAG     -   STATUS'
         LI,R2    BUFFER            ADDRESS FOR OUTPUT
         LI,R1    20                NUMBER OF BYTES
         LI,R3    0
LIST1    AI,R3    1                 ALL LISTED
         CI,R3    #PRTFLGS
         BG       LSTAR             YES
         LD,R10   ATERM,R3          GET ENTRY
         STD,R10  BUFFER
         LI,R4    OFF
         MTB,0    APRIN,R3          FLAG SET
         BEZ      %+2               NO
         LI,R4    ON
         LD,R10   *R4               GET ENTRY
         STD,R10  BUFFER+2
         LW,R10   2,R4
         STW,R10  BUFFER+4
         CAL1,1   ADO               OUTPUT LINE
         B        LIST1
         PAGE
*D*      NAME:    LPROC
*D*      DESCRIPTION:
*D*               THIS ROUTINE PROCESSES THE P(ROC) COMMMAND
*D*               THE BREAK CONTROL FLAG IS RESET. IF PREVIOUSLY SET
*D*               (WITHIN THE BREAK CONTROL ROUTINE) THEN AN M:TRTN
*D*               IS ISSUED OTHERWISE CONTROL RETURNS TO LSTAR.
         SPACE    1
LPRO     EQU      %
         LI,R1    0
         XW,R1    BFLG              WAS BREAK CONTROL SET
         BGEZ     LSTAR
         M:TRTN                     YES RETURN
         PAGE
*D*      NAME:    LTIME
*D*      DESCRIPTION:
*D*               THIS ROUTINE PROCESSES THE T(IME) COMMAND AND
*D*               OUTPUTS VIA M:DO THE TIME OF DAY AS OBTAINED BY THE
*D*               M:TIME CAL. CONTROL RETURNS TO LSTAR TO PROCESS
*D*               THE NEXT COMMAND.
         SPACE    1
LTIME    M:TIME   TIME
         LI,R1    -4
         LW,R0    TIME+4,R1
         STW,R0   BUFFER+4,R1
         BIR,R1   %-2
         LI,R2    BUFFER
         LI,R1    16
         CAL1,1   ADO
         B        LSTAR             RETURN TO COMMAND LEVEL
         PAGE
*D*      NAME:    LSETUP
*D*      DESCRIPTION:
*D*               THIS ROUTINE PROCESSES THE B(UILD) COMMAND.
*D*               IF THE VALUE INPUT IS ZERO THEN ALL FLAGS
*D*               IN APRIN ARE RESET. OTHERWISE THE APPROPRIATE GROUP
*D*               FLAG IS FETCHED FROM TGRFLGS TABLE AND USED
*D*               IN THE SETEM SUBROUTINE TO SET THE APPROPRIATE
*D*               FLAGS IN APRIN.
         SPACE    1
LSETUP   EQU      %
         LI,R0    1
         LW,R3    VSIZE             GET LENGTH
         AI,R3    -1
LSETUP1  LB,R7    COMMAND,R3        GET LAST CHARACTER
         AI,R7    -X'F0'            STRIP VALUE
         BLZ      BDRLSET           NO GO
         BE       LSETUP2A          IS 0
         CI,R7    NUM(GFLGS)        MAX SIZE
         BLE      LSETUP2B
BDRLSET  BDR,R3   LSETUP1
         TYPE     'BUILD LIST ERROR'
         B        LSTAR
LSETUP2A LI,R0    0                 RESET FLAG
LSETUP2B LB,R2    TGRFLGS,R7        GET FLAG
         BAL,R11  SETEM             CHECK ENTRIES
         B        LSTAR
         PAGE
*D*      NAME:    LUSE
*D*      DESCRIPTION:
*D*               THIS ROUTINE PROCESSES THE DI(SPLAY) COMMMAND.
*D*               UPON ENTRY A CHECK IS MADE TO INSURE THAT THE
*D*               FIRST TWO CHARACTERS ARE DI AND IF NOT CONTROL IS
*D*               TRANSFERRED TO LDROP TO PROCESS THE DROP COMMAND.
*D*               OTHERWISE IF THE SNAPSHOT FLAG IS SET IN APRIN,THEN
*D*               AN ADDITIONAL SNAPSHOT FLAG IS SET.
*D*               THE PRINT FLAG IS UNCONDITIONALLY SET.
*D*               THE DEFAULT # OF DISPLAYS AND THE SAMPLE INTERVAL
*D*               ARE SET TO 12 AND 5 MIN(300 SEC) RESPECTIVELY
*D*               CONTROL IS TRANSFERRED TO LHIST FOR
*D*               FURTHER PROCESSING
         SPACE    1
LUSE     EQU      %
         LH,R1    COMMAND
         AND,R1   M16
         CI,R1    'DI'
         BNE      LDROP
         LI,R1    0
         STW,R1   SNAPF             RESET FLAGS
         LI,R1    IXSNAP
         MTB,0    APRIN,R1          WAS SNAPSHOT FLAG SET
         BEZ      %+2               NO
         MTW,1    SNAPF             YES
         MTW,1    PRNTF             PRINT REPORT UNCONDITIONALLY
         LI,R1    12                DEFAULT DISPLAY NUMBER
         STW,R1   ISNAP
         LI,R1    5*60              DEFAULT INTERVAL IN SECS
         STW,R1   VINT
         B        LHIST
         PAGE
*D*      NAME:    LFILE
*D*      DESCRIPTION:
*D*               THIS ROUTINE PROCESSES THE F(ILE) COMMAND.
*D*               THE SNAPSHOT FLAG IS UNCONDITIONALLY SET AND
*D*               IF THE REPORT FLAG IN THE APRIN TABLE IS SET AN
*D*               ADDITIONAL PRINT FLAG IS SET. THE DEFAULTS FOR
*D*               # OF REPORTS AND INTERVAL BETWEEN REPORTS ARE SET TO
*D*               96 AND 15 MIN(900 SEC) RESPECTIVELY
*D*               CONTROL FALLS INTO LHIST FOR FURTHER PROCESSING.
         SPACE    1
LFILE    LI,R1    0
         STW,R1   PRNTF
         LI,R1    IXREP
         MTB,0    APRIN,R1          REPORT FLAG SET
         BEZ      %+2               NO
         MTW,1    PRNTF             PRINT IF REPORT SET
         MTW,1    SNAPF             SNAPSHOT UNCONDITIONALLY
         LI,R1    96                DEFAULT FILE SNAPSHOTS
         STW,R1   ISNAP
         LI,R1    15*60             DEFAULT INTERVAL IN SECS
         STW,R1   VINT
         PAGE
*D*      NAME:    LHIST
*D*      INTERFACE:
*D*               SDEC - TO OBTAIN USER SUPPLIED VALUES FOR
*D*                      # OF INTERVALS AND INTERVAL LENGTH
*D*               USNAP - TO OPEN SNAPSHOT FILE
*D*               LWAIT - TO WAIT FOR REMAINDER OF INTERVAL
*D*               GDAT - TO OBTAIN THE DATA FROM THE MONITOR AREA
*D*               LGET1 - TO PROCESS THE DATA
*D*               SPAGE - TO UPSPACE TO A NEW PAGE
*D*               SOUTA - TO FORMAT HEADER IN BUFFER
*D*               SEND - TO OUTPUT HEADER IN BUFFER
*D*               LOUT1 - TO OUTPUT REPORTS AND PUT DATA IN
*D*                       SNAPSHOT BUFFER
*D*               WSNAP - TO WRITE SNAPSHOT RECORD
*D*               CSNAP - TO CLOSE AND SAVE SNAPSHOT FILE
*D*      DESCRIPTION:
*D*               THIS ROUTINE IS USED AS A DRIVER THROUGH THE VARIOUS
*D*               DATA COLLECTION AND REPORTING ROUTINES.
*D*               UPON ENTRY THE INTERVAL AND THE # OF SAMPLES ARE
*D*               OBTAINED FROM THE USER.
*D*               A CALL IS MADE TO USNAP TO OPEN THE SNAPSHOT FILE
*D*               UPON RETURN A CALL IS MADE TO LWAIT TO WAIT FOR THE
*D*               REMAINDER OF THE INTERVAL. UPON RETURN THE DATA IS
*D*               TRANSFERRED FROM THE MONITOR AREA TO STATS BUFFER
*D*               AREA. THEN A CALL TO LGET1 CAUSES ALL THE DATA TO BE
*D*               PROCESSED . IF THE RECORD COUNT IS NONZERO THEN THE
*D*               HEADING STATISTICS ONLINE FROM   TO  . IS OUTPUT VIA
*D*               THE M:DO DCB.  THE VARIOUS DISPLAYS ARE THEN
*D*               OUTPUT VIA A CALL TO LOUT1 WHERE THE
*D*               SNAPSHOT BUFFER IS ALSO FILLED.
*D*               UPON RETURN A CALL IS MADE TO WSNAP TO WRITE OUT
*D*               THE SNAPSHOT RECORD.  THIS OPERATION IS REPEATED
*D*               BEGINNING WITH THE LWAIT CALL UNTIL THE APPROPRIATE
*D*               # OF REPORTS HAS BEEN GENERATED AT WHICH TIME
*D*               A CALL TO CSNAP IS MADE TO CLOSE THE SNAPSHOT FILE.
*D*               CONTROL IS FINALLY RETURNED TO LSTAR.
         SPACE    2
LHIST    TYPE     ' ENTER INTERVAL IN MINUTES'
         BAL,R7   SDEC              READ SNAPSHOT INTERVAL
         B        LHIST             ERROR - RETRY
         AI,R1    0                 ANY NUMBER
         BEZ      LHIST1B
         STW,R1   VMIN
         MI,R1    60                CONVERT TO SECONDS
         STW,R1   VINT
LHIST1B  TYPE     ' ENTER # OF INTERVALS'
         BAL,R7   SDEC              READ # OF SNAPSHOTS
         B        LHIST1B           ERROR - RE-TRY
         AI,R1    0                 ANY NUMBER
         BEZ      %+3
         STW,R1   ISNAP             STORE RESULT
         LI,R1    0
         STW,R1   VTIME2
         STW,R1   ICOUNT            ICOUNT=1,...,ISNAP
         BAL,R7   USNAP             OPEN SNAPSHOT FILES FOR UPDATE
                  PAGE
LHIST2   BAL,R7   LWAIT             WAIT FOR REST OF INTERVAL
         BAL,R7   GDAT              TRANSFER MONITOR DATA
         BAL,R7   LGET1             PROCESS DATA
         MTW,0    ICOUNT            TEST RECORD COUNT
         BEZ      LHIST2A
         STW,R7   NLINE             FORCE NEW PAGE
         BAL,R7   SPAGE
         LI,R1    5
         STB,R1   DTIME             TEMP CHANGE BYTE COUNT
         LI,R1    AT13
         BAL,R7   SOUTA
         BAL,R7   SEND
         LI,R1    AT3
         BAL,R7   SOUTA
         LI,R1    DTIME
         BAL,R7   SOUTA
         LI,R1    AT4
         BAL,R7   SOUTA
         LI,R1    CTIME
         BAL,R7   SOUTA
         BAL,R7   SEND
         LI,R1    16
         STB,R1   DTIME             RETURN BYTE COUNT TO NORMAL
         BAL,R7   LOUT1
         BAL,R7   WSNAP
LHIST2A  EQU      %
         MTW,1    ICOUNT            INCREMENT INDEX
         LW,R1    ICOUNT
         CW,R1    ISNAP             ARE SNAPSHOTS COMPLETED
         BLE      LHIST2                 NO - GET ANOTHER
         BAL,R7   CSNAP
         B        LSTAR
         PAGE
*D*      NAME:    LSETP
*D*      INTERFACE:
*D*               SNAME - TO READ INPUT FOR PROCESSOR NAME
*D*               SOUTA - TO FORMAT AN ENTRY IN BUFFER
*D*               SBINOUT - TO CONVERT AND FORMAT ENTRY IN BUFFER
*D*               SBLANK - TO APPEND BLANKS TO BUFFER
*D*               SEND - TO OUTPUT A LINE
*D*               SENDN - TO RESET BUFFER POINTERS
*D*      OUTPUT:
*D*               C:PROCN SET TO PROCESSOR #
*D*      DESCRIPTION:
*D*               THIS ROUTINE PROCESSES THE S(ETPROC) COMMAND.
*D*               UPON ENTRY THE C0FLAG SET DURING INITIALIZATION
*D*               IF THE USER HAS C0 PRIVILEGE OR HIGHER IS TESTED.
*D*               IF NOT SET, A MESSAGE INDICATING C0 IS NEEDED
*D*               IS OUTPUT AND CONTROL RETURNS TO LSTAR
*D*               ELSE, THE MESSAGE ENTER PROCESSOR NAME IS OUTPUT
*D*               AND SNAME CALLED TO READ THE NAME
*D*               IF NONE THEN CONTROL RETURNS TO LSTAR
*D*               IF THE ENTRY IS THE DIGIT 0 THEN THE PROCESSOR
*D*               NUMBER IS TO BE RESET AND CONTROL RETURNS TO LSTAR
*D*               AFTER DOING SO.
*D*               ELSE, THE NAME IS FORMED INTO A TEXTC FORMAT
*D*               AND COMPARED AGAINST THE ENTRIES IN P:NAME
*D*               IF NOT FOUND A MESSAGE PROCESSOR NOT SHARED
*D*               IS OUTPUT AND CONTROL RETURNS TO READ ANOTHER NAME.
*D*               IF FOUND, THE NAME AND INDEX ARE SAVED IN STATS
*D*               DATA AREA AND THE INDEX IS EXCHANGED WITH
*D*               THE CONTENTS OF C:PROCN IN THE MONITOR AREA ITSELF
*D*               IF C:PROCN WAS PREVIOUSLY SET A MESSAGE
*D*               INDICATING THIS IS OUTPUT
*D*               THEN OR OTHERWISE THE PROCESSOR # AND NAME
*D*               ARE OUTPUT THROUGH EITHER M:DO OR M:LO
*D*               CONTROL RETURNS TO LSTAR
         PAGE
LSETP    MTW,0    C0FLAG            PRIVILEGE OKAY
         BEZ      LSETNO            NO
LSETP1   TYPE     ' ENTER PROCESSOR NAME'
         BAL,R7   SNAME             GET NAME
         B        LSTAR             NONE
         LB,R3    BNAME             GET FIRST CHARACTER
         AI,R3    -X'F0'            STRIP TO 0 ?
         BNEZ     LSETP12           NOT 0
         STD,R3   PROCNAME          ZERO OUT NAME
         STW,R3   PROCNUM           AND NUMBER
         STW,R3   C:PROCN+G         ALSO IN PMDAT
         TYPE     ' PROCESSOR MONITORING STOPPED'
         B        LSTAR             BACK FOR NEXT COMMAND
LSETP12  LD,R12   BNAME             GET NAME
         SLD,R12  -8                FORMAT INTO TEXTC
         LW,R3    VSIZE             GET # BYTES
         STB,R3   R12
         LI,R3    PPROCS            GET MONITOR # ENTRIES
         CD,R12   P:NAME+F,R3
         BE       LSETP2            FOUND
         BDR,R3   %-2               TRY AGAIN
         TYPE     ' PROCESSOR NOT SHARED'
         B        LSETP1
LSETP2   XW,R12   PROCNAME
         XW,R13   PROCNAME+1
         STW,R3   PROCNUM           SAVE PROC #
         XW,R3    C:PROCN+G         STORE DIRECTLY IN MONITOR
         BEZ      LSETP3            WAS ZERO
         CW,R3    C:PROCN           WAS IT SAME INDEX
         BE       LSETP3            YES
         TYPE     ' REPLACED A PROCESSOR BEING MONITORED'
LSETP3   TYPE     ' PROCESSOR NOW BEING MONITORED'
         LI,R11   LSTAR
LSETP4   LI,R1    AT5               PROCESSOR #
         BAL,R7   SOUTA
         LW,R2    PROCNUM           PROCESSOR #
         LI,R1    3
         BAL,R7   SBINOUT
         LI,R1    2
         BAL,R7   SBLANK
         LI,R1    PROCNAME
         BAL,R7   SOUTA
         CI,R11   LSTAR             IS IT SETP CALLING
         BE       %+3               YES
         BAL,R7   SEND              SEND THROUGH M:LO
         B        *R11              RETURN
         LI,R2    BUFFER
         LW,R1    VBUFCNT
         CAL1,1   ADO               SEND THROUGH M:DO
         BAL,R7   SENDN             RESET BUFFER
         B        *R11              RETURN
         B        *R11
LSETNO   TYPE     'SETPROC REQUIRES C0 PRIVILEGE'
         B        LSTAR
         PAGE
*D*      NAME:    LWAIT
*D*      INTERFACE:
*D*               STIME - TO OBTAIN THE CURRENT TIME IN SECS SINCE
*D*                       SYSTEM STARTUP
*D*      REGISTERS:
*D*               R7 - LINK
*D*               R6 - FOR STIME LINKAGE
*D*               R0,R1 - USED FOR COMPUTATION
*D*      OUTPUT:
*D*               VTIME2 - CURRENT TIME AFTER WAITING
*D*      DESCRIPTION:
*D*               IF IT IS THE FIRST TIME CALLED, THE CURRENT TIME
*D*               IS OBTAINED AND STORED IN VTIME2. OTHERWISE
*D*               THE CURRENT TIME IS USED TO COMPUTED THE
*D*               ELAPSED TIME. IF THE ELAPSED TIME IS > THE INTERVAL
*D*               SPECIFIED A MESSAGE IS OUTPUT.
*D*               THAT THE INTERVAL CANNOT BE MAINTAINED AND THE NEW
*D*               CURRENT TIME IS FETCHED AND SAVED AND RETURN IS VIA
*D*               THE LINK REGISTER (R7) IF THE ELAPSED  TIME
*D*               IS LESS THAN THE INTERVAL THE MESSAGE SLEEPING
*D*               IS OUTPUT, THE DCBS (M:LO,M:DO,F:3) ARE TRUNCATED
*D*               THE TIME LEFT IN THE INTERVAL IS COMPUTED AND STATS
*D*               ISSUES A WAIT CAL. UPON RETURN THE NEW CURRENT
*D*               TIME IS COMPUTED AND CONTROL RETURNS VIA
*D*               THE LINK REGISTER (R7).
         SPACE    1
LWAIT    EQU      %                 WAIT FOR REMAINDER OF INTERVAL
         LW,R1    VTIME2            LOAD LAST TIME STIME CALLED.
         BNEZ     %+4
         BAL,R6   STIME
         STW,R1   VTIME2
         B        0,R7
         BAL,R6   STIME
         SW,R1    VTIME2            DETERMINE ELAPSED TIME
         CW,R1    VINT              IF ELAPSED TIME>INTERVAL
         BLE      LWAIT1
         TYPE     'CANNOT MAINTAIN INTERVAL'
         BAL,R6   STIME
         STW,R1   VTIME2
         B        0,R7
LWAIT1   EQU      %
         TYPE     '..SLEEPING'
         M:TRUNC  M:LO
         M:TRUNC  M:DO
         M:TRUNC  F:3
         LW,R0    VINT              GET REQUESTED INTERVAL
         SW,R0    R1                SUBTRACT USED TIME
         SLD,R0   -32               SET UP FOR DIVIDE
         MW,R0    =5                CONVERT TO
         DW,R0    =6                1.2 SECOND CLOCK
         CI,R0    3
         BLE      %+2               ROUND
         AI,R1    1
         M:WAIT   *R1
         BAL,R6   STIME
         STW,R1   VTIME2            RESULT AFTER WAIT
         B        0,R7
         PAGE
*D*      NAME:    GDAT
*D*      DESCRIPTION:
*D*               THIS SUBROUTINE IS USED TO TRANSFER THE REQUIRED
*D*               MONITOR DATA PAGES TO THE CORRESPONDING STATS BUFFER
*D*               PAGES. THE LINK REGISTER (R7) IS SAVED. THE TIME
*D*               INCLUDING TMS UNITS IS OBTAINED VIA AN M:TIME CAL
*D*               THE OLD TIME FROM THE FIRST 4 WORDS  OF VP X'10000'
*D*               IS SAVED. THE DATA TRANSFER IS PERFORMED
*D*               THIS CONSISTS OF CHECKING THE BIT MAP (PGMAP)
*D*               CREATED IN THE NOPAGE RTN TO SEE IF THE PARTICULAR
*D*               PAGE IS TO BE TRANSFERRRED. IF SO A SERIES OF LMS
*D*               AND STMS (MOVEM PROC) IS USED TO TRANSFER
*D*               THE DATA A PAGE AT A TIME
*D*               AT A TIME.  THIS MEANS OF TRANSFER HAVS BEEN SELECTED
*D*               AS IT IS THE FASTEST METHOD OF TRANSFERRING
*D*               DATA. THIS OPERATION IS REPEATED UNTIL ALL THE
*D*               NECESSARY PAGES HAVE BEEN TRANSFERRED
*D*               THE FIRST 4 WORDS OF VP X'10000' ARE THEN OVERWRITTEN
*D*               WITH THE NEW TIME AND DATE
*D*               CONTROL RETURNS VIA THE SAVED LINK REGISTER.
         SPACE    1
GDAT     EQU      %                 MONITOR DATA -->BUFFER
         STW,R7   LINK
         M:TIME   TIME,TMS
         STD,R8   TIME1
         STW,R10  TIME3
         LB,R9    R9
         MI,R9    100               COMPUTE BINARY HOURS MIN
         LH,R2    TIME2
         AND,R2   =X'000000FF'
         AW,R9    R2
         STW,R9   VHRMN
         LI,R9    BA(DTIME)         SAVE OLD TIME AND DATE
         LI,R1    17                BYTE COUNT
         STB,R1   R9
         LI,R8    4*CTIME
         MBS,R8   0
         LI,R7    (BSIZE+1)**-9     #PAGES
         LD,R4    PGMAP
         LI,R6    0
GDATAL   SLD,R4   1                 GET THIS PAGE
         BEV      GDATAXT           NO
         LW,R1    R6                PUT PAGE ADDR IN WORKING REG
         LI,R2    8
GLOOP    MOVEM    R8,R1,8
         AI,R1    64
         BDR,R2   GLOOP
GDATAXT  AI,R6    512
         BDR,R7   GDATAL            DO NEXT PAGE
         LI,R9    4*CTIME           GET NEW TIME AND DATE
         LI,R1    17
         STB,R1   R9
         LI,R8    BA(TIME)-1
         MBS,R8   0
         B        *LINK
         PAGE
*D*      NAME:    LGET1
*D*      INTERFACE:
*D*               SNAPHIS - TO COMPUTE AND STORE SNAPSHOT DISTRIBUTIONS
*D*      DESCRIPTION:
*D*               THIS SUBROUTINE IS THE MAIN ENTRY INTO PROCESSING THE
*D*               MONITOR DATA INTO THE STATS BUFFER AREA FOR
*D*               SUBSEQUENT USE. UPON ENTRY THE LINK REGISTER (R7) IS
*D*               SAVED. WITHIN THE AREA DEFINED BY LGET1 TO LGET2 THE
*D*               FOLLOWING OPERATIONS ARE PERFORMED MOST OF WHICH
*D*               ARE CONCERNED WITH THE PARAM DISPLAY
*D*               1. THE ELEMENTS NECESSARY FOR COMPUTING THE MONITOR
*D*                  UNMAPPED SERVICE TIME ARE FETCHED FROM THE MONITOR JIT
*D*                  CELLS J:OVHTIM AND J:DELTAT AND SAVED
*D*               2. IF ANY SECONDARY CPUS HAVE BEEN DEFINED IN
*D*                  THE SYSTEM THEN THE C:CAL VALUE FOR EACH IS
*D*                  FETCHED FROM ITS PRIVATE PAGE AND SAVED
*D*                  TO DO THIS THE FOLLOWING OPERATION IS PERFORMED
*D*                  FOR EACH CPU
*D*                                 THE PRIVATE PAGE # OF THE CPU IS
*D*                                 OBTAINED FROM ITS SX:SPP ENTRY
*D*                                 IN THE MONITOR AREA AND COMPARED
*D*                                 AGAINST THE PREVIOUSLY OBTAINED
*D*                                 PAGE #. IF EQUAL AND NON-ZERO
*D*                                 THE DATA IS DIRECTLY FETCHED
*D*                                 AND SAVED
*D*                                 IF THE NEW PAGE IS ZERO AND THE OLD
*D*                                 PAGE NON-ZERO THEN THE OLD ONE
*D*                                 IS M:FVP'ED AND THE ENTRY ZEROED
*D*                                 IF THE NEW PAGE IS NONZERO AND
*D*                                 THE OLD PAGE IS ZERO THEN THE
*D*                                 NEW PAGE IS M:CVM'ED AND M:GVP'ED
*D*                                 AND THE DATA FETCHED
*D*                                 IF BOTH PAGES ARE NON-ZERO AND
*D*                                 NOT EQUAL THE OLD ONE IS
*D*                                 M:FVP'ED AND THE NEW ONE IS
*D*                                 M:CVM'ED AND M:GVP'ED AND
*D*                                 THE DATA FETCHED.
*D*               3. THE INDICES FOR THE STANDARD SHARED
*D*                  PROCESSORS FOR THE USERS DISPLAY ARE
*D*                  DETERMINED VIA A SEARCH  OF THE P:NAME TABLE
*D*               4. THE FIRST 12 ENTRIES OF THE SHARED PROCESSOR
*D*                  TABLE SECTION OF P:NAME BEGINNING AT BGNPMPRC
*D*                  ARE TRANSFERRED TO THE SIDING FOR THE BATCH
*D*               AND ONLINE DISPLAYS AND ALSO MOVED TO THE
*D*                  SNAPSHOT BUFFER AREA
*D*               5. THE DATE AND TIME ARE ALSO TRANSFERRRED TO THE
*D*                  SNAPSHOT BUFFER.
*D*               6. A CALL TO SNAPHIS IS MADE TO COMPUTE THE VALUES
*D*                  FOR THE REST OF THE USER INSWAP TIME
*D*                  FROM THE CH:DI2 TABLE AND THE RESULTS STORED
*D*                  IN THE APPROPRIATE DISTRIBUTION TABLES OF STATS
*D*               7. THE AVERAGE BATCH QUANTUM IS COMPUTED AS WELL AS
*D*                  THE # OF ACTIVE CPUS AND FOR THOSE SECONDARY CPUS
*D*                  THAT ARE ACTIVE THE AVERAGE MAXIMUM QUANTUM
*D*                  IS ALSO DETERMINED.
*D*                  THE AVERAGE BATCH AND ONLINE USER SIZE
*D*                  IS ALSO COMPUTED
*D*               8. THE CURRENT VALUES OF THE PARAM ITEMS AS POINTED
*D*                  TO BY THE AVAIL1 TABLE ARE FETCHED AND STORED IN
*D*                  THE CORRESPONDING POSITIONS IN THE ANEW1 TABLE.
*D*               9. CONTROL FALLS INTO LGET2.
         SPACE    1
LGET1    EQU      %
         STW,R7   LINK              SAVE RETURN LINK
         LI,R3    0
         STW,R3   DCALT             ZERO OUT TOTAL SLAVE CALS
         LI,R3    J:OVHTIM-J:JIT
         LW,R5    VPAJIT,R3         GET OVHTIM FOR MON JIT
         STW,R5   VJOVHTIM          SAVE IT
         LI,R3    J:DELTAT-J:JIT
         LW,R5    VPAJIT,R3         GET DELTAT FROM MON JIT
         STW,R5   VJDELTAT          SAVE IT
         LI,R3    NSCPU             ANY SECONDSARY CPUS
         BEZ      GXDONE            NO
         LI,R9    0                 FOR ZEROING OUT CELLS
         LI,R4    C:CAL-X'200'
         LI,R5    SVPA1-X'200'
GSXDAT   AI,R5    X'200'
         LOAD,R6  SX:SPP+G,R3       GET PRIVATE PAGE #
         BNEZ     CASE1             SXSPP NE 0
         MTW,0    VSXSPP,R3         IS THE OLD PAGE ALSO
         BEZ      GSXNXT            YES
         B        CASE2             NO
CASE1    SLS,R6   9                 MAKE WORD ADDRESS
         LW,R8    VSXSPP,R3         GET OLD PAGE NUMBER
         BEZ      CASE3             IT IS ZERO NONE
         CW,R6    R8                ALREADY HAVE PAGE
         BE       GXDAT2            OKAY
CASE2    M:FVP    *R5               SX:SPP=0,VSXSPP NE 0
         STW,R9   VSXSPP,R3         ZERO OUT OLD PAGE
         AI,R6    0                 WAS NEW PAGE ZERO
         BEZ      GSXNXT            YES
CASE3    M:CVM    *R6,*R5           SXSPP NE 0 VSXPP = 0
         BCS,8    NOMAP1            PROBLEM TIME
         STW,R6   VSXSPP,R3
GXDAT2   LW,R7    *R5,R4            GET DATA CELL
         STW,R7   DCALT,R3
         AWM,R7   DCALT
GSXNXT   BDR,R3   GSXDAT
GXDONE   EQU      %
         LI,R3    #PROCS            NUMBER OF ENTRIES AVAILABLE
INIT1    LD,R8    PROCS,R3          PROCESSOR NAME FOR USERS DISPLAY
         LI,R4    PPROCS            MONITOR NUMBER OF ENTRIES
         CD,R8    P:NAME+F,R4       FOUND IT
         BE       INIT2             YES
         BDR,R4   %-2               CHECK AGAIN
         B        %+2               NOT THERE
INIT2    AI,R4    -BGNPMPRC+1       COMPUTE DISPLACEMENT
         STW,R4   DISPS,R3          SAVE DISPLACEMENT
         BDR,R3   INIT1             GET NEXT
         LI,R2    0                 INDEX INTO P:NAME
         LI,R5    0                 INDEX INTO SPNAME AND TS331 TABLES
         LI,R3    7
INIT3    LD,R10   P:NAME+F+(BGNPMPRC+BGNPMPRC),R2    GET TEXTC NAME
         CD,R10   TXTDUMLM          M:DUMLM ?
         BE       INIT31            YES
         STB,R3   R10               SET BYTE COUNT
         STW,R10  TS331,R5          STORE IN SIDINGS
         STW,R11  TS331+1,R5
         SLD,R10  8
         AI,R11   X'40'             STRIP OFF BYTE COUNT
         STW,R10  SPNAME,R5         SAVE IN SNAPSHOT BUFFER
         STW,R11  SPNAME+1,R5
         AI,R5    2
INIT31   AI,R2    1
         CI,R5    ENDPMPRC+ENDPMPRC # OF ENTRIES BEING PROCESSED
         BGE      INIT5             NO MORE ROOM
         CI,R2    PPROCS            CHECKED ALL P:NAME ENTRIES
         BL       INIT3             NO
INIT5    EQU      %                 DONE
*        TRANSFER DATE / TIME TO SNAPSHOT BUFFER
         LI,R9    BA(SNTIME)        TIME DATE INTO SNAPSHOT
         LI,R1    16
         STB,R1   R9
         LI,R8    (4*CTIME)+1
         MBS,R8   0
         LW,R1    F+X'2B'
         STW,R1   SMONDES
         LD,R8    SITEID+F
         STD,R8   SSITE             SAVE IN SNAPSHOT BUFFER
*        SET UP DISTRIBUTION AHEAD OF LGET5
         LI,R1    1                 #OF DISTRIBUTION
         LI,R15   CH:DI2+F          NEW DISTRIBUTION
         LI,R13   ODI2              OLD DISTRIBUTION
         LI,R12   SDI2              SNAP DISTRIBUTION
         LI,R14   TDI2              TOTAL
         LI,R10   SDIST2            SNAPSHOT BUFFER AREA
         BAL,R11  SNAPHIS
         LI,R3    LPART
         LD,R8    DOUBLEZERO
         LI,R2    0
LGET11   MTH,0    PLH:SID+F,3
         BEZ      LGET12
         LH,R1    PLH:QN+F,3
         AW,R9    R1                ACCUMULATE BATCH QUANTUM
         AI,R2    1                 INCREMENT BATCH USER COUNT
LGET12   BDR,R3   LGET11
         DW,R8    R2
         SLS,R8   1
         CW,R8    R2
         BL       LGET13
         AI,R9    1
LGET13   STW,R9   ABQUAN
         LD,R8    DOUBLEZERO
         LI,R7    0
         LI,R3    NSCPU             ANY SECONDARY CPUS
         BEZ      LGET16
LGET14   MTB,0    SB:STATE+G,R3     IS IT ACTIVE
         BEZ      LGET15            NO
         AI,R7    1
         LH,R1    SH:MAXQ+G,R3      GET MAX QUAN FOR THIS CPU
         AW,R9    R1
LGET15   BDR,R3   LGET14
         AI,R7    0                 ANY CPUS ACTIVE
         BEZ      LGET16            NO
         DW,R8    R7                COMPUTE AVE MAXQ FOR ACTIVE CPUS
         SLS,R8   1
         CW,R8    R7
         BL       %+2
         AI,R9    1
LGET16   STW,R9   VSCPUA            AVE MAXQ FOR SCPUS
         AI,R7    1                 PLUS ONE FOR PRIMARY CPU
         STW,R7   VNSCPU            # OF ACTIVE SCPUS
         LI,R5    SNULL             NULL STATE
         LD,R6    DOUBLEZERO        R6=ONLINE USERS:R7=BATCH USERS
         LD,R8    DOUBLEZERO        R8,R9 ACCUM BATCH USERS PAGES
         LD,R10   DOUBLEZERO        R10,R11 ACCUM ONLINE USER PAGES
         LI,R1    SMUIS             R1=SMUIS,SMUIS-1,...,1   INDEX
         LI,R2    BAT               BATCH FLAG
LGET17   EQU      %
         CB,R5    UB:US+F,R1        IS IT NULL STATE
         BE       LGET19            YES
         LB,R4    UB:PCT+F,R1       GET # PAGES
         CH,R2    UH:FLG+F,R1       BATCH JOB
         BAZ      LGET18            NO
         AW,R9    R4                ACCUMULATE BATCH USER PAGES
         AI,R7    1
         B        LGET19
LGET18   AW,R11   R4                ACCUMULATE ONLINE USER PAGES
         AI,R6    1
LGET19   BDR,R1   LGET17
*        DIVIDE ACCUMULATORS BY # OF USERS
         DW,R8    R7
         SLS,R8   1
         CW,R8    R7
         BL       LGET1A
         AI,R9    1
LGET1A   STW,R9   AVBATP
         DW,R10   R6
         SLS,R10  1
         CW,R10   R6
         BL       LGET1B
         AI,R11   1
LGET1B   STW,R11  AVONLP
         LI,R3    0
LGET1C   AI,R3    1                 BUMP INDEX
         CI,R3    D30               ALL DONE
         BG       LGET2
         LW,R4    AVAL1,R3          GET ADDR OF VALUE
         LW,R4    0,R4              GET VALUE
         STW,R4   ANEW1,R3          SAVE AS NEW
         B        LGET1C            GOTO LGET1C
         PAGE
*D*      NAME:    LGET2
*D*      DESCRIPTION:
*D*               THIS PART OF THE SUBROUTINE IS USED TO FETCH THE
*D*               SINGLE ITEMS AS DEFINED BY THE STERMS PROC AND
*D*               WHOSE ENTRIES ARE GENERATED BY THE BTERMS PROC
*D*               FOR EACH ITEM THE ADDRESS OF THE VALUE TO BE FETCHED
*D*               IS FOUND IN ITS AGET TABLE ENTRY. THE NEW VALUE IS
*D*               STORED IN THE ANEW2 TABLE. THE PREVIOUSLY OBTAINED
*D*               VALUE IS STORED IN THE PARALLEL ENTRY IN AOLD2.
         SPACE    1
LGET2    LI,R3    1                 INDEX
LGET2A   AI,R3    1                 BUMPUP
         CI,R3    IXSUM             INDEX > #SINGLE USE ITEM
         BGE      LGET3             YES
         LW,R4    AGET,R3           GET ADDR OF NEW VALUE
         LW,R4    0,R4              GET VALUE
         XW,R4    ANEW2,R3          SAVE AS NEW AND GET OLD
         STW,R4   AOLD2,R3          SAVE PREVIOUS AS OLD
         B        LGET2A            GOTO LGET2A
         PAGE
*D*      NAME:    LGET3
*D*      PURPOSE:
*D*               TO GET THE VALUES FOR THE GROUP ITEMS
*D*      REGISTERS:
*D*               ALL REGISTERS ARE VOLATILE WITHIN THIS ROUTINE
*D*               R1 CONTAINS THE OPERAND FOR THE PARTICULAR ACTION RTN
*D*               R4 IS USED INITIALLY AS THE DISPLACEMENT TO THE GIVEN
*D*               ACTION RTN AND MAY BE USED WITHIN A GIVEN ROUTINE
*D*               BUT NOT CARRIED BETWEEN ROUTINES
*D*               R9 IS USED IN GENERAL AS AN ACCUMULATOR BETWEEN RTNS
*D*               R6 IS USED AS THE INDEX THROUGHOUT THE GROUP TABLES
*D*               AND MAY NOT BE USED WITHIN A GIVEN ACTION ROUTINE
*D*               R3 IS USED AS THE INDEX THROUGH ALL GROUPS AND MAY
*D*               NOT BE USED WITHIN AN ACTION ROUTINE
*D*               R5 IS USED AS THE INDEX FOR THE START OF THE
*D*               PARTICULAR GROUP IN THE ANEW3 AREA AND
*D*               MAY NOT BE USED EXCEPT FOR THIS PURPOSE
*D*      DESCRIPTION:
*D*               UPON ENTRY THE VALUES FOR CERTAIN ITEMS
*D*               NEEDED  FOR COMPUTATIONS ARE TRANSFERRED FROM THE
*D*               NEW TABLES BEGINNING AT VCIT TO THE OLD TABLES
*D*               BEGINNING AT VOCIT.  THE BUFFERED CURRENT
*D*               TIME FOR THIS SAMPLE IS COMPUTED AND STORED IN
*D*               VTIC AND ALSO CONVERTED TO SECONDS AND STORED IN VSEC
*D*               NEW VALUES FROM THE PREVIOUS SAMPLE PERIOD (ANEW3)
*D*               ARE SAVED AS THE OLD VALUES FOR THIS SAMPLE
*D*               PERIOD (AOLD3).  THE NEW SUM FROM THE PREVIOUS
*D*               SAMPLE PERIOD (ASUMN)  IS SAVED AS THE OLD SUM
*D*               FOR THIS SAMPLE (ASUMO).
*D*               THEN EACH GROUP OF GETS IS PROCESSED.
*D*               THE ACTION INDEX IN BYTE 0 OF EACH PSEUDO INSTRUCTION
*D*               IS A DISPLACEMENT FROM L3START.CONTENTS OF BYTE 1-3
*D*               OF EACH PSEUDO INSTRUCTION ARE ACTION RTN DEPENDENT
*D*               LGET3A IS THE POINT WHERE (NEXT) GROUP IS SET UP
*D*               LGET3B IS THE POINT AT WHICH THE (NEXT)
*D*               PSEUDO INSTRUCTION IS SET UP.
*D*               NEW ROUTINES MUST BE WITHIN 255 WORDS OF L3START
         SPACE    1
LGET3    LI,R1    13                TABLE LENGTH
         LW,R0    VCIT-1,R1
         STW,R0   VOCIT-1,R1
         BDR,R1   %-2               LOOP THROUGH TEMP DATA
         LW,R1    C:CTUN+F          COMPUTE CURRENT TIME IN TICS
         SW,R1    C:TINC+F
         AW,R1    C:TIC+F           ADD ACCUMULATED TICS
         STW,R1   VTIC
         AI,R1    500/2             ANTICIPATE ROUNDING
         DW,R1    =500
         STW,R1   VSEC              CONVERT TO SECONDS
         LI,R5    DT                #ITEMS IN ALL USE GROUPS
         LW,R0    ANEW3,R5          SAVE NEW VALUES FROM PRIOR SAMPLE
         STW,R0   AOLD3,R5          AS OLD VALUES THIS SAMPLE
         BDR,R5   %-2
         LI,R1    -8                ZERO OUT STATE COUNT TABLE
         STW,R5   STCOUNT+8,R1
         BIR,R1   %-1
         LI,R1    SMUIS             #USERS
         LB,R5    UB:US+F,R1
         MTB,1    STCOUNT,R5        COUNT NUMBER OF USERS IN EACH STATE
         BDR,R1   %-2
         LI,R9    0
         LI,R1    LNOL
         BEZ      LGET31            NONE
         AI,R1    -1
         LI,R3    0
         LB,R5    BUFCNT+F,R3
         AW,R9    R5
         AI,R3    1
         BDR,R1   %-3
LGET31   STW,R9   DBUFCNT
         LI,R3    #SUSE+1           INITIALIZE INDEX
         LI,R5    1                 INITIALIZE INDEX TO NEW VALUES
LGET3A   EQU      %                 GET (NEXT) GROUP
         AI,R3    1                 INCREMENT INDEX TO GROUPS
         CI,R3    IXSYS             ALL DONE
         BGE      LGET5             YES
         STB,R5   ASAVE,R3          SAVE INDEX FOR GROUP
         LW,R0    ASUMN,R3          SAVE NEW SUM FROM PRIOR SAMPLE
         STW,R0   ASUMO,R3          AS OLD SUM FOR THIS SAMPLE
         LW,R6    AGET,R3           GET POINTERS TO GETS FOR THIS GROUP
         LI,R9    0
         STW,R9   TOTAL
         STW,R9   VDISP
LGET3B   EQU      %                 GET (NEXT) PSEUDO INSTRUCTION
         LW,R1    0,R6              GET ORDER AND OPERAND
         LB,R4    R1                ORDER
         AND,R1   M24               STRIP TO OPERAND
         B        L3START,R4        TRANSFER TO ROUTINE
         PAGE
L3START  EQU      %                 BEGINNING OF ACTION ROUTINES
*
L3PLUS   EQU      %                 X=X+OP(DISP)
         CI,R1    F                 IS IT A PREF
         BE       L3LOOP            YES
         AW,R1    VDISP
         AW,R9    0,R1
         B        L3LOOP            GET NEXT INSTRUCTION
*
L3PLUSBY EQU      %
         LB,R0    STCOUNT,R1
         AW,R9    R0
         B        L3LOOP            GET NEXT INSTRUCTION
*
L3MINUS  EQU      %                 X=X-OP
         CI,R1    F                 IS IT A PREF
         BE       L3LOOP
         SW,R9    0,R1
         B        L3LOOP            GET NEXT INSTRUCTION
*
L3TIMES  EQU      %                 X=X*OP
         MW,R8    0,R1
         B        L3LOOP            GET NEXT INSTRUCTION
*
L3DIVID  EQU      %                 X=X/OP ROUNDED
         LI,R8    0
         CW,R8    *R1
         BE       L3LOOP
         DW,R8    0,R1
         SLS,R8   1
         CW,R8    *R1
         BL       L3LOOP
         AI,R9    1
         B        L3LOOP
*
L3SMQ    EQU      %
         LW,R1    0,R1              GET INDEX VALUE
         BEZ      L3LOOP            NO PROCESSOR
         AI,R1    BGNPMPRC-1
         LI,R4    SMUIS
         LI,R7    SNULL
SMQNXT   CB,R7    UB:US+F,R4        NULL
         BE       BDRSMQ            YES
         CB,R1    UB:APR+F,R4       ASSOC W. USER
         BE       SMQADD            YES
         CB,R1    UB:ASP+F,R4
         BE       SMQADD
         CB,R1    UB:DB+F,R4
         BNE      BDRSMQ
SMQADD   AI,R9    1                 YES
BDRSMQ   BDR,R4   SMQNXT
         B        L3LOOP
*
L3IDISP  STW,R1   VDISP
         B        L3LOOP
*
L3ADDTO  EQU      %                 OP=OP+X
         AWM,R9   0,R1
         B        L3LOOP
*
L3SAVES  EQU      %                 SUM(R3)=X
         STW,R9   ASUMN,R3
         B        L3LOOP
*
L3SAVEZ  EQU      %                 OP=X;X=0
         STW,R9   *R1
         LI,R9    0
         B        L3LOOP
*
L3FLAG   EQU      %                 X=#USERS W. BIT(S) OP
         LI,R2    SMUIS
         CH,R1    UH:FLG+F,R2
         BAZ      %+2
         AI,R9    1
         BDR,R2   %-3
         B        L3LOOP
*
L3NEXT   EQU      %                 ANEW3(R5)=X;R5=R5+1:DISP=0
         STW,R9   ANEW3,R5
         AI,R5    1
L3LOOPZ  LI,R9    0
         STW,R9   VDISP
*
L3LOOP   EQU      %                 GET NEXT PSEUDO INSTRUCTION
         AI,R6    1
         B        LGET3B
*
L3DONE   EQU      %                 GET NEXT GROUP
         B        LGET3A
*
L3TABLE  EQU      %
         LW,R2    R1
         B        L3LOOP
*
L3SUMDISP EQU     %
         LI,R7    SNULL
         LI,R4    SMUIS
         LW,R1    *R1
         BEZ      L3LOOP
         AI,R1    BGNPMPRC-1
DISPNXT  CB,R7    UB:US+F,R4
         BE       BDRDISP           NULL STATE FOR USER
         CB,R1    *R2,R4            IS THIS THE USER
         BNE      BDRDISP
         AI,R9    1
BDRDISP  BDR,R4   DISPNXT
         B        L3LOOP
*
L3SUMALL EQU      %                 SUM VALUES IN TABL (1-N)
         LI,R7    1                 INDEX
SUMNXT   LW,R9    *R1,R7            GET VALUE
         STW,R9   ANEW3,R5          SAVE IT
         AWM,R9   TOTAL             SUMUP
         AI,R5    1
         AI,R7    1
         BDR,R2   SUMNXT            R2 = NUMBER OF ENTRIES
         B        L3LOOPZ           DONE
*
L3GET7   LW,R7    R1
         B        L3LOOP
*
L3GET8   LW,R8    R1
         B        L3LOOP
*
L3GETS   LI,R11   NSCPU             ANY SECONDARY CPUS ?
         BEZ      L3LOOP            NO
         LI,R2    1
MPNXT    LI,R9    0
         LW,R4    *R7,R2
         STW,R4   ANEW3,R5
         AW,R9    R4
         AI,R5    1
         LW,R4    *R8,R2
         STW,R4   ANEW3,R5
         AI,R5    1
         AW,R9    R4
         STW,R9   ANEW3,R5
         AI,R5    1
         AI,R2    1
         BDR,R11  MPNXT
         B        L3LOOPZ
         PAGE
*D*      NAME:    LGET5
*D*      INTERFACE:
*D*               SNAPHIS - TO COMPUTE AND STORE SNAPSHOT DISTRIBUTION
*D*                         VALUES
*D*      DESCRIPTION:
*D*               THIS PART OF THE LGET SUBROUTINE FETCHES THE REST
*D*               OF THE DATA. THE VALUES FROM THE DISTRIBUTION
*D*               TABLES (CH:XX) OTHER THAN CH:DI2 ARE
*D*               OBTAINED, COMPUTED AND STORED VIA REPETITIVE
*D*               CALLS TO SNAPHIS. RETURN FROM LGET1
*D*               IS EFFECTED VIA THE SAVED LINK REGISTER.
         SPACE    1
LGET5    LI,R0    #DRS              NUMBER OF GROUPS
         LI,R10   SDIST1-8          SNAPSHOT BUFFER AREA
         LI,R7    SPDIST-8          SNAPSHOT BUFFER FOR PROCESSOR DIST
         LI,R3    0                 INDEX
LGET5XT  LB,R1    SZDI,R3           # OF DISTRIBUTIONS
         CI,R1    2                 IS IT PROCESSOR DISTRIBUTION
         BNE      %+2               NO
         AI,R7    8                 YES,BUMP UP POINTER
         LW,R15   CHDI,R3           NEW DISTRIBUTION IN MON BUFFER AREA
         LW,R13   ODI,R3            OLD DISTRIBUTION
         LW,R12   SDI,R3            SNAPSHOT DISTRIBUTION
         LW,R14   TDI,R3            SNAPSHOT DIST TOTAL
         AI,R10   8                 BUMP UP SNAPSHOT BUFFER AREA
         BAL,R11  SNAPHIS           COMPUTE DISTRIBUTIONS
         AI,R3    1
         CI,R10   SDIST1            FIRST TIME THROUGH
         BNE      %+2               NO
         LI,R10   SDIST3-8          SNAPSHOT BUFFER AREA
         BDR,R0   LGET5XT           DO NEXT
         B        *LINK             RETURN
         PAGE
*D*      NAME:    LOUT1
*D*      INTERFACE:
*D*               SOUTA - TO FORMAT AN ENTRY IN THE BUFFER
*D*               SEND - TO OUTPUT A LINE FROM THE BUFFER
*D*               SBINOUT - TO CONVERT VALUE TO EBCDIC AND
*D*                         FORMAT IN BUFFER
*D*               SBLANK - TO APPEND BLANKS TO THE BUFFER
*D*      INPUT:
*D*               APRIN - PRINT FLAG BYTE TABLE
*D*               ASIDE - TABLE OF START OF SIDING ADDRESSES
*D*               ASIDL - TABLE OF # OF WORDS IN SIDING
*D*               ANEW1 - TABLE OF NEW VALUES
*D*               ASCAL1 - TABLE OF SCALE FACTORS TO BE APPLIED
*D*                        TO EACH ENTRY
*D*               ADIGITS - TABLE OF # OF DIGITS PER ENTRY
*D*      DESCRIPTION:
*D*               THIS SUBROUTINE IS THE MAIN ENTRY INTO THE GENERATION
*D*               OF THE DISPLAY VALUES AND FOR GENERATION OF MOST OF
*D*               THE SNAPSHOT BUFFER ENTRIES.
*D*               WITHIN THE AREA DEFINED BY LOUT1 TO LOUT2 THE ITEMS
*D*               FOR THE PARAM DISPLAY OR C(ONTROL!) COMMAND ARE
*D*               PROCESSED AS FOLLOWS.
*D*               1. IF GENERATING DISPLAYS THEN A CHECK IS MADE TO
*D*                  INSURE THE TIME IS INCREASING (VTIC > VOTIC). IF
*D*                  NOT THE MESSAGE UNEXPECTED CHANGE IN TIME REPORT
*D*                  SKIPPED IS OUTPUT AND AN IMMEDIATE RETURN
*D*                  IS EFFECTED
*D*               2. IF EITHER THE PARAM OR CONTROL! OPTION IS BEING
*D*                  PROCESSED THE HEADING IS FORMATTED AND OUTPUT
*D*                  VIA CALLS TO SOUTA AND SEND.
*D*               3. REPETITIVE PASSES ARE MADE THROUGH THE LOOP
*D*                  BEGINNING AT LOUT1A TO OBTAIN THE VALUES FOR THE
*D*                  DISPLAY AND FOR THE SNAPSHOT BUFFER STORED
*D*                  BEGINNING AT SCONT
*D*                  FOR DISPLAYS THE SIDING START IS OBTAINED
*D*                  FROM THE ASIDE TABLE TO WHICH THE #WORDS/SIDING IS
*D*                  ADDED FROM THE ASIDL TABLE ON SUBSEQUENT PASSES
*D*                  THE NEW VALUE IS FETCHED FROM THE ANEW1 TABLE THE
*D*                  SCALING FACTOR TO BE APPLIED OBTAINED FROM THE
*D*                  ASCAL1 TABLE. THE RESULT IS STORED IN SCONT AREA
*D*                  IF EITHER DISPLAY IS BEING GENERATED THE SIDING
*D*                  IS FORMATTED IN THE BUFFER VIA A CALL TO SOUTA
*D*                  THE MAX # OF DIGITS IN THE VALUE FETCHED FROM THE
*D*                  ADIGITS TABLES AND A CALL TO SBINOUT
*D*                  MADE TO CONVERT THE VALUE TO EBCDIC AND FORMAT
*D*                  FORMATTED IN THE BUFFER.
*D*                  WHEN BOTH COLUMNS OF OUTPUT/LINE HAVE
*D*                  BEEN PROCESSED SEND IS CALLED TO OUTPUT THE
*D*                  LINE AND THE OPERATION IS REPEATED
*D*               4. WHEN ALL ENTRIES HAVE BEEN PROCESSED A CHECK
*D*                  IS MADE TO DETERMINE IF THE ROUTINE HAS BEEN
*D*                  ENTERED IN RESPONSE TO A CONTROL! IN WHICH
*D*                  CASE THE ROUTINE IS EXITED THROUGH THE SAVED
*D*                  LINK REGISTER.
*D*                  OTHERWISE CONTROL GOES TO THE LOUT2 ROUTINE
*D*                  FOR FURTHER DISPLAYS AND/OR SNAPSHOT PROCESSING.
         SPACE    1
LOUT1    EQU      %
         STW,R7   LINK              SAVE RETURN LINK
*        TEST FOR UNEXPECTED RESET IN C:TIC DUE TO RESET OR FAULT
         LW,R1    FCEXC             TIME TEST NOT NEC IF FCEXC SET
         BNEZ     LOUT1AA
         LW,R1    VOTIC             IS TIME INCREASING
         CW,R1    VTIC
         BL       LOUT1AA                YES
         STW,R1   VTIC
         TYPE     'UNEXPECTED CHANGE IN TIME - REPORT SKIPPED'
         B        *LINK             RETURN
LOUT1AA  EQU      %
         LI,R3    1                 INDEX
         LI,R5    0
         LI,R10   1                 EVEN = 1
         LB,R0    APRIN,R3
         AW,R0    FCEXC
         BEZ      LOUT1A            NO
         LI,R1    TH30
         BAL,R7   SOUTA
         BAL,R7   SEND
         LW,R11   ASIDE,R3          GET START OF SIDING
         B        %+2
LOUT1A   AW,R11   ASIDL,R3          BUMP UP SIDING ADDRESS
         AI,R5    1
         CI,R5    D30               DONE
         BG       LOUT1Z            YES
         LI,R8    0
         LW,R9    ANEW1,R5          GET NEW VALUE
         LW,R0    ASCAL1,R5         SCALE FACTOR
         BNEZ     LOUT12
         SLS,R9   1
         B        %+2
LOUT12   DW,R8    R0
         STW,R9   SCONT,R5          STORE IN SNAPSHOT BUFFER
         LB,R0    APRIN,R3
         AW,R0    FCEXC
         BEZ      LOUT1A
         LW,R1    R11               GET SIDING ADDRESS
         BAL,R7   SOUTA
         LB,R1    ADIGITS,R3
         LW,R2    R9
         BAL,R7   SBINOUT           CONVERT AND FORMAT
         CI,R10   0
         BE       LOUT1C
         LI,R10   0
         LI,R1    2
         BAL,R7   SBLANK            SPACE OVER
         B        LOUT1A
LOUT1C   LI,R10   1
         BAL,R7   SEND              OUTPUT A LINE
         B        LOUT1A
LOUT1Z   LB,R0    APRIN,R3
         AW,R0    FCEXC
         BEZ      %+2
         BAL,R7   SEND
         LB,R0    COMMAND
         CI,R0    C'C'
         BNE      LOUT2
         B        *LINK
         PAGE
*D*      NAME:    LOUT2
*D*      INTERFACE:
*D*               SOUTA - TO FORMAT AN ENTRY IN THE BUFFER
*D*               SBINOUT - TO CONVERT TO EBCDIC AND FORMAT IN BUFFER
*D*               SEND - TO OUTPUT A LINE FROM THE BUFFER
*D*      INPUT:
*D*               ASIDE - TABLE OF SIDING START ADDRESS
*D*               ASCAL - TABLE OF SCALING FACTORS TO BE APPLIED
*D*               ADIGITS - TABLE OF MAXIMUM # OF DIGITS IN VALUE
*D*               ANEW2 - TABLE OF NEW VALUES FOR ITEMS
*D*      DESCRIPTION:
*D*               THIS ROUTINES OBTAINS THE VALUES FOR THE SINGLE
*D*               ITEMS AND FORMATS AND OUTPUTS THEM
*D*               NO DATA IS SAVED FOR THE HISTORY FILES
         SPACE    1
LOUT2    EQU      %
LOUT2A   AI,R3    1
         CI,R3    IXSUM
         BGE      LOUT3             DONE
         MTB,0    APRIN,R3          PRINT IT
         BEZ      LOUT2A            NO
         LW,R1    ASIDE,R3          GET SIDING
         BAL,R7   SOUTA             FORMAT IT
         LI,R8    0
         LW,R9    ANEW2,R3          GET NEW VALUE
         LW,R0    ASCAL,R3
         DW,R8    R0
         LB,R1    ADIGITS,R3
         LW,R2    R9
         BAL,R7   SBINOUT           CONVERT AND FORMAT
         BAL,R7   SEND              OUTPUT IT
         B        LOUT2A
         PAGE
*D*      NAME:    LOUT3
*D*      REGISTERS:
*D*               ALL REGISTERS ARE VOLATILE
*D*               R3  USED AS INDEX TO GROUP BEING PROCESSED
*D*               R11 USED AS #OF DISPLAYS PER LINE
*D*      INTERFACE:
*D*               SPAGE - TO UPSPACE TO NEW PAGE
*D*               SOUTA - TO FORMAT AN ENTRY IN BUFER
*D*               SBLANK - TO ADD BLANKS TO BUFFER
*D*               SEND - TO OUTPUT A LINE FROM BUFFER
*D*      INPUT:
*D*               AHEAD - TABLE OF HEADING ADDRESS FOR EACH GROUP
*D*               APRIN - TABLE OF PRINT FLAGS FOR EACH GROUP
*D*      DESCRIPTION:
*D*               LOUT3 BEGINS THE PROCESSING OF THE GROUP
*D*               DISPLAYS (I.E. THOSE THAT HAVE BEEN DEFINED
*D*               BY THE GTERMS PROC AND USING TABLES BUILT BY
*D*               THE BTERMS PROC). WITHIN THE AREA DEFINED BY
*D*               LOUT3A TO LOUT3A2 THE HEADING FOR THOSE DISPLAYS THAT
*D*               ARE REQUESTED ARE OUTPUT TWO TO A LINE
*D*               EXCEPT FOR SUMMARY DISPLAY IN WHICH ONLY ONE PER LINE
*D*               IS DONE.
*D*               FOR A GIVEN DISPLAY AFTER OUTPUTING THE HEADER
*D*               CONTROL FALLS INTO LOUT3B.
         SPACE    1
LOUT3    LI,R3    #SUSE+1           SET UP GROUP INDEX
LOUT3A   LW,R10   R3                SAVE INDEX TO 1ST OF CURRENT ROW
         BAL,R7   SPAGE             UPSPACE TO NEW PAGE
         LI,R11   2                 2 GROUPS/LINE OR BLOCK
LOUT3A1  AI,R3    1
         CI,R3    IXSYS             ALL DONE
         BGE      LOUT3A2
         MTB,0    APRIN,R3          DISPLAY THIS ONE
         BEZ      LOUT3A1           NOPE
         CI,R3    IXSUM             IT IS SUMMARY DISPLAY
         BNE      %+2               NO
         LI,R11   1                 ONLY ONE DISPLAY  PER LINE
         LW,R1    AHEAD,R3          GET HEADER ADDRESS
         BAL,R7   SOUTA             FORMAT IN BUFFER
         LI,R1    2                 PUT IN TWO BLANKS
         BAL,R7   SBLANK
         BDR,R11  LOUT3A1
LOUT3A2  BAL,R7   SEND              OUTPUT HEADER
         PAGE
*D*      NAME:    LOUT3B
*D*      REGISTERS:
*D*               R3 - INDEX OF GROUP BEING PROCESSED
*D*               R10 - INDEX TO FIRST OF CURRENT ROW
*D*               R11 - # OF DISPLAYS PER LINE
*D*      INTERFACE:
*D*               SBLANK - ADD BLANKS TO BUFFER
*D*               SOUTA - TO FORMAT ENTRY IN BUFFER
*D*               SBINOUT - CONVERT AND FORMAT ENTRY IN BUFFER
*D*               SPD - TO INSERT DECIMAL POINT BEFORE LAST CHARACTER
*D*               SEND - TO OUTPUT A LINE
*D*      INPUT:
*D*         PARALLEL TABLES (DEFINED FOR ENTIRE GROUP)
*D*               ASIDE (WORD) - STARTING ADDRESS OF SIDINGS
*D*               ASIDL (WORD) - #OF WORDS IN A SIDING
*D*               APRIN (BYTE) - PRINT FLAGS FOR A DISPLAY
*D*               ALINES (BYTE) - # OF ROWS IN THE DISPLAY
*D*               ADIV (BYTE) - FLAG TO INDICATE DIVISION
*D*                             TO BE PERFORMED
*D*               ADEC (BYTE) - FLAG INDICATING DECIMAL POINT IN OUTPUT
*D*               ASCAL (WORD) - SCALING FACTOR TO BE APPLIED TO VALUES
*D*               ASAM (BYTE) - FLAG INDICATING TWO COLUMNS OF OUTPUT
*D*               ADIGITS (BYTE) - MAXIMUM # OF DIGITS IN VALUES
*D*               ASAVE (BYTE) - RELATIVE START OF GROUP VALUES IN
*D*                                ANEW,AOLD AREA
*D*               ASUMO (WORD) - SUM VALUES FROM PREVIOUS SAMPLE
*D*               ASUMN (WORD) - SUM VALUES FROM CURRENT SAMPLE
*D*
*D*         OTHER TABLES
*D*               AOLD - SAMPLE VALUES FROM PREVIOUS INTERVAL
*D*                      1 ENTRY FOR EACH ELEMENT IN EVERY GROUP
*D*                      STARTING INDEX FOR A GROUP IS SAVED IN ASAVE
*D*                      GROUP ENTRY
*D*               ANEW - SAMPLE VALUES FROM CURRENT INTERVAL ENTRIES
*D*                      DEFINED AS FOR AOLD TO WHICH IT IS PARALLEL
*D*      DESCRIPTION:
*D*               THIS ROUTINE CONDITIONALLY DISPLAYS THE
*D*               DATA FOR THOSE GROUPS WHOSE FLAG IN APRIN IS SET
*D*               AND UNCONDITIONALLY COMPUTES THE VALUES FOR ALL
*D*               GROUPS AND STORES THEM IN THE SNAPSHOT BUFFER.
*D*               UPON ENTRY EACH GROUP IS SCANNED. IF A DISPLAY IS NOT
*D*               REQUESTED THE DISPLAY PARAMETERS OF THE GROUP ARE
*D*               NOT CONSIDERED IN FORMATTING
*D*               OTHERWISE,2 GROUPS ARE DISPLAYED PER LINE
*D*               EXCEPT FOR THE SUMMARY DISPLAY (1 PER LINE)
*D*               THE LARGEST # OF ENTRIES FOR THE GIVEN DISPLAY
*D*               IN A LINE IS SAVED AS THE MAXIMUM DEPTH OF A DISPLAY
*D*               FOR THE GROUPS BEING OUTPUT ON THE SAME LINES
*D*               THE SIDING FOR THE GROUP IS OUTPUT. THEN THE
*D*               OVERALL OR 1ST COLUMN STATISTICS VALUE IS OBTAINED.
*D*               IF THE GROUP BEING PROCESSED IS SUMMARY THIS INVOLVES
*D*               FETCHING THE NEW VALUE OR BLANKING OUT THE COLUMN
*D*               ENTRY IF NO OVERALL STATS IS TO BE GATHERED
*D*               IF THE VALUE IS TO BE DIVIDED THEN THE
*D*               ANEW VALUE AFTER APPROPRIATE SCALING IS APPLIED
*D*               IS DIVIDED BY THE ASUMN VALUE . THE RESULT IS STORED
*D*               IN THE SNAPSHOT BUFFER AND CONVERTED AND FORMATTED IF
*D*               A DISPLAY IS REQUESTED
*D*               IF THE GROUP CALLS ALSO FOR A 'SNAP' COLUMN OUTPUT
*D*               THEN FOR THE SUMMARY DISPLAY THE APPROPRIATE VALUE IS
*D*               OBTAINED AND SAVED AS THE OLD SUM OR THE PARTICULAR
*D*               NEW VALUE OBTAINED AS APPROPRIATE. FOR OTHER
*D*               DISPLAYS THE SAMPLE IS COMPUTED (ANEW-AOLD) AND
*D*               IF DIVISION IS REQUIRED THE (ASUMN-ASUMO)>0 VALUE
*D*               IS DIVIDED INTO THE SAMPLE STAT APPORPRIATELY SCALED
*D*               THE RESULT IS STORED IN THE SNAPSHOT BUFFER AND
*D*               CONVERTED AND FORMATED IF REQUIRED FOR A DISPLAY
*D*               THIS OPERATION IS REPEATED UNTIL ALL GROUPS HAVE BEEN
*D*               PROCESSED WHEN CONTROL IS TRANSFERRED TO LOUT4.
         PAGE
LOUT3B   EQU      %
         LI,R0    0
         STW,R0   MDEPTH            INITIALIZE MAX DEPTH
         STW,R0   DEPTH             INITIALIZE DEPTH
LOUT3B1  LW,R3    R10               INIT. INDEX TO 1ST OF CURRENT LINE
         LI,R11   2                 TWO   GROUPS AT A TIME
LOUT3B2  AI,R3    1                 INCREMENT GROUPT INDEX
         CI,R3    IXSYS             ANY MORE GROUPS
         BGE      LOUT3E1           CHECK FOR END
         MTB,0    APRIN,R3          DO THIS DISPLAY
         BEZ      LOUT3B3           NO
         CI,R3    IXSUM             IS IT SUMMARY
         BNE      %+2               NO
         LI,R11   1                 ONLY ONE GROUP  THIS LINE
LOUT3B3  LB,R0    ALINES,R3         IF DEPTH OF CURRENT GROUP
         CW,R0    MDEPTH            > THAN MDEPTH
         BLE      %+2
         STW,R0   MDEPTH            SAVE AS LARGEST
         CW,R0    DEPTH             DEPTH OF CURRENT GROUP<
         BG       LOUT3B4           > CUURENT DEPTH CONTINUE
         LW,R6    AHEAD,R3          OTHERWISE BLANK OUT
         LB,R1    *R6               AREA
         MTB,0    APRIN,R3          DO THIS DISPLAY
         BEZ      LOUT3EZ           NO...
         BAL,R7   SBLANK
         B        LOUT3EZ
LOUT3B4  LW,R1    DEPTH             GET ENTRY NUMBER
         MTB,0    APRIN,R3          DO THID DISPLAY
         BEZ      LOUT3C            NO
         MW,R1    ASIDL,R3          X #WORDS PER ENTRY
         AW,R1    ASIDE,R3          PLUS START  OF SIDING
         BAL,R7   SOUTA             FORMAT IN BUFFER
LOUT3C   CI,R3    IXSUM
         BNE      LOUT3C1           NOT SUMMARY
         LW,R1    DEPTH
         EXU      ASUMRYN,R1        GET ENTRY OR TRANSFER TO BLANK OUT
         STW,R0   ASUMN,R3          RESULT AS NEW SUM IF GET HERE
LOUT3C1  LB,R5    ASAVE,R3          GET REL START OF ITEMS
         AW,R5    DEPTH             ADD DEPTH
         LW,R9    ANEW3,R5          GET NEW SAVED VALUE
         MTB,0    ADIV,R3           DIVIDE FLAG ON
         BEZ      LOUT3C2           NO
         MTW,0    ASUMN,R3          NO DIVIDING BY ZERO
         BEZ      LOUT3C2
         MW,R8    ASCAL,R3          SCALE BY GROUP MULTIPLIER
         DW,R8    ASUMN,R3          ANEW3*ASCAL/ASUMN
         SLS,R8   1
         CW,R8    ASUMN,R3          ROUND UP IF NECESSARY
         BL       LOUT3C2
         AI,R9    1
LOUT3C2  LB,R1    ADIGITS,R3        #OF DIGITS IN CURRENT GROUP
         LW,R2    R9
         STW,R9   SNAPSUM2,R5       OVERALL STATS IN SNAPSHOT BUFFER
         MTB,0    APRIN,R3
         BEZ      LOUT3D            NO DISPLAY
         BAL,R7   SBINOUT           CONVERT AND FORMAT IN BUFFER
         MTB,0    ADEC,R3           DECIMAL POINT
         BEZ      %+2               NO
         BAL,R7   SPD               DEC PT BEFORE LAST CHARACTER
LOUT3D   MTB,0    ASAM,R3           SAMPLE ALSO
         BEZ      LOUT3EZ           NO
         CI,R3    IXSUM
         BNE      LOUT3D1           NOT SUMMARY
         LW,R1    DEPTH
         EXU      ASUMRYO,R1
         STW,R0   ASUMO,R3          SAVE AS OLD SUM IF GET HERE
LOUT3D1  LW,R9    ANEW3,R5          SAMPLE=ANEW3-AOLD3
         SW,R9    AOLD3,R5
         MTB,0    ADIV,R3           DIVIDE FLAG ON
         BEZ      LOUT3D2           NO
         LW,R12   ASUMN,R3          ASUMN-ASUMNO
         SW,R12   ASUMO,R3
         BEZ      LOUT3D2           NO DIVIDE BY ZERO
         LI,R8    0
         MW,R8    ASCAL,R3          SCALE FACTOR
         DW,R8    R12
         SLS,R8   1
         CW,R8    R12               ROUND UP IF NECESSARY
         BL       LOUT3D2
         AI,R9    1
LOUT3D2  LB,R1    ADIGITS,R3        GET # OF DIGITS
         LW,R2    R9
         STW,R9   SNAPSUM2,R5       STORE SAMPLE IN SNAPSHOT BUFFER
         MTB,0    APRIN,R3          DISPLAY REQUESTED
         BEZ      LOUT3EN           NO
         BAL,R7   SBINOUT           CONVERT AND FORMAT
         MTB,0    ADEC,R3           DECIMAL POINT
         BEZ      %+2
         BAL,R7   SPD               YES
LOUT3EZ  MTB,0    APRIN,R3          DOING THIS DISPLAY
         BEZ      LOUT3EN           NO
         LI,R1    2
         BAL,R7   SBLANK            SPACE OVER
         AI,R11   -1
LOUT3EN  AI,R5    1                 INCREMENT ITEM INDEX
         CI,R11   0                 PRINT AREA FILLED
         BG       LOUT3B2           NO
LOUT3E1  BAL,R7   SEND              OUTPUT ONE LINE
         LW,R0    DEPTH             INCREMENT DEPTH
         AI,R0    1
         STW,R0   DEPTH
         CW,R0    MDEPTH            NOT DONE THIS GROUP
         BL       LOUT3B1
         CI,R3    IXSYS             ALL DONE
         BGE      LOUT4             YES
         B        LOUT3A            NO
         PAGE
*        DIVISORS FOR SUMMARY GROUP - OVERALL STATISTICS, COL 1
ASUMRYN  B        LOUT3C3           1  - # BATCH STREAMS
         B        LOUT3C3           2  - # LOGGED USERS
         B        LOUT3C3           3  - % CPU/BATCH USER
         B        LOUT3C3           4  - % CPU/ONLINE USER
         LW,R0    VBSR              5  - BATCH EXECUTION/SERVICE
         LW,R0    VLSR              6  - ONLINE EXECUTION/SERVICE
         LW,R0    VRTRW             7  - CPU MSEC PER I/O
         LW,R0    VSCI              8  - ONLINE TIME MIX
         LW,R0    VTYP              9  - ONLINE INTENSITY
         LW,R0    VSIT              10 - TASKS/MIN
         LW,R0    VCIT              11 - % INTERACTIVE
         B        LOUT3C3           12 - 90 % RESPONSE
         LW,R0    VCIT              13 - TASK TURNAROUND
         B        LOUT3C3           14 - ETMF
*                                   INSTRUCTIONS FOR EXU INDEXED
*        DIVISORS FOR SUMMARY GROUP - SNAP COL
ASUMRYO  B        LOUT3O            1
         B        LOUT3O            2
         B        LOUT3O            3
         B        LOUT3O            4
         LW,R0    VOBSR             5
         LW,R0    VOLSR             6
         LW,R0    VORTRW            7
         LW,R0    VOSCI             8
         LW,R0    VOTYP             9
         LW,R0    VOSIT             10
         LW,R0    VOCIT             11
         B        LOUT3O            12
         LW,R0    VOCIT             13
         B        LOUT3O            14
         PAGE
LOUT3C3  MTB,0    APRIN,R3
         BEZ      LOUT3D
         LI,R1    8
         BAL,R7   SBLANK
         B        LOUT3D
LOUT3O   LB,R5    ASAVE,R3
         AW,R5    DEPTH
         LW,R9    ANEW3,R5
         B        LOUT3D2
         PAGE
*D*      NAME:    LOUT4
*D*      INPUT:
*D*               AHEAD4 - TABLE OF PTRS TO COMPONENTS OF HEADING
*D*                        IN REVERSE ORDER FOR SYSTEM DISPLAY
*D*               ADIST4 - TABLE OF PTRS TO SNAPSHOT DISTRIBUTION CELLS
*D*                        IN REVERSE ORDER FOR SYSTEM DISPLAY
*D*                        (SDLO,SDLI,...)
*D*               ATOT4 - TABLE OF PTRS TO SYSTEM DISTRIBUTION TOTAL
*D*                       TABLE IN REVERSE ORDER (TDLO,TDLI,...)
*D*      DESCRIPTION:
*D*               THE SYSTEM DISTRIBUTION DISPLAY IS DRIVEN FROM LOUT4
*D*               VIA A CALL TO LDO4 IN WHICH ALL THE DISPLAY IS
*D*               PROCESSED AND OUTPUT.
         SPACE    1
LOUT4    EQU      %
         LI,R3    IXSYS             SYSTEM DISPLAY REQUESTED
         MTB,0    APRIN,R3
         BEZ      LOUT4A            NO CHECK PROC DISPLAY
         LI,R10   AHEAD4            PTR TO HEADING PTR TABLE
         LI,R14   ADIST4            PTR TO SNAPSHOT DIST PTR TABLE
         LI,R15   ATOT4             PTR TO TOTAL SAMPLE PTR TABLE
         BAL,R11  LDO4              GO DO ALL DISPLAY
         PAGE
*D*      NAME:    LOUT4A
*D*      INPUT:
*D*               AHEAD4A - TABLE OF PTRS TO COMPONENTS OF HEADING
*D*                         IN REVERSE ORDER FOR PROCESSOR DISPLAY
*D*               ADIST4A - TABLE OF PTRS TO SNAPSHOT DISTRIBUTION
*D*                         CELLS IN REVERSE ORDER FOR PROCESSOR
*D*                         DISPLAY (SDLO+8,SDLI+8,...)
*D*               ATOT4A - TABLE OF PTRS TO PROCESSOR DISTRIBUTION
*D*                        TOTAL TABLE IN REVERSE ORDER
*D*                        (TDLO+8,TDLI+8,...)
*D*      DESCRIPTION:
*D*               THE PROCESSOR DISTRIBUTION DISPLAY IS DRIVEN
*D*               FROM LOUT4A VIA A CALL TO LDO4 IN WHICH ALL THE
*D*               DISPLAY IS PROCESSED AND OUTPUT
         SPACE    1
LOUT4A   EQU      %
         LI,R3    IXPROC            PROC DISPLAY REQUESTED
         MTB,0    APRIN,R3
         BEZ      LOUT5             NO,CHECK NEXT DISPLAY
         LW,R10   PROCNUM           GET PROCESSOR INDEX
         STW,R10  SPROCNUM          PUT IN SNAPSHOT BUFFER
         LD,R10   PROCNAME          GET PROCESSOR NAME
         STW,R10  SPROCNAM          PUT IN SNAPSHOT BUFFER
         STW,R11  SPROCNAM+1
         LI,R10   AHEAD4A           PTR TO HEADING PTR TABLE
         LI,R14   ADIST4A           PTR TO SNAPSHOT DIST PTR TABLE
         LI,R15   ATOT4A            PTR TO TOTAL SAMPLE PTR TABLE
         BAL,R11  LDO4              GO DO ALL DISPLAY
         PAGE
*D*      NAME:    LOUT5
*D*      INTERFACE:
*D*               LHEAD - TO OUTPUT THE HEADING
*D*               PERCENT - TO COMPUTE PERCENTAGE DISTRIBUTION
*D*               SOUTA - TO FORMAT AN ENTRY IN THE BUFFER
*D*               SBINOUT - TO CONVERT AND FORMAT AN ENTRY IN BUFFER
*D*               SEND - TO OUTPUT A LINE FROM THE BUFFER
*D*      INPUT:
*D*               AHEAD5 - TABLE OF PTRS TO COMPONENTS OF HEADING
*D*                        IN REVERSE ORDER FOR SWAP DISPLAY
*D*               ADIST5 - TABLE OF PTRS TO SWAP DISTRIBUTION CELLS
*D*                        IN REVERSE ORDER (SDI3,SDI1,...)
*D*               ATOT5 - TABLE OF PTRS TO SWAP DISTRIBUTION
*D*                       TOTAL TABLES IN REVERSE ORDER(TDI3,TDI1,...)
*D*      DESCRIPTION:
*D*               THE SWAP DISTRIBUTION DISPLAY IS PROCESSED VIA A CALL
*D*               TO LHEAD IN LDO4 TO OUTPUT THE HEADING. THE VALUES
*D*               TO BE DISPLAYED ARE COMPUTED VIA A CALL TO PERCENT
*D*               AND THE FINAL ENTRY (#TOT) OUTPUT VIA REPETITIVE
*D*               CALLS TO SBINOUT. UPON COMPLETION CONTROL IS
*D*               TRANSFERRED BACK TO THE CALLING
*D*               ROUTINE THROUGH THE LINK REGISTER SAVED IN LOUT1.
         SPACE    1
LOUT5    EQU      %
         LI,R3    IXSWAP            SWAP DISPLAY REQUESTED
         MTB,0    APRIN,R3
         BEZ      *LINK             NO,RETURN AT LAST
         LI,R10   AHEAD5            PTR TO HEADING PTR TABLE
         STW,R10  PTEMP3            SAVE IT
         BAL,R11  LHEAD             DO HEADING
         LI,R12   ADIST5            PTR TO SNAPSHOT DIST PTR TABLE
         LI,R13   ATOT5             PTR TO TOTAL SAMPLE PTR TABLE
         STD,R12  PTEMP1            SET THEM UP
         LI,R5    2                 LINE (ROW) INDEX 2,3,4,...,15
LPCT51   LI,R4    5                 COLUMN INDEX
         LI,R1    TD5C              SIDING ENTRY
         AW,R1    R5                DOUBLE WORD ENTRY
         AW,R1    R5
         BAL,R7   SOUTA             FORMAT IN BUFFER
         LI,R3    1                 # TO BE PROCESSED THIS TIME
         BAL,R11  PERCENT           COMPUTE PERCENTAGE
         LI,R6    2                 LOOP CONTROL
         LI,R3    1                 # PROCESSED THIS TIME
LPCT52   LI,R1    TD1D              SIDING ENTRY
         AW,R1    R5                DOUBLEWORD ENTRY
         AW,R1    R5
         BAL,R7   SOUTA             FORMAT IN BUFFER
         BAL,R11  PERCENT           COMPUTE VALUE
         LI,R3    3                 # PROCESSED THIS TIME
         BDR,R6   LPCT52            DO LOOP AGAIN
         BAL,R7   SEND              OUTPUT THIS LINE
         AI,R5    1
         CI,R5    16                DONE DISPLAY
         BL       LPCT51            NO
         LI,R6    4                 # OF PASSES  THROUGH LOOP
LTOT5    LI,R1    TOT4              SIDING (#TOT)
         BAL,R7   SOUTA             FORMAT IN BUFFER
         LI,R1    5                 # OF DIGITS
         LW,R2    ATOT5,R6          GET PTR TO TABLE
         LW,R2    0,R2              GET VALUE
         BAL,R7   SBINOUT           CONVERT,FORMAT IN BUFFER
         BDR,R6   LTOT5             DO AGAIN
         BAL,R7   SEND              OUTPUT LINE
         B        *LINK             RETURN AT LAST
         PAGE
*D*      NAME:    LDO4
*D*      INTERFACE:
*D*               SPAGE - TO UPSPACE TO NEW PAGE
*D*               SOUTA - TO FORMAT ENTRY IN BUFFER
*D*               PERCENT - TO COMPUTE DISTRIBUTION PERCENTS
*D*               SEND - TO OUTPUT ONE LINE OF BUFFER
*D*               SBINOUT - TO CONVERT VALUE AND FORMAT IN BUFFER
*D*      INPUT:
*D*               R10 = PTR TO THE HEADING PTR TABLE ( AHEADN)
*D*               R11 = LINK REGISTER
*D*               R14 = PTR TO SNAPSHOT DISTRIBUTION PTR TABLE
*D*                         (ADISTN -> SD TABLES)
*D*               R15 = PTR TO TOTAL SAMPLE TABLE (ATOTN->TD TABLES)
*D*      OUTPUT:
*D*               SYSTEM OR PROCESSOR DISPLAY
*D*      DESCRIPTION:
*D*               UPON ENTRY THE INPUT REGISTERS ARE SAVED IN
*D*               PTEMP3,LDOLINK,PTEMP1,PTEMP2 RESPECTIVELY.
*D*               THE HEADING IS OUTPUT FOR THE PARTICULAR DISPLAY
*D*               USING THE LHEAD SUBROUTINE
*D*               THE SIDING IS PLACED IN THE BUFFER AND THE
*D*               PERCENTAGES CALCULATED VIA A CALL TO PERCENT.
*D*               THIS OPERATION IS REPEATED UNTIL THE ENTIRE BODY OF
*D*               THE DISPLAY IS OUTPUT HAVING BEEN WRITTED A LINE(ROW)
*D*               AT A TIME.  THE SEGMENT STARTING AT LTOT THEN OUTPUTS
*D*               THE FINAL LINE OF THE DISPLAY (#TOT) AND A RETURN IS
*D*               EFFECTED TO THE CALLING ROUTINE.
         SPACE    1
LDO4     EQU      %
         STD,R10  PTEMP3            SAVE HEADING PTR,LINK
         STD,R14  PTEMP1            SAVE DISTPTR;TOTAL PTR
         LI,R11   LPERCT            CALL NEXT CODE
         SPACE    1
LHEAD    EQU      %
         BAL,R7   SPAGE             UPSPACE TO NEW PAGE
         CI,R10   AHEAD4A           IS IS PROC DISPLAY
         BNE      %+3               NO
         BAL,R11  LSETP4
         LI,R11   LPERCT            RESET RETURN
         LI,R5    12                TOTAL # OF ITEMS IN HEADING
LHEAD1   LI,R3    4                 ITEMS TO BE DONE THIS TIME
LHEAD2   LW,R1    *PTEMP3,R5        ADDRESS OF HEADER PART
         BAL,R7   SOUTA             FORMAT IN BUFFER
         AI,R5    -1
         BDR,R3   LHEAD2            DO NEXT PART
         BAL,R7   SEND              OUTPUT ONE LINE(ROW)
         CI,R5    0
         BG       LHEAD1
         B        *R11              RETURN
         SPACE    1
LPERCT   EQU      %
         LI,R5    2                 LINE INDEX 2,3,4,...15
LPER1    LI,R4    7                 COLUMN INDEX
         LI,R1    LOUT5             CALLED FROM PROC DISPLAY
         CW,R1    LDOLINK
         BNE      %+2               NO
         AI,R4    -2                ADJUST COLUMN INDEX
         LI,R1    TD1D              GET SIDING
         AW,R1    R5                DOUBLEWORD ENTRY
         AW,R1    R5
         BAL,R7   SOUTA             FORMAT SIDING
         LW,R3    R4                NUMBER OF COLUMNS TO DO
         AI,R3    -2
         BAL,R11  PERCENT           COMPUTE,CONVERT,STORE IN BUFFER
         LI,R1    TD4A              SIDING
         AW,R1    R5                DOUBLE WORD ENTRY
         AW,R1    R5
         BAL,R7   SOUTA             FORMAT SIDING
         LI,R3    2                 NUMBER OF ENTRIES TO DO
         BAL,R11  PERCENT
         BAL,R7   SEND              OUTPUT LINE
         AI,R5    1
         CI,R5    16                DONE WITH BODY OF DISPLAY
         BL       LPER1             NO
         SPACE    2
LTOT     EQU      %
         LI,R5    7                 # OF ITEMS
         LI,R4    5                 COLUMN INDEX
         LI,R1    LOUT5             CALLED FROM PROC DISPLAY
         CW,R1    LDOLINK
         BNE      %+3               NO
         AI,R5    -2
         AI,R4    -2
LTOT1    LI,R1    TOT4              '#TOT' SIDING
         BAL,R7   SOUTA             FORMAT IN BUFFER
LTOT2    LI,R1    5                 # OF DIGITS
         LW,R2    *PTEMP2,R5        GET TABLE ADDRESS
         LW,R2    0,R2              GET VALUE
         BAL,R7   SBINOUT           CONVERT AND FORMAT IN BUFFER
         AI,R5    -1
         BLEZ     LTOT3             ALL DONE
         BDR,R4   LTOT2             GET NEXT ENTRY
         LI,R4    2                 COLUMN INDEX THIS TIME
         B        LTOT1
LTOT3    BAL,R7   SEND              OUTPUT THE LINE
         B        *LDOLINK          RETURN
         PAGE
*D*      NAME:    PERCENT
*D*      INTERFACE:
*D*               SBINOUT - TO CONVERT VALUE TO EBCDIC AND FORMAT ENTRY
*D*                      IN BUFFER
*D*               SPD - TO INSERT DECIMAL POINT IN FRONT OF LAST
*D*                     CHARACTER IN BUFFER
*D*      REGISTERS:
*D*               ALL REGISTERS ARE VOLATILE
*D*      INPUT:
*D*               R4  = THE COLUMN INDEX FOR THE ENTRIES/ROW
*D*               R5  = LINE INDEX IN DISPLAY
*D*               R11 = LINK REGISTER
*D*               PTEMP1 = PTR TO PARTICULAR TABLE OF DIST TABLE PTRS
*D*                                 (ADISTN->SD TABLES)
*D*               PTEMP2 = PTR TO PARTICLUAR TABLE OF TOTAL PTRS
*D*                                 (ATOTN->TD TABLES)
*D*      OUTPUT:
*D*               VALUES COMPUTED,CONVERTED TO EBCDIC AND
*D*               FORMATED IN BUFFER
*D*               R3 = 0
*D*               R4 = REMAINING COLUMNS TO BE DONE OR 0
*D*      DESCRIPTION:
*D*               THE ALGORITHM USED TO COMPUTE THE VALUE IS:
*D*                SNAPSHOT DISTVALUE*1000/TOTAL # OF SAMPLES
*D*               I.E.,(SD TABLE ENTRY)*1000/(TD TABLE ENTRY)
         SPACE    1
PERCENT  EQU      %
         LW,R1    *PTEMP1,R4        GET DIST TABLE PTR
         LH,R9    *R1,R5            GET ENTRY
         LW,R10   *PTEMP2,R4        GET ADDR OF TOTAL SAMPLE TABLE
         LW,R10   *R10              GET TOTAL ENTRY
         BEZ      PCT2              TOTAL IS ZERO
         LI,R8    0                 MULTIPLY DISTRIBUTION
         MW,R8    =1000             BY 1000
         DW,R8    R10               DIVIDE BY TOTAL
         SLS,R8   1                 CHECK REMAINDER
         CW,R8    R10               ROUND UP
         BL       PCT2              NOT NECESSARY
         AI,R9    1                 IT IS
PCT2     LI,R1    4                 # OF DIGITS
         LW,R2    R9                GET VALUE
         BAL,R7   SBINOUT           CONVERT AND FORMAT IN BUFFER
         BAL,R7   SPD               INSERT DECIMAL POINT
         AI,R4    -1
         BDR,R3   PERCENT           DO NEXT ENTRY
         B        *R11              RETURN
         PAGE
         PAGE
*D*      NAME:    USNAP
*D*      DESCRIPTION:
*D*               THIS SUBROUTINE IS CALLED TO OPEN THE F:3 DCB
*D*               IF THE SNAPSHOT FLAG IS SET.
*D*               IF STATS IS BEING RUN AS A GHOST THE FILE IS
*D*               SNAPSHOT IN ACCT :STATS. OTHERWISE
*D*               THE FILE IS SNAPSHOT IN THE CURRENT ACCOUNT.
*D*               THE FILE IS DEFINED AS KEYED,DIRECT AND IS
*D*               OPENED INOUT,SHARED
*D*               IF THE FILE DOES NOT EXIST IT IS OPENED
*D*               OUT AND CLOSED, THEN THE INOUT SHARED OPEN IS
*D*               REISSUED.  IF THE FILE IS ALREADY OPENED, IT IS
*D*               CLOSED AND REOPENED INOUT,SHARED
*D*               ANY OTHER ABNORMAL/ERROR CONDITION CAUSES A MESSAGE
*D*               TO BE OUTPUT (M:DO BATCH/ONLINE; M:OC GHOST)
*D*               AND CONTROL TO BE TRANSFERRED TO LSTAR.
*D*               OTHERWISE FOR NORMAL OPERATIONS CONTROL IS RETURNED
*D*               VIA THE LINK REGISTER (R7).
         SPACE    1
USNAP    MTW,0    SNAPF             TEST SNAPSHOT FILE FLAG
         BEZ      0,R7
         LC       J:JIT
         BCS,4    USNAPG1           GHOST JOB
USNAP2   M:OPEN   F:3,(KEYED),(DIRECT),(SAVE),;
                  (ABN,OSE4),(INOUT,SHARE)
         TYPE     ' SNAPSHOT FILE  OPENED'
         B        0,R7
USNAPG1  M:OPEN   F:3,(FILE,'SNAPSHOT',':STATS'),(SAVE),;
                  (ABN,OSG4),(KEYED),(DIRECT),(INOUT,SHARE)
         M:TYPE   (MESS,AT21)
         B        0,R7
*
*        ABNORMAL CODES ON OPENS
*
OSE4     LB,R1    R10               RETRIEVE ABNORMAL CODE
         CI,R1    X'03'
         BE       OSE5              FILE DOES NOT EXIST - CREATE IT
         CI,R1    X'2E'
         BE       OSE5+1            FILE ALREADY OPEN - CLOSE IT
         TYPE     'SNAPSHOT FILE ERROR'
         B        LSTAR
*
OSE5     M:OPEN   F:3,(KEYED),(DIRECT),(OUT),(SAVE)
         M:CLOSE  F:3,(SAVE)        FILE CREATED
         B        USNAP2            RE-TRY OPEN F:3 FOR UPDATE
OSG4     LB,R1    R10               RETRIEVE ABNORMAL CODE
         CI,R1    X'03'
         BE       OSG5              FILE DOES NOT EXIST - CREATE IT
         CI,R1    X'2E'
         BE       OSG5+1            FILE ALREADY OPEN - CLOSE IT
         M:TYPE   (MESS,AT24)
         B        LSTAR
OSG5     M:OPEN   F:3,(FILE,'SNAPSHOT',':STATS'),(OUT),;
                  (KEYED),(DIRECT),(SAVE)
         M:CLOSE  F:3,(SAVE)
         B        USNAPG1
         PAGE
*D*      NAME:    WSNAP
*D*      DESCRIPTION:
*D*               IF SNAPSHOTS ARE BEING TAKEN, WSNAP IS CALLED
*D*               TO WRITE OUT THE SNAPSHOT BUFFER.  THE LINK REGISTER
*D*               (R7) IS SAVED UPON ENTRY.  THE KEY FOR THE RECORD IS
*D*               FORMED FROM THE TMS OPTION OF THE M:TIME CAL ISSUED
*D*               AT THE TIME OF THE DATA COLLECTION.
*D*               THE FORMAT OF THE 7 BYTE KEY IS:
*D*                    YEAR IN BINARY DAY IN JULIAN HOUR MIN SEC
*D*               AFTER WRITING OUT THE RECORD A MESSAGE IS OUTPUT VIA
*D*               M:DO OF THE FORM
*D*                    RECORD # N  TIME DAY
*D*               RETURN IS VIA THE SAVED LINK REGISTER.
         SPACE    1
WSNAP    MTW,0    SNAPF             TEST SNAPSHOT FILE FLAG
         BEZ      0,R7
         STW,R7   LINK
         LD,R0    TIME1             GET TIME AS KEY
         SLD,R0   -8                POSITION IT
         SLD,R0   8
         MTB,7    R0                BYTE COUNT
         STD,R0   NKEY              STORE THE NEW KEY IN PLACE
         M:WRITE  F:3,(SIZE,STOTB),(KEY,NKEY),;
                      (NEWKEY),(WAIT)
         LI,R1    AT11
         BAL,R7   SOUTA
         LI,R1    3
         LW,R2    ICOUNT
         BAL,R7   SBINOUT
         LI,R1    2
         BAL,R7   SBLANK
         LI,R1    CTIME
         BAL,R7   SOUTA
         LI,R2    BUFFER
         LI,R1    1
         XW,R1    VBUFCNT
         CAL1,1   ADO
         B        *LINK
         PAGE
*D*      NAME:    CSNAP
*D*      DESCRIPTION:
*D*               IF SNAPSHOT RECORDS ARE BEING GENERATED, CSNAP
*D*               IS CALLED WHEN THE REQUIRED NUMBER OF SAMPLES
*D*               HAS  BEEN TAKEN. THE SNAPSHOT FILE IS CLOSED AND
*D*               SAVED.  A MESSAGE IS OUTPUT INDICATING THIS
*D*               (VIA M:DO FOR ONLINE/BATCH AND M:OC FOR GHOST)
*D*               CONTROL IS RETURNED VIA THE LINK REGISTER (R7).
         SPACE    1
CSNAP    MTW,0    SNAPF
         BEZ      0,R7
         M:CLOSE  F:3,(SAVE)
         LC       J:JIT
         BCR,4    %+2               NOT GHOST JOB
         M:TYPE   (MESS,AT22)
         TYPE     ' SNAPSHOT FILE  COMPLETED'
         B        0,R7
         PAGE
*D*      NAME:    INITABLES
*D*      REGISTER:
*D*               R11 - LINK REGISTER
*D*               ALL OTHER REGISTERS VOLATILE
*D*      DESCRIPTION:
*D*               THIS SUBROUTINE IS ENTERED ONLY ONCE DURING
*D*               STATS INITIALIZATION PHASE.
*D*               UPON ENTRY A CHECK IS MADE TO INSURE THAT THE
*D*               USER HAS AT LEAST AN X'80' PRIVILEGE TO BE
*D*               ABLE TO MAP ONTO THE MONITOR. IF NOT A MESSAGE
*D*               IS OUTPUT AND STATS EXITS.
*D*               THEN A CHECK IS MADE TO INSURE THAT STATS HAS BEEN
*D*               LOADED WITH THE CORRECT MONSTK. IF NOT A MESSAGE IS
*D*               IS OUTPUT AND STATS DOES AN IMMEDIATE ABORT.
*D*               ELSE THE MONITOR'S JIT IS M:CVM'ED ONTO AT VIRTUAL
*D*               PAGE ADDRESS OF X'F000'.
*D*               IF THE SYSTEM BEING MONITORED IS A MULTIPROCESSING
*D*               SYSTEM THEN THE FOLLOWING OPERATIONS ARE
*D*               PERFORMED BEFORE RETURNING VIA THE LINK REGISTER(R11)
*D*               1. THE PRIVATE PAGES OF ALL SECONDARY CPUS (SX:SPP>0)
*D*                  ARE M:CVM'ED ONTO AT VIRTUAL PAGE ADDRESSES OF
*D*                  X'F200',X'F400',X'F600' AS NEEDED. THE WORD
*D*                  ADDRESS OF THE PRIVATE PAGE IS SAVED IN THE
*D*                  CORRESPONDING ENTRY
*D*                  IN VSXSPP. ANY ERRORS IN ATTEMPTING TO CVM
*D*                  CAUSES STATS TO OUTPUT A MESSAGE TAKE A SNAPSHOT
*D*                  OF THE REGISTERS AND EXIT.
*D*               2. IF LESS THAN 3 SECONDARY CPUS HAVE BEEN DEFINED
*D*                  THEN THE 2 DISPLAYS SCPU AND EVNT ARE MODIFIED
*D*                  AS FOLLOWS:
*D*                  FOR SCPU AND EVNT THE # OF LINES IN THE DISPLAY
*D*                  (ALINES) IS CONVERTED TO REFLECT THE TOTAL
*D*                  # OF SECONDARY CPUS
*D*                  SCPU - 3*#SCPUS
*D*                  EVNT - 2*#SCPUS+2 FOR PRIMARY CPU
*D*                  FOR EVNT DISPLAY THE SIDING ITSELF IS ADJUSTED TO
*D*                  REFLECT THE TRUE # OF SECONDARY CPUS
         SPACE    1
INITABLES EQU     %
         LI,R1    JB:PRIV
         LB,R1    0,R1
         CI,R1    X'80'             PRIVILEGE HIGH ENOUGH
         BL       NOMAP
         CI,R1    X'C0'             IS IT C0 OR BETTER
         BL       %+2
         MTW,1    C0FLAG            YES,SET FLAG
         LW,R3    X'40'             CHECK TO SEE IF CORRECT MONSTK
         AND,R3   M17               STRIP  TO ADDRESS
         AI,R3    X'16000'          DUMMY TO REFERENCE MONITOR AREA
         LW,R3    2,R3              GET TO PSD TRAP CATCHER
         AND,R3   M17               STRIP TO ADDRESS
         CI,R3    NOPPGM            IS IT CORRECT ADDRESS
         BE       DOJIT             YES
         LC       J:JIT             NO,BAD NEWS
         BCR,4    %+2               RUNNING NOT AS GHOST
         M:TYPE   (MESS,AT25)
         LI,R2    AT25              GET ADDRESS OF MESSAGE
         LB,R1    *R2               GET BYTE COUNT
         CAL1,1   DO                WRITE THROUGH M:DO
         M:ERR                      ERROR EXIT
DOJIT    LI,R3    J:JIT
         M:CVM    *R3,VPAJIT
         BCS,8    NOMAP1            NO GO
         LI,R3    NSCPU
         BEZ      1A1               NO SLAVES.  SET UP MASTER.
         LI,R5    SVPA1-X'200'
LTABGIN  AI,R5    X'200'
         LOAD,R6  SX:SPP+G,R3       GET PRIVATE PAGE #
         BEZ      LTABNXT
         SLS,R6   9                 MAKE WORD ADDRESS
         M:CVM    *R6,*R5
         BCS,8    NOMAP1
         STW,R6   VSXSPP,R3
LTABNXT  BDR,R3   LTABGIN
         LI,R3    NSCPU
         CI,R3    3                 ALL THREE DEFINED
         BE       *R11              YES
1A1      LI,R5    IXSCPU            GROUP INDEX
         LI,R7    3                 #UNITS IN SCPU DISPLAY
         MW,R7    R3                TIMES #SCPUS
         STB,R7   ALINES,R5
         AI,R5    -IXSUM            CHANGE SNAPSHOT BUFFER NUMBER
         STW,R7   SDATAS,R5
         LI,R5    IXEVNT            EVNT GROUP INDEX
         LI,R7    2
         MW,R7    R3
         AI,R7    2
         STB,R7   ALINES,R5
         AI,R5    -IXSUM
         STW,R7   SDATAS,R5
         LI,R5    IXEVNT
         LW,R7    ASIDL,R5          GET #WORDS /UNIT
         LW,R9    R7
         MW,R7    R3                #OF WORDS
         LI,R8    TS402             START OF SIDING
         AW,R8    R7                COMPUTED
         AW,R9    R7                # OF WORDS TO BE MOVED
         LI,R4    0
         LW,R10   TS40M,R4
         STW,R10  *R8,R4
         AI,R4    1
         BDR,R9   %-3
         B        *R11
NOMAP    TYPE     'MONITOR ACCESS REQUIRES PRIV = 80'
         B        LEXIT
NOMAP1   TYPE     'PROBLEM GETTING PRIVATE PAGE'
         M:SNAP   'STATS'
         B        LEXIT
         PAGE
*D*      NAME:    NOPAGE
*D*      REGISTERS:
*D*               ALL REGISTERS VOLATILE
*D*      INPUT:
*D*               R1 CONTAINS ADDRESS OF PSD IN TCB TSTACK
*D*               R0 CONTAINS ADDRESS OF STACK PTR DOUBLEWORD IN TCB
*D*      DESCRIPTION:
*D*               THIS ROUTINE IS USED TO DEMAND PAGE STATS DATA AREA.
*D*               IT IS ENTERED WHENEVER A TRAP OCCURS AS A RESULT OF
*D*               A NON-ALLOWED OPERATION.  THE PURPOSE OF THIS ROUTINE
*D*               IS TO CVM ONTO ONLY THOSE PAGES OF MONITOR DATA
*D*               REQUIRED FOR GATHERING STATISTICS AND TO OBTAIN
*D*               ONLY THE CORRESPONDING VIRTUAL PAGES FOR TRANSFERRING
*D*               THE MONITOR DATA INTO STATS BUFFER AREA, THUS
*D*               MINIMIZING BOTH THE SUBSEQUENT TRANSFER TIME
*D*               AND THE SIZE OF THE PROCESSOR.
*D*               UPON ENTRY THE TRAP TYPE IS FETCHED FROM ITS POSITION
*D*               IN THE STACK. IF NOT X'40' THEN A SNAPSHOT OF THE
*D*               REGISTERS IS TAKEN AND STATS EXITS.
*D*               OTHERWISE THE ADDRESS OF THE INSTRUCTION CAUSING
*D*               THE TRAP IS FETCHED FROM THE PSD AND SAVED.
*D*               THE STACK PTR FOR THE PSD IS ALSO SAVED.
*D*               THE REGISTERS AT THE TIME OF THE TRAP ARE RESTORED
*D*               THE INSTRUCTION ANLZ'ED. THE RESULTING ADDRESS
*D*               IS CONVERTED TO A WORD ADDRESS. IF THE
*D*               INSTRUCTION WAS AN EXU THE OPERATION IS REPEATED.
*D*               THE ADDRESS IS THEN STRIPPED TO THE PAGE
*D*               BOUNDARY AND COMPARED AGAINST VALID RANGES
*D*               OF ADDRESSES (X'10000'-X'15FFF' FOR STATS BUFFER AREA
*D*               X'16000'-X'1BFFF' FOR MONITOR AREA). IF INVALID
*D*               A SNAPSHOT OF THE REGISTERS IS TAKEN.STATS EXITS
*D*               ELSE THE VIRTUAL ADDRESS IS STRIPPED AND SAVED IN THE
*D*               CVM FPT ALONG WITH ITS CORRESPONDING VIRTUAL ADDRESS
*D*               THE CORRESPONDING STATS VIRTUAL PAGE IS SET UP IN THE
*D*               GVP FPT.  THE M:CVM AND M:GVP ARE THEN ISSUED
*D*               IF EITHER IS NOT ACCEPTED A MESSAGE IS OUTPUT AND
*D*               STATS EXITS. ELSE DATA FROM THE MONITOR VIRTUAL PAGE
*D*               IS COPIED TO STATS BUFFER PAGE. A BIT MAP IS
*D*               FORMED IN PGMAP TO INDICATE THE PAGE HAS
*D*               BEEN MAPPED ONTO. STATS THEN ISSUES AN M:TRTN
         SPACE    1
NOPAGE   LI,R4    X'FF'
         AND,R4   18,R1             GET TRAP TYPE
         CI,R4    X'40'             IS IT NAO
         BNE      OUTBAD            NO,GO SAY SO &EXIT
         LW,R7    0,R1              GET INST ADDRESS
ISEXU    STW,R1   REGSV             SAVE STACK PTR FOR PSD
         STW,R7   GVPFPT            SAVE INST ADDRESS
         LCI      0
         LM,R0    2,R1              RESTORE REGS
         ANLZ,R2  *GVPFPT           ANLZ THE INST
         STCF     R5
         LW,R1    REGSV             RESTORE STK PTR FOR PSD
         LW,R7    GVPFPT            REST PTR TO INST
         LI,R4    0                 CC1&2 INDICATE ADDRESS RESOLUTION
         SLD,R4   2                 0=BYTE,1=HW,2=WD,3=DW
         AI,R4    -2
         SLS,R2   0,R4              MAKE RESULT WA
         LW,R11   =X'7F000000'
         LW,R10   =X'67000000'
         CS,R10   0,R7              IS IT EXU
         BNE      NOTEXU            NO
         LW,R7    R2
         CI,R7    16                IS IT IN REGS
         BGE      ISEXU             NO
         AW,R7    REGSV
         AI,R7    2                 SKIP PSD
         B        ISEXU             GO GET INST
NOTEXU   AND,R2   =X'1FE00'         STRIP TO PAGE ADDRESS
         CLM,R2   FTOGEND           IS IT IN RANGE
         BCS,6    OUTBAD            NO,SAY SO AND EXIT
         AI,R2    -G                STRIP OFF VIRTUAL PART
         BGEZ     %+2
         AI,R2    BSIZE+1
         STW,R2   CVMFPT            HAVE REAL ADDRESS
         MTB,7    CVMFPT            FORM CVM FPT
         LI,R7    G
         AW,R7    R2
         STW,R7   CVMFPT+1          R7 HAS MONITOR VIRTUAL PAGE
         LI,R8    F
         AW,R8    R2
         STW,R8   GVPFPT            R8 HAS STATS BUFFER VIRTUAL PAGE
         MTB,4    GVPFPT            FORM GVP FPT
         CAL1,8   CVMFPT            CVM ONTO PAGE
         BCS,8    NOGO              DIDNT DO IT
         CAL1,8   GVPFPT            GVP THE PAGE
         BCS,8    NOGO              DIDNT DO IT
         LI,R4    0
         LI,R3    512
         LW,R5    *R7,R4            MOVE THE DATA PAGE
         STW,R5   *R8,R4            INTO STATS BUFFER PAGE
         AI,R4    1
         BDR,R3   %-3
         SLS,R2   -9
         SLD,R2   -5
         SCS,R3   5                 FORM A BIT MAP ENTRY FOR THIS PAGE
         LCW,R3   R3
         LW,R7    X1+31,R3
         STS,R7   PGMAP,R2
         M:TRTN                     RETURN
NOGO     TYPE     ' NOT ENOUGH CORE AUTHORIZED'
         B        LEXIT
OUTBAD   M:SNAP   'STATRAP'
         B        LEXIT
         PAGE
*D*      NAME:    LBREAK
*D*      DESCRIPTION:
*D*               THIS SUBROUTINE IS ENTERED UPON RECEIPT OF A BREAK
*D*               CHARACTER. THE BREAK CONTROL FLAG IS SET TO -1.
*D*               IF PREVIOUSLY SET THEN AN IMMEDIATE M:TRTN IS ISSUED.
*D*               OTHERWISE, THE MESSAGE BREAK STATS IS OUTPUT VIA
*D*               M:DO AND CONTROL IS TRANSFERRED TO LSTAR.
         SPACE    1
LBREAK   EQU      %
         LI,R3    -1
         XW,R3    BFLG              SET BFLG ONLY ONCE
         BGEZ     %+2               WAS NOT PREVIOUSLY SET
         M:TRTN                     PREVIOUSLY SET JUST RETURN
         TYPE     'BREAK - STATS'
         B        LSTAR
         PAGE
*D*      NAME:    SDEC
*D*      REGISTERS:
*D*               NO REGISTERS SAVED
*D*               R7 - LINK REGISTER
*D*               R6 - USED AS LINK TO READSI ROUTINE
*D*               R1 - CONTAINS THE CONVERTED VALUE UPON RETURN
*D*               R0,R2,R4 - USED FOR INTERMEDIATE COMPUTATION
*D*      INTERFACE:
*D*               READSI - TO OBTAIN THE INPUT VALUE THROUGH M:SI DCB
*D*      DESCRIPTION:
*D*               THIS SUBROUTINE CONVERTS AN UNSIGNED INTEGER
*D*               INPUT THROUGH M:SI DCB   TO A BINARY NUMBER.
*D*               IF NO NUMBER IS INPUT OR IF THE INPUT CHARACTERS
*D*               ARE INVALID THEN RETURN IS MADE TO 0,R7
*D*               OTHERWISE THE CONVERTED VALUE IS CONTAINED IN R1
*D*               AND RETURN IS MADE TO 1,R7
*D*               THE ALGORITHM USED PROCESSES THE # BEGINNING WITH THE
*D*               LEFT MOST DIGIT.  AN ACCUMULATOR IS INITIALIZED TO 0
*D*               FOR EACH CHARACTER THE EBCDIC REPRESENTATION IS
*D*               STRIPPED. THE ACCUMULATOR IS MULTIPLIED BY 10
*D*               THE NEW VALID DIGIT IS ADDED TO THE ACCUMULATOR.
         SPACE    1
SDEC     LI,R1    10                ACCEPT 10 DIGIT NUMBER
         LI,R2    DECIMAL           BUFFER ADDRESS
         BAL,R6   READSI            GET VALUE
         LI,R2    0                 INDEX
         LI,R1    0                 ACCUMULATOR
         AI,R4    1                 ANY VALUE INPUT
         BLEZ     1,R7              NO
SDEC1    LB,R0    DECIMAL,R2        GET DIGIT
         AI,R0    -X'F0'            STRIP OFF EBCDIC
         BLZ      0,R7              NO GOOD
         MI,R1    10                MULTIPLY ACCUMULATOR
         AW,R1    R0                ADD NEW DIGIT
         AI,R2    1                 BUMP UP INDEX
         BDR,R4   SDEC1             GET NEXT DIGIT
         B        1,R7              RETURN
         PAGE                       NAME SUBROUTINE
*D*      NAME:    SNAME
*D*      DESCRIPTION:
*D*               THIS SUBROUTINE IS USED TO OBTAIN A CHARACTER STRING
*D*               (ITEM NAME) VIA M:SI DCB.  THE ENTRY IS STORED IN
*D*               BNAME AND THE STRING LENGTH IN VSIZE.
*D*               RETURN IS TO 1,R7 IF A NONZERO LENGTH
*D*               STRING IS OBTAINED
*D*               OTHERWISE RETURN IS TO 0,R7.
         SPACE    1
SNAME    EQU      %
         LD,R2    BLANK
         STD,R2   BNAME             STORE BLANKS IN FIRST 8 CHAR
         LI,R1    80                BYTE COUNT
         LI,R2    BNAME
         BAL,R6   READSI
         CI,R4    0
         BL       0,R7
         AI,R4    1                 BYTE BIAS-->BYTE COUNT
         STW,R4   VSIZE             STORE BYTE COUNT
         B        1,R7              NORMAL RETURN
         PAGE
*D*      NAME:    SNAPHIS
*D*      REGISTERS:
*D*               R1 = NUMBER OF DISTRIBUTIONS IN GROUP
*D*               R11 = LINK REGISTER
*D*               R12 = SNAPSHOT DISTRIBUTION TABLE ADDRESS
*D*               R13 = OLD DISTRIBUTION TABLE ADDRESS
*D*               R14 = SNAPSHOT DISTRIBUTION TOTAL TABLE
*D*               R15 = NEW DISTRIBUTION TABLE IN MONITOR BUFFER AREA
*D*               R10 = AREA IN SNAPSHOT BUFFER FOR VALUE
*D*               R7 = AREA IN SNAPSHOT BUUFER FOR PROCESSOR VALUE
*D*      DESCRIPTION:
*D*               TO COMPUTE AND STORE THE SNAPSHOT DISTRIBUTION
*D*               AND SAVE THE NEW VALUES
         SPACE    1
SNAPHIS  STW,R11  SNAPLNK           SAVE RETURN
         LI,R6    0                 INDEX
         LW,R8    *R15              SCALE FROM CH TABLES (WORD 0,2 HWS)
         STW,R8   *R12              STORE IN SD TABLES (1ST TWO HWS)
         STW,R8   *R10              PUT IN SNAPSHOT BUFFER
         LI,R5    2                 STARTING INDEX
         LI,R2    2                 INDEX FOR PROCESSOR
SNAPH1   LI,R11   14                14 HALFWORD DISTRIBUTIONS
         LI,R4    0                 ACCUMULATE TOTAL
SNAPH2   LH,R8    *R15,R5           GET NEW DIST
         AND,R8   M16               UNSIGNED POSITIVE VALUE
         LH,R9    *R13,R5           GET OLD DISTRIBUTION
         AND,R9   M16
         STH,R8   *R13,R5           STORE NEW OVER OLD
         CW,R8    R9                IF NEW < OLD ASSUME OVERFLOW
         BGE      %+2
         MTH,1    R8
         SW,R8    R9                GET DIFFERENCE
         AW,R4    R8                ACCUMULATE DIFFERENCE
         STH,R8   *R12,R5           STORE IN SNAPSHOT DIST TABLE
         EXU      SNAPH3,R6         STORE IN CORRECT SNAPSHOT AREA
         AI,R5    1
         AI,R2    1                 BUMP UP INDEX
         BDR,R11  SNAPH2            DO NEXT
         STW,R4   *R14,R6           SAVE TOTAL
         AI,R6    1
         AI,R1    -1                DONE ??
         BLEZ     *SNAPLNK          YES RETURN
         LI,R2    0                 NOW SET UP FOR PROCESSOR
         LH,R8    *R15,R5           GET SCALE FOR PROCESSOR
         STH,R8   *R7,R2            STORE IT IN BUFFER
         AI,R2    1
         AI,R5    1
         LH,R8    *R15,R5
         STH,R8   *R7,R2
         AI,R2    1
         AI,R5    1
         B        SNAPH1            GO DO IT
*
SNAPH3   STH,R8   *R10,R5           FOR SYSTEM
         STH,R8   *R7,R2            FOR PROCESSOR
         PAGE
*D*      NAME:    READSI
*D*      INPUT:
*D*               R2 - BUFFER ADDRESS
*D*               R1 - BUFFER LENGTH
*D*               R6 - LINK REGISTER
*D*      OUTPUT:
*D*               R4 - # OF SIGNIFICANT BYTES INPUT
*D*      REGISTERS:
*D*               USES REGISTERS R3,R4
*D*      DESCRIPTION:
*D*               UPON ENTRY A READ IS ISSUED THROUGH THE M:SI DCB
*D*               IF SUCCESSFUL THE NEWLINE/CARRIAGE RETURN CHARACTER
*D*               IS STRIPPED OFF.
*D*               IF M:SI HAS BEEN ASSIGNED TO A FILE, THEN THE INPUT
*D*               BUFFER IS ALSO WRITTEN OUT VIA M:DO
*D*               IF AN ERROR OTHER THAN TRUNCATED INPUT IS DETECTED
*D*               THEN STATS EXITS VIA A TRANSFER OF CONTROL TO LEXIT.
         SPACE    1
READSI   M:READ   M:SI,(BUF,*R2),(SIZE,*R1),(ABN,SIER),(ERR,SIER)
         MTW,1    LCOUNT
         LW,R4    M:SI+4
         SAS,R4   -17
         CI,R4    -1
         BNE      %+2
         LW,R4    M:SI+13                NO - GET BUFFER SIZE
SNAME1   AI,R4    -1
         BLZ      SNAME3
         LB,R3    *R2,R4
         CI,R3    X'15'
         BE       SNAME2            STRIP NEW LINE CHAR
         CI,R3    X'0D'
         BE       SNAME2            STRIP CARRIAGE RETURN
         CI,R3    X'40'
         BE       SNAME1            STRIP BLANK
SNAME3   LW,R3    LCOUNT
         CI,R3    1                 IS THIS LINE 1
         BG       %+4               NO - SKIP CONTROL CARD TEST
         LW,R3    *R2               LOAD FIRST FOUR CHAR
         CW,R3    =C' STA'          TEST FOR STATS CONTROL CARD
         BE       READSI            READ NEXT COMMAND
         LI,R3    7
         AND,R3   M:SI
         CI,R3    1
         BNE      0,R6              RETURN IF NOT A FILE
         STW,R1   TEMP              SAVE R1
         LW,R1    R4                GET BYTE COUNT
         AI,R1    1
         CAL1,1   ADO               WRITE IT OUT
         LW,R1    TEMP
         B        0,R6              NORMAL RETURN
SNAME2   LI,R3    C' '
         STB,R3   *R2,R4            STORE BLANK OVER OLD CHAR
         B        SNAME1
SIER     EQU      %                 ERROR RETURN
         LB,R4    R10
         CI,R4    X'07'
         BE       READSI+1          NORMAL RETURN - TRUNCATED INPUT
         B        LEXIT
         PAGE
*D*      NAME:    SFIND
*D*      DESCRIPTION:
*D*               THIS ROUTINE SEARCHES THE ATERM TABLE
*D*               (CHECKING ONLY 1ST 4 CHARACTERS)
*D*               FOR A DISPLAY KEYWORD MATCH.
*D*               IF FOUND THE INDEX # IS CONTAINED IN R3 AND RETURN
*D*               IS MADE TO 1,R7.
*D*               IF NOT FOUND RETURN IS MADE TO 0,R7
         SPACE    1
SFIND    EQU      %
         LW,R12   BNAME             GET FIRST WORD
         LI,R3    1                 INDEX
         LI,R4    #PRTFLGS          NUMBER TO BE CHECKED
         LI,R13   ATERM+1
SFNXT    CW,R12   *R13,R3           CF
         BE       1,R7              FOUND
         AI,R13   1
         AI,R3    1
         BDR,R4   SFNXT
         B        0,R7              NOT FOUND
         PAGE
*D*      NAME:    SBINOUT
*D*      REGISTERS:
*D*               R7 - LINK REGISTER
*D*               ALL OTHER REGISTERS VOLATILE
*D*      INPUT:
*D*               R1 - # OF DIGITS TO BE APPENDED
*D*               R2 - BINARY NUMBER TO BE CONVERTED AND APPENDED
*D*                    TO BUFFER
*D*      INTERFACE:
*D*               SOUTA0 - TO FORMAT THE CONVERTED VALUE IN THE BUFFER
*D*      DESCRIPTION:
*D*               THIS ROUTINE CONVERTS A BINARY NUMBER TO EBCDIC AND
*D*               FORMATS THE RESULTING NUMBER IN THE OUTPUT BUFFER
*D*               VIA  A CALL TO SOUTA0 FROM WHICH A RETURN IS EFFECTED
*D*               THE ALGORITHM USED TO CONVERT THE BINARY # TO EBCDIC
*D*               DIVIDES THE NUMBER BY 10 CONVERTS THE REMAINDER
*D*               DIRECTLY AND STORES THE DIGIT BEGINNING IN THE
*D*               RIGHTMOST POSITION.
SBINOUT  STW,R1   VSIZE             SAVE # OF DIGITS
         LW,R15   BLANK             BLANK OUT THE NUMBER BUFFER
         STD,R15  NUMBER
         STW,R15  NUMBER+2
         LW,R15   R2                BINARY # TO WORKING REGISTERS
         LI,R2    11                GET SET UP FOR STORING
SBIN1    AI,R2    -1
         LI,R14   0
         DW,R14   =10               DIVIDE BY 10
         AI,R14   X'F0'             CONVERT REMAINDER TO EBCDIC
         STB,R14  NUMBER,R2
         AI,R15   0                 QUOTIENT ZERO
         BNEZ     SBIN1             NO
         LI,R2    11
         SW,R2    VSIZE
         LW,R12   VSIZE
         LI,R1    BA(NUMBER)-1
         AW,R1    R2                STARTING BYTE
         B        SOUTA0            GO FORMAT
         PAGE
*D*      NAME:    SOUTA
*D*      INPUT:
*D*               R1 - WORD ADDRESS OF STRING TO BE PLACED IN BUFFER
*D*                    IN TEXTC FORMAT
*D*      REGISTERS:
*D*               USES R0,R1,R2,R12
*D*               NO REGISTERS SAVED
*D*      DESCRIPTION:
*D*               THIS SUBROUTINE FORMATS IN THE BUFFER A TEXTC STRING
*D*               WHOSE ADDRESS IS CONTAINED IN R1 UPON ENTRY
*D*               RETURN IS VIA THE LINK REGISTER (R7).
         SPACE    1
SOUTA    SLS,R1   2                 R1=BYTE ADDRESS OF STRING
         LB,R12   0,R1              R12=LENGTH OF STRING
SOUTA0   AW,R12   R1                R12=BYTE ADDRESS OF LAST CHAR.
         LW,R2    VBUFCNT           R2=INDEX TO NEXT CHAR. OF BUFFER
SOUTA1   CI,R2    120               IF BUFFER IS FULL
         BGE      SOUTA2                 TRUNCATE INPUT
         AI,R1    1                 INCREMENT SOURCE POINTER
         CW,R1    R12
         BG       SOUTA2
         LB,R0    0,R1              GET CURRENT CHAR. FROM STRING
         STB,R0   BUFFER,R2         AND APPEND TO BUFFER.
         AI,R2    1
         B        SOUTA1
SOUTA2   STW,R2   VBUFCNT
         B        0,R7              NORMAL RETURN.
         PAGE
*D*      NAME:    SBLANK
*D*      DESCRIPTION:
*D*               THIS SUBROUTINE STORES BLANKS IN THE BUFFER
*D*               UPON ENTRY R1 CONTAINS THE NUMBER OF BLANKS TO BE
*D*               APPENDED. RETURN IS THROUGH THE LINK REGISTER (R7).
         SPACE    1
SBLANK   LI,R0    X'40'
         LW,R2    VBUFCNT           LOAD INDEX TO OUTPUT BUFFER.
SBLANK1  STB,R0   BUFFER,R2         APPEND A BLANK TO THE BUFFER.
         AI,R2    1                 INCREMENT INDEX TO OUTPUT BUFFER.
         BDR,R1   SBLANK1
         STW,R2   VBUFCNT           STORE INDEX TO OUTPUT BUFFER.
         B        0,R7
         PAGE
*D*      NAME:    SPAGE
*D*      DESCRIPTION:
*D*               IF DISPLAYS ARE BEING GENERATED THEN THIS SUBROUTINE
*D*               POSITIONS M:LO TO A NEW PAGE IF 17 LINES OR MORE
*D*               HAVE BEEN PRINTED.
*D*               IF <17 LINES THEN A LINE IS SKIPPED
*D*               RETURN IS VIA THE LINK REGISTER (R7).
         SPACE    1
SPAGE    MTW,0    PRNTF
         BEZ      0,R7
         LW,R1    BLANK
         STW,R1   BUFFER
         LI,R0    1
         STW,R0   VBUFCNT
         LW,R0    NLINE             # OF LINES PRINTED.
         CI,R0    17                HAVE 17 LINES BEEN PRINTED..
         BL       SPAGE1            NO NEW PAGE
         M:DEVICE M:LO,(PAGE)
         LI,R0    0
         STW,R0   NLINE
         B        0,R7              RETURN
SPAGE1   M:WRITE  M:LO,(BUF,BLANK),(SIZE,2)     TRY TO SKIP A LINE
         MTW,1    NLINE
         B        0,R7
         PAGE
*D*      NAME:    SEND
*D*      DESCRIPTION:
*D*               THIS SUBROUTINE OUTPUTS A LINE OF A DISPLAY
*D*               VIA M:LO IF THE BUFFER COUNT IS >=1.
*D*               THE # OF LINES PRINTED IS INCREMENTED,THE 1ST WORD
*D*               OF THE BUFFER IS BLANKED AND THE BUFFER BYTE COUNT
*D*               IS SET TO 1.  RETURN IS THROUGH THE LINK REGISTER (R7).
         SPACE    1
SEND     MTW,0    PRNTF
         BEZ      SENDN
         LI,R0    1
         CW,R0    VBUFCNT
         BGE      0,R7              SKIP WRITE IF ONE CHAR OR LESS
         MTW,1    NLINE             INCREMENT LINE COUNT
         M:WRITE  M:LO,(BUF,BUFFER),(SIZE,*VBUFCNT)
SENDN    LW,R0    BLANK
         STW,R0   BUFFER
         LI,R0    1
         STW,R0   VBUFCNT           STRING CAN BE CONSTRUCTED
         B        0,R7
         PAGE
*D*      NAME:    SPD
*D*      DESCRIPTION:
*D*               THIS SUBROUTINE INSERTS A DECIMAL POINT
*D*               IN FRONT OF THE LAST CHARACTER IN THE BUFFER
*D*               AND RETURNS VIA THE LINK  REGISTER (R7).
         SPACE    1
SPD      LW,R1    VBUFCNT           R1=INDEX  TO LAST CHAR AVAIL
         AI,R1    -1                R1=INDEX  TO LAST CHAR IN BUFFER.
         LB,R0    BUFFER,R1         GET LAST CHAR OF BUFFER.
         LI,R12   C'.'              REPLACE LAST CHAR WITH PERIOD
         STB,R12  BUFFER,R1
         AI,R1    1
         STB,R0   BUFFER,R1         PUT OLD LAST CHAR. AFTER PERIOD.
         AI,R1    1                 INCREMENT INDEX TO BUFFER
         STW,R1   VBUFCNT           AND SAVE.
         B        0,R7
         PAGE
*D*      NAME:    STIME
*D*      DESCRIPTION:
*D*               THIS SUBROUTINE COMPUTES THE CURRENT TIME IN SECONDS
*D*               SINCE SYSTEM STARTUP.
*D*               (C:CTUN-C:TINC+C:TIC)/500 WHERE THE CONTENTS
*D*               OF THE CELLS ARE FETCHED  FROM THE MONITOR AREA.
*D*               THE RESULT IS ROUNDED TO THE NEAREST
*D*               SECOND AND IS CONTAINED IN R1.
*D*               RETURN IS MADE VIA THE LINK REGISTER (R6).
         SPACE    1
STIME    EQU      %
         LW,R1    C:CTUN+G
         SW,R1    C:TINC+G
         AW,R1    C:TIC+G
         AI,R1    500/2             ANTICIPATE TRUNCATION FOR ROUND
         DW,R1    =500              CONVERT TO SECONDS
         B        0,R6
         PAGE
F:3      DSECT    1
F:3      M:DCB    (FILE,'SNAPSHOT'),(PASS),;
                  (KEYED),(DIRECT),(OUT),(SAVE),;
                  (KEYM,7),(BUF,SNAPSUM)
         USECT    CSPROC
         END      STATS

