         PCC      0                                                             
          SYSTEM   SIG9P                                                        
         SYSTEM   OPTIONS                                                       
         DO       #ERRORLOG                                                3.010
          DEF      A:LOG                                                        
         DEF      INITLOG                                                       
         DEF      HOURLOG                                                       
         DEF      LOGPURGE                                                      
         DEF      ERRSEND                                                       
         DEF      LOGXIT                                                        
         DEF      ERRXIT                                                        
OLAYFLAG EQU      'LOG'                                                         
         TITLE    '** LOG - ERROR LOGGING OVERLAY **'                           
         TITLE    '** LOG - PROCS AND STUFF **'                                 
*                                                                               
*                                                                               
STDLB    CNAME    7                                                             
TYPE     CNAME    2                                                             
PFILE    CNAME    1                                                             
OPENIT   CNAME    1                                                             
WRITE    CNAME    1                                                             
SETINDEX CNAME    1                                                             
WEOFF    CNAME    1                                                             
REWINDE  CNAME    1                                                             
READ     CNAME    1                                                             
CLOSEIT  CNAME    1                                                             
         PROC                                                                   
LF       LCI      7                 LOAD FPT INTO R8 - R14                      
         LM,R8    AF(1)                                                         
         DO1      NAME=1            IF AN IO CAL                                
         AW,R8    R5                ADD IN BIAS FOR DCB ADDR                    
         DO1      NAME=2            IF TYPE CAL                                 
         AW,R10   R5                ADD BIAS FOR MESSAGE                        
         CAL1,NAME R8               AND CAL                                     
         PEND                                                                   
*                                                                               
         SYSTEM   CPRMON                                                        
*                                                                               
         TITLE    'LOG - WRITE ERROR LOGS TO ER OP-LABEL'                       
*                                                                               
*                                                                               
* THIS MOVES ERROR LOG RECORDS FROM THE LOG STACK TO THE ER OP-LABEL            
*                                                                               
* IT IS ASSUMED THAT ER IS CONNECTED TO A BLOCKED FILE, RSIZE = 16 WO           
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
LOG      RES      0                                                             
         MTW,0    LOGFLAG           ERROR  LOGGING                              
         BEZ      LOGXIT              NOT ON                                    
         PUSH     R15                                                           
         LW,R1    LOGSTACK+1                                                    
         CI,R1    X'7FFF'           IS STACK EMPTY                              
         BAZ      LOG40             YES, EXIT                                   
*                                   NO                                          
LOG05    LI,R7    TEMPEND-TTTT      GET SPACE FOR FPT'S                         
         BAL,R8   GETTEMP           RETURN PTR IN R7                            
         B        LOG45             CANT GET SPACE                              
*                                                                               
         ENABLE                                                                 
         PUSH     R7                SAVE R7 FOR RELEASE                         
*                                                                               
         LI,R6    TEMPEND-TTTT-1    MOVE FPT'S TO TEMP SPACE                    
         LW,R0    TTTT,R6                                                       
         STW,R0   *R7,R6                                                        
         BDR,R6   %-2                                                           
*                                                                               
          LW,R5    R7                SAVE LENGTH                                
          STB,R6   R5                CLEAR LENGTH                               
*                                                                               
         LI,R1    STDLB3            ERR/ABN EXIT                                
         SETINDEX ERFPT0            SET INDEX TO ER OPLABEL                     
*                                                                               
         OPENIT   ERFPT1            OPEN ER OPLABEL                             
         LI,R1    LOG24             ERR/ABN EXIT                                
*                                                                               
         PFILE    ERFPT2            POSITION TO END OF FILE                     
         LI,R1    LOG21A            ERR/ABN EXIT                                
*                                                                               
         AWM,R5   NEWSTACK-TTTT,R5  FIX STACK POINTER IN TEMP SPACE             
*                                                                               
         LW,R4    R5                                                            
         SLS,R4   -1                MAKE IT A DW ADDR                           
*                                                                               
LOG07    PLW,R7   LOGSTACK          REVERSE STACK ENTRIES                       
         BCS,10   LOG10             DONE WHEN STACK EMPTY                       
         PSW,R7   NEWSTACK-TTTT,R4                                              
         BCR,10   LOG07             B IF PUSH OK                                
*                                                                               
         MTW,1    LOSTLOGS          COUNT LOST LOGS                             
         BAL,R8   RELTEMP           RELEASE SPACE                               
         B        LOG07             TRY NEXT LOG                                
*                                                                               
LOG10    PLW,R7   NEWSTACK-TTTT,R4  GET A LOG RECORD                            
         BCS,10   LOG20             BRANCH IF STACK EMPTY                       
*                                                                               
         LI,R6    X'1FFFF'          MASK                                        
         AND,R6   R7                MASK OUT ADDR                               
*                                                                               
         WRITE    ERFPT3            WRITE OUT RECORD                            
         MTW,1    GOODLOGS                                                      
*                                   COUNT GOOD LOGS                             
         BAL,R8   RELTEMP           RELEASE LOG RECORD SPACE                    
*                                                                               
         B        LOG10             AND LOOP                                    
*                                                                               
LOG20    RES      0                                                             
LOG21    PLW,R7   NEWSTACK-TTTT,R4  ANY LOGS LEFT IN NEWSTACK                   
         BCS,10   LOG22             NO--DONE                                    
LOG21A   RES      0                                                             
         PSW,R7   LOGSTACK          YES--REPLACE IN LOGSTACK                    
         BCR,10   LOG21             PUSH OK--BRANCH                             
*                                                                               
         MTW,1    LOSTLOGS          ELSE, COUNT LOST LOGS                       
         BAL,R8   RELTEMP           RELEASE SPACE                               
         B        LOG21             TRY NEXT LOG                                
*                                                                               
*                                                                               
LOG22    RES      0                                                             
         LI,R1    LOG24             ERR/ABN ADDR                                
         WEOFF    ERFPT4            WEOF LOG                                    
         REWINDE  ERFPT5            AND REWIND IT                               
*                                                                               
LOG24    RES      0                                                             
         LI,R1    STDLB3            ERR/ABN ADDRESS                             
         CLOSEIT  ERFPT6            CLOSE FILE                                  
         PAGE                                                                   
LOG30    RES      0                                                             
         LI,R2    'ER'+X'F0000'     SEARCH FOR ER OP-LABEL                      
         LH,R3    OPLBS1            GET LENGTH                                  
OPLBLOOP CH,R2    OPLBS1,R3                                                     
         BE       GOTOPLB                                                       
         BDR,R3   OPLBLOOP                                                      
         CRASH    'IN LOG'                                                      
***********************                                                         
GOTOPLB  LB,R4    OPLBS3,R3         GET ASSIGNMENT                              
         CI,R4    BIT24             IS IT A DEVICE OR FILE                      
         BAZ      STDLB3            DEVICE, DONT NEED TO FUDGE STDLB            
*                                   FILE, SWITCH AWAY AND BACK AGAIN            
         LW,R7    R5                MOVE TEMP SPACE PTR                         
         AND,R4   M7                MASK RFT INDEX                              
         LB,R3    RFT8,R4           GET MASTER DIRECTORY INDEX                  
*                                                                               
         LH,R3    *K:MDNAME,R3      GET AREA NAME                               
         LD,R4    RFT1,R4           GET FILENAME                                
         LCI      3                                                             
         STM,R3   0,R7              STORE PTR, AREA, AND NAME IN TEMP           
*                                                                               
         STDLB    STDLB0            SET ER OP-LABEL TO ZERO                     
STDLB1   STDLB    STDLB2            AND SWITCH IT BACK                          
STDLB3   RES      0                                                             
*                                                                               
         PULL     R7                GET CONTROL WORD FOR RELEASE                
         BAL,R8   RELTEMP           RELEASE TEMP SPACE                          
LOG40    RES      0                                                             
         LI,R3    X'40000'                                                      
         LI,R2    0                                                             
         STS,R2   K:CTST            CLEAR LOG BIT IN K:CTST                     
         PULL     R15               GET LINK                                    
LOGXIT   B        *R15                                                          
*                                                                               
*                                                                               
*                                                                               
LOG45    RES      0                 CANT GET LOGGING SPACE                      
         PLW,R7   LOGSTACK          PULL A LOG ENTRY                            
         BCS,10   LOG40             BRANCH IF LOGSTACK EMPTY                    
         BAL,R8   RELTEMP           DITCH LOG ENTRY                             
         MTW,1    LOSTLOGS          AND COUNT IT                                
         B        LOG05             AND TRY AGAIN                               
*                                                                               
*                                                                               
*                                                                               
         PAGE                                                                   
*                                                                               
* ERROR/ABNORMAL PROCESSING                                                     
*                                                                               
ABNER    RES      0                                                             
         LB,R10   R10               GET ABNER CODE                              
         CI,R10   3                 IS IT A NULL ASSIGNMENT                     
         BE       *R1               YES, NO MESSAGE                             
*                                   NO                                          
         CI,R10   X'1C'             IS IT A FILE FULL                           
         BNE      ABNER10           NO                                          
*                                   YES                                         
         TYPE     ABNIOFPT          TYPE FULL MESSAGE                           
         B        *R1               AND EXIT                                    
********                                                                        
ABNER10  RES      0                                                             
         LW,R11   ERDCB-TTTT,R5     GET DCB WORD 0                              
         CW,R11   XBIT10            IS IT OPEN                                  
         BAZ      ABNER20           NO                                          
*                                   YES                                         
         TYPE     ERRIOFPT          TYPE ERROR MESSAGE                          
         B        *R1               AND EXIT                                    
********                                                                        
ABNER20  RES      0                                                             
         TYPE     BADFPT            UNABLE TO OPEN DCB                          
         B        *R1               AND EXIT                                    
*                                                                               
* FPT SYMBOLIC VALUES                                                           
*                                                                               
FPT      COM,8,24 AF(1),AF(2)                                                   
*                                                                               
BIN      EQU      X'20000'                                                      
OPLBL    EQU      3                                                             
*                                                                               
         TITLE    '** LOG - FPTS AND THEIR PARAMATERS **'                       
*                                                                               
*                                                                               
* SET INDEX FPT                                                                 
*                                                                               
ERFPT0   GEN,8,1,23 X'08',1,ERDCB-TTTT                                          
         DATA     P2                                                            
         DATA     '  ER'                                                        
*                                                                               
* OPEN FPT                                                                      
*                                                                               
ERFPT1   FPT      X'14',ERDCB-TTTT                                              
         DATA     P1+P2                                                         
         DATA     ABNER,ABNER       ERR/ABN                                     
*                                                                               
* POSITION FILE FPT                                                             
*                                                                               
ERFPT2   FPT      X'1C',ERDCB-TTTT                                              
         DATA     8+P2                                                          
         DATA     ABNER             ABNORMAL                                    
*                                                                               
* WRITE FILE FPT                                                                
*                                                                               
ERFPT3   FPT      X'11',ERDCB-TTTT                                              
         DATA     P1+P2+P3+P4+F3                                                
         DATA     ABNER,ABNER       ERR/ABN                                     
         GEN,1,31 1,R6              BUFFER ADDRESS  (*R6)                       
         DATA     LOGSIZE*4         BYTE COUNT                                  
*                                                                               
* WRITE EOF FPT                                                                 
*                                                                               
ERFPT4   FPT      X'02',ERDCB-TTTT+BIT8                                         
         DATA     F3                                                            
*                                                                               
* REWIND FPT                                                                    
*                                                                               
ERFPT5   FPT      X'01',ERDCB-TTTT+BIT8                                         
         DATA     F3                                                            
*                                                                               
* CLOSE FPT                                                                     
*                                                                               
ERFPT6   FPT      X'15',ERDCB-TTTT                                              
         DATA     P1+P2                                                         
         DATA     ABNER,ABNER       ERR/ABNORMAL                                
         PAGE                                                                   
*                                                                               
STDLB0   FPT      X'62',BIT8+'ER'   ZERO ER OP-LABEL                            
         DATA     P1+P2+F2+F3+F7                                                
         DATA     STDLB1                                                        
         DATA     0                                                             
*                                                                               
STDLB2   FPT      X'62',BIT8+'ER'   SET IT BACK                                 
         DATA     P1+P4+F2+F3+F7                                                
         DATA     STDLB3                                                        
         GEN,1,31 1,R7              INDIRECT R7                                 
*                                                                               
         PAGE                                                                   
*                                                                               
* ABNORMAL IO MESSAGE FPT                                                       
*                                                                               
ABNIOFPT DATA     2**24                                                         
         DATA     P1+F3                                                         
         DATA     ABNIOMSG-TTTT                                                 
*                                                                               
*                                                                               
*                                                                               
* ERRORED IO MESSAGE FPT                                                        
*                                                                               
ERRIOFPT DATA     2**24                                                         
         DATA     P1+F3                                                         
         DATA     ERRIOMSG-TTTT                                                 
*                                                                               
*                                                                               
*                                                                               
* BAD OPEN MESSAGE FPT                                                          
*                                                                               
BADFPT   DATA     2**24                                                         
         DATA     P1+F3                                                         
         DATA     BADMSG-TTTT                                                   
         PAGE                                                                   
         BOUND    8                                                             
TTTT     RES      1                                                             
*                                                                               
*                                                                               
BADMSG   TEXTC    '!!CANT OPEN ER'                                              
ERRIOMSG TEXTC    '!!ER ERROR'                                                  
ABNIOMSG TEXTC    '!!ER FULL'                                                   
*                                                                               
* DCB FOR ER OP-LABEL                                                           
*                                                                               
ERDCB    FPT      5,BIN+OPLBL                                                   
         FPT      10,12                                                         
         DATA     0,0,0                                                         
*                                                                               
*                                                                               
NEWSTACK STACKDW,1,1 TEMPSTK-TTTT,STACKSIZ+1                                    
TEMPSTK  RES      STACKSIZ+1                                                    
*                                                                               
*                                                                               
TEMPEND  RES      0                                                             
         ORG      TEMPSTK           OVERLAP TEMPSTACK WITH CODE                 
A:LOG    EQU      LOG                                                           
         TITLE    '** LOG -  WRITE SYSTEM LOGS **'                              
         SPACE    2                                                             
************************************************************                    
*                                                                               
*  HERE FROM DT KEY-IN IF #ERRORLOG NOT = 0                                     
***********************************************************                     
INITLOG  RES      0                                                             
         MTW,0    LOGFLAG           ERROR LOGGING                               
         BEZ      LOGXIT              NOT ON                                    
*******************************************************                         
*        STARTUP LOG                                                            
********************************************************                        
         LI,R12   0                                                             
*                                                                               
         LW,R0    K:JCP1                                                        
         CI,R0    X'10'             IS IT AN INIT DT KEYIN                      
         BAZ      ILOGTIME          NO, SKIP START UP RECORD                    
*                                   YES, DO START UP                            
         BAL,R6   GETLBUF                                                       
         B        LOGXIT                                                        
*                                                                               
*                                                                               
         LI,R8    X'18'                                                         
         STB,R8   *R7               TYPE = X'18'                                
*                                                                               
         LI,R6    LOGCOUNT          FILL IN COUNT                               
         LI,R8    4                                                             
         STB,R8   *R7,R6                                                        
*                                                                               
         LI,R6    LOGSTUP           FILL IN STARTUP TYPE                        
         LI,R8    3                                                             
         STB,R8   *R7,R6                                                        
*                                                                               
         LI,R6    LOGYEAR           FILL IN YEAR-1900                           
         LW,R8    K:DATE1                                                       
         STH,R8   *R7,R6                                                        
*                                                                               
         LI,R6    LOGDAY            FILL IN JULIAN DAY                          
         LW,R8    K:DATE2                                                       
         STH,R8   *R7,R6                                                        
         BAL,R0   PUSHLOG                                                       
*                                                                               
* TIME STAMP AND I/O COUNTS                                                     
*                                                                               
ILOGTIME RES      0                                                             
         PUSH     R15                                                           
         BAL,R15  HOURLOG                                                       
         PULL     R15                                                           
*                                                                               
*                                                                               
**************************************************************                  
*        CONFIGURATION LOG                                                      
*****************************************************************               
ILOGCF   RES      0                                                             
*                                                                               
* IS THE ERROR LOG FILE EMPTY                                                   
*                                                                               
         LH,R1    OPLBS1            GET OPLABEL COUNT                           
         LH,R0    OPLBS1,R1                                                     
         AND,R0   M16                                                           
         CI,R0    'ER'                                                          
         BE       FOUNDER                                                       
         BDR,R1   %-4               LOOP TO FIND OPLABEL                        
         B        LOGXIT            CANT FIND                                   
*                                                                               
FOUNDER  LB,R2    OPLBS2,R1         GET PTR                                     
         CI,R2    X'80'             IS IT A FILE                                
         BAZ      DOCONFIG          NO, CANT TELL IF EMPTY                      
*                                   YES, IS FILE EMPTY                          
         AND,R2   M7                MASK OFF RFT INDEX                          
         LW,R0    RFT6,R2           GET FILE SIZE                               
         BNEZ     LOGXIT            NO, DONE                                    
*                                   YES, MUST PUT IN CONFIGURATION              
DOCONFIG RES      0                                                             
         AI,R12   1                                                             
         LH,R1    DCT1              R1=# OF DEVICES                             
ILOGCF01 RES      0                                                             
*                                                                               
         BAL,R6   GETLBUF                                                       
         B        LOGXIT                                                        
*                                                                               
         LI,R8    X'21'                                                         
         STB,R8   *R7               TYPE = X'21'                                
*                                                                               
         LI,R2    -5                MAX = 5 DEVICES PER LOG                     
         LI,R6    LOGCFMOD          MODEL #                                     
         LI,R5    LOGINDEX          DCT #                                       
         LI,R4    LOGDCT1A          DCT1A                                       
         LI,R3    LOGDCT1P          DCT1P                                       
*                                                                               
ILOGCF02 RES      0                                                             
         LH,R8    DCTMODX,R1        FILL IN ONE PAIR OF WORDS                   
         STH,R8   *R7,R6              FOR EACH DEVICE                           
         STB,R1   *R7,R5                                                        
         LH,R8    DCT1A,R1                                                      
         STH,R8   *R7,R4                                                        
         LH,R8    DCT1P,R1                                                      
         STH,R8   *R7,R3                                                        
         BDR,R1   %+2                                                           
         B        ILOGCF03          ALL DEVICES DONE                            
*                                                                               
         AI,R6    4                 ELSE, UPDATE POINTERS                       
         AI,R5    8                                                             
         AI,R4    4                                                             
         AI,R3    4                                                             
         BIR,R2   ILOGCF02          DO 5 DEVICES PER LOG                        
*                                                                               
         LI,R6    LOGCOUNT          FILL IN COUNT FOR 5 DEVICES                 
         LI,R8    12                                                            
         STB,R8   *R7,R6                                                        
*                                                                               
         BAL,R0   PUSHLOG                                                       
*                                                                               
         B        ILOGCF01          DO ANOTHER LOG                              
*                                                                               
ILOGCF03 AI,R2    6                 R2=# DEVICES DONE THIS LOG                  
         SAS,R2   1                    * 2                                      
         AI,R2    2                    + 2                                      
         LI,R6    LOGCOUNT             = COUNT FOR THIS LOG                     
         STB,R2   *R7,R6                                                        
*                                                                               
         BAL,R0   PUSHLOG                                                       
*                                                                               
         BAL,R0   550PCL                                                        
**************************************************************                  
*        SYSTEM IDENTIFICATION                                                  
*****************************************************************               
ILOGSI   RES      0                                                             
         AI,R12   1                                                             
*                                                                               
         BAL,R6   GETLBUF                                                       
         B        LOGXIT                                                        
*                                                                               
         LI,R8    X'22'                                                         
         STB,R8   *R7               TYPE = X'22'                                
*                                                                               
         LI,R6    LOGCOUNT          FILL IN COUNT                               
         LI,R8    5                                                             
         STB,R8   *R7,R6                                                        
*                                                                               
         LW,R8    K:UNAVBG          FILL IN CORE SIZE                           
         AI,R8    8191                ROUND UP                                  
         SAS,R8   -13               # 8K BLOCKS                                 
         LI,R6    LOGSI8K                                                       
         STB,R8   *R7,R6                                                        
*                                                                               
         LI,R6    LOGSITM           FILL IN RELATIVE                            
         LI,R8    1                   TIME RESOLUTION                           
         STB,R8   *R7,R6                                                        
*                                                                               
         LI,R6    LOGSIFLG          FILL IN SYSTEM FLAGS                        
         LW,R8    X'2B'                                                         
         STW,R8   *R7,R6                                                        
*                                                                               
         LI,R6    LOGSISI           FILL IN SITE ID                             
         LD,R8    BLANKS                                                        
         LI,R0    SITE                                                          
         BEZ      %+3                                                           
         LCI      2                                                             
         LM,R8    SITE                                                          
         STW,R8   *R7,R6                                                        
         AI,R6    1                                                             
         STW,R9   *R7,R6                                                        
*                                                                               
         BAL,R0   PUSHLOG                                                       
*                                                                               
******************************************************                          
*        INIT TEXT LOG                                                          
*********************************************************                       
ILOGTXT  RES      0                                                             
         AI,R12   1                                                             
         LI,R9    SITE              ANY TEXT FROM SYSGEN                        
         BEZ      LOGXIT              EXIT                                      
*                                                                               
         CAL1,7   ILOGFPT             ERRSEND LOG                               
         B        LOGXIT                                                        
         PAGE                                                                   
*                                                                               
****************************************************************                
*                                                                               
ILOGFPT  GEN,8,1,23  X'66',1,0      ERRSEND CAL                                 
         DATA     P1+P3+P4                                                      
         DATA     LOGXIT                                                        
         GEN,1,31 1,R9              *R9                                         
         DATA     56                                                            
         TITLE    '** LOG - HOURLY LOGGING ROUTINES **'                         
*                                                                               
* HOURLY LOGGING ROUTINES                                                       
*                                                                               
* R15    LINK                                                                   
*                                                                               
HOURLOG  RES      0                                                             
         LI,R2    0                                                             
         LI,R3    BIT25                                                         
         STS,R2   K:CTST            RESET HOURLOG FLAG                          
*                                                                               
         MTW,0    LOGFLAG                                                       
         BEZ      LOGXIT            EXIT IF NO LOGGING                          
*                                                                               
         BAL,R6   GETLBUF           GET A LOG BUFFER                            
         B        LOGXIT            CANT GET, QUIT                              
*                                                                               
         LI,R2    X'23'                                                         
         STB,R2   *R7               TYPE = X'23'                                
*                                                                               
         LI,R3    LOGCOUNT                                                      
         LI,R2    3                                                             
         STB,R2   *R7,R3            LOG WORD COUNT                              
*                                                                               
         LI,R3    LOGYEAR                                                       
         LW,R2    K:DATE1                                                       
         STH,R2   *R7,R3            YEAR                                        
*                                                                               
         LI,R3    LOGDAY                                                        
         LW,R2    K:DATE2                                                       
         STH,R2   *R7,R3            JULIAN DAY                                  
*                                                                               
         BAL,R0   PUSHLOG           AND STACK LOG ENTRY                         
*                                                                               
         LI,R1    1                 DCT INDEX                                   
LOGLOOP  RES      0                                                             
         BAL,R6   GETLBUF           GET A LOG BUFFER                            
         B        LOGXIT            CANT GET, QUIT                              
*                                                                               
         LI,R8    X'28'                                                         
         STB,R8   *R7               TYPE = X'28'                                
*                                                                               
         LI,R2    -5                MAXIMUM NUMBER OF DEVICES/LOG               
         LI,R6    LOGIOSIO          I/O COUNT POSITION                          
         LI,R5    LOGINDEX          DCT INDEX POSITION                          
         LI,R4    LOGADDR           I/O ADDRESS POSITION                        
*                                                                               
         LI,R3    LOGINDX1          DCT INDEX OF FIRST DEVICE IN LOG            
         STB,R1   *R7,R3                                                        
*                                                                               
LOGDCTS  RES      0                                                             
         LH,R8    DCT1,R1                                                       
         STH,R8   *R7,R4            I/O ADDRESS                                 
*                                                                               
         STB,R1   *R7,R5            DCT INDEX                                   
*                                                                               
         LW,R8    DCT#IO,R1                                                     
         STW,R8   *R7,R6            SIO COUNT                                   
*                                                                               
         AI,R6    2                                                             
         AI,R5    8                                                             
         AI,R4    4                                                             
*                                                                               
         AI,R1    1                 DCT INDEX                                   
         CH,R1    DCT1              DONE YET                                    
         BG       DONECNTS          YES                                         
*                                   NO                                          
         BIR,R2   LOGDCTS           LOOP FOR 5  ENTRIES                         
*                                                                               
         LI,R6    LOGCOUNT                                                      
         LI,R8    12                                                            
         STB,R8   *R7,R6            LOG WORD COUNT                              
*                                                                               
         BAL,R0   PUSHLOG           AND STACK LOG ENTRY                         
*                                                                               
         B        LOGLOOP           LOOP FOR ALL DEVICES                        
********                                                                        
DONECNTS RES      0                                                             
         AI,R2    6                                                             
         SLS,R2   1                 # OF WORDS OF DATA                          
         AI,R2    2                 PLUS 2 OVERHEAD                             
         LI,R6    LOGCOUNT                                                      
         STB,R2   *R7,R6            LOG WORD COUNT                              
*                                                                               
         BAL,R0   PUSHLOG           STACK LOG BUFFER                            
*                                                                               
         B        LOGXIT                                                        
         TITLE    '** LOG - ERROR LOG PURGING **'                               
*                                                                               
* PURGE ERROR LOG                                                               
*                                                                               
LOGPURGE RES      0                                                             
         PUSH     R15               SAVE LINK                                   
*                                                                               
         LI,R7    TEMPEND-TTTT      GET TEMP SPACE                              
         BAL,R8   GETTEMP                                                       
         B        LOGPEXIT                                                      
*                                                                               
         ENABLE                                                                 
         PUSH     R7                SAVE TEMP SPACE PTR                         
*                                                                               
         LI,R6    TEMPEND-TTTT-1    MOVE IN FPTS                                
         LW,R0    TTTT,R6                                                       
         STW,R0   *R7,R6                                                        
         BDR,R6   %-2                                                           
*                                                                               
         LI,R5    X'1FFFF'                                                      
         AND,R5   R7                JUST ADDRESS TO TEMP SPACE                  
*                                                                               
         LI,R1    LOGPERR           ERROR ADDRESS                               
*                                                                               
         SETINDEX ERFPT0            SET TO ER STDLB                             
         OPENIT   ERFPT1            OPEN ER                                     
         LI,R1    LOGPCLOS          ERROR ADDRESS                               
         REWINDE  ERFPT5            REWIND ER                                   
         WEOFF    ERFPT4            EOF IT                                      
         REWINDE  ERFPT5            REWIND AGAIN IN CASE OF MAGTAPE             
LOGPLOOP PLW,R7   LOGSTACK          EMPTY LOG STACK                             
         BCS,10   LOGPEMTY          DONE                                        
         BAL,R8   RELTEMP           RELEASE THE TEMPSPACE                       
         B        LOGPLOOP          AND GET NEXT ENTRY                          
LOGPEMTY RES      0                 LOG STACK NOW EMPTY                         
*                                                                               
         LH,R1    DCT1              GET # OF DCT ENTRIES                        
         LI,R0    0                                                             
         STW,R0   DCT#IO,R1         CLEAR I/O COUNTS                            
         STW,R0   DCT#ERR,R1        CLEAR ERROR COUNTS                          
         BDR,R1   %-2               LOOP THRU ALL DEVICES                       
         STW,R0   GOODLOGS          CLEAR GOOD LOG COUNT                        
         STW,R0   LOSTLOGS          AND BAD LOG COUNT                           
         LW,R0    K:UTIME           GET CURRENT TIME SINCE BOOT                 
         STW,R0   LOGSTART          SAVE AS LAST PURGE TIME                     
*                                                                               
         PUSH     R5                                                            
         BAL,R15  INITLOG           SET UP INIT LOGS                            
         PULL     R5                                                            
*                                                                               
LOGPCLOS RES      0                                                             
         LI,R1    LOGPERR           ERROR ADDRESS                               
         CLOSEIT  ERFPT6            CLOSE SE                                    
LOGPERR  RES      0                                                             
         PULL     R7                                                            
         BAL,R8   RELTEMP           RELEASE SPACE                               
LOGPEXIT RES      0                                                             
         PULL     R15                                                           
         B        LOGXIT                                                        
         TITLE    '** LOG - GET A LOG BUFFER **'                                
*                                                                               
* LOG BUFFER GETTER                                                             
*                                                                               
* R6     LINK                                                                   
* EXIT+1 ERROR, CANT GET, LOSTLOGS BUMPED                                       
* EXIT+2 OK, BUFFER PTR IN R7, BUFFER CLEARED                                   
*                                                                               
GETLBUF  RES      0                                                             
         LI,R7    LOGSIZE                                                       
         BAL,R8   GETTEMP                                                       
         B        NOLBUF            CANT GET                                    
*                                   GOT OK                                      
         ENABLE                                                                 
         LI,R8    15                                                            
         LI,R9    0                                                             
         STW,R9   *R8,R7                                                        
         AI,R8    -1                                                            
         BGEZ     %-2               CLEAR BUFFER                                
*                                                                               
         B        1,R6              EXIT                                        
********                                                                        
NOLBUF   RES      0                                                             
         ENABLE                                                                 
         MTW,1    LOSTLOGS                                                      
         B        0,R6                                                          
         TITLE    '** LOG - ERRSEND CAL **'                                     
         SPACE    2                                                             
**********************************************************                      
*                                                                               
*        E R R S E N D     C A L                                                
*                                                                               
*                 ENTER W/ R3 = FPT ADDRESS                                     
*                                                                               
************************************************************                    
ERRSEND  RES      0                                                             
*                                                                               
         MTW,0    LOGFLAG                                                       
         BEZ      ERRS03            IF ELOG OFF, PRETEND IT WORKED              
*                                                                               
         LI,R15   3                                                             
         BAL,R5   GETPSII           IF NO MESSAGE BUFFER                        
         B        ERRSBAD             -- ERROR                                  
*                                                                               
         LW,R2    R14               R2=MESSAGE BUFFER                           
*                                                                               
         LI,R15   4                                                             
         BAL,R5   GETPSI            IF NO BYTE COUNT                            
         B        ERRSBAD            -- ERROR                                   
         CI,R15   0                 IF COUNT = 0                                
         BE       ERRSBAD            -- ERROR                                   
*                                                                               
*  EVERYTHING OKAY---GENERATE LOG                                               
         BAL,R6   GETLBUF                                                       
         B        ERRXIT                                                        
*                                                                               
         LI,R8    X'27'                                                         
         STB,R8   *R7               TYPE = X'27'                                
*                                                                               
         LI,R6    LOGCOUNT          FILL IN COUNT                               
         LW,R8    R15               R8=BYTE COUNT, MUST BE                      
         CI,R8    55                  <=56                                      
         BLE      ERRS01                                                        
         LI,R8    55                                                            
ERRS01   LW,R5    R8                                                            
         AI,R5    3                                                             
         SAS,R5   -2                R5=# OF TEXT WORDS, ROUNDED UP              
         AI,R5    2                   =# WORDS IN LOG                           
         STB,R5   *R7,R6                                                        
*                                                                               
         LI,R15   6                                                             
         BAL,R5   GETPSI            IF NO BTD                                   
         LI,R15   0                   SET = 0                                   
         LW,R5    R15                 ELSE, USE VALUE                           
         AND,R5   M2                  BETWEEN 0-3                               
*                                                                               
         LI,R6    LOGOPMSG          FILL IN TEXT                                
         STB,R8   *R7,R6            PUT IN BYTE COUNT                           
         AI,R6    1                                                             
ERRS02A  LB,R4    *R2,R5              FOR LOG                                   
         STB,R4   *R7,R6                                                        
         AI,R5    1                                                             
         AI,R6    1                                                             
         BDR,R8   ERRS02A                                                       
         BAL,R0   PUSHLOG                                                       
ERRS03   RES      0                                                             
         LI,R15   X'01'             PLACE TYC IN R15                            
         B        ERRXIT            TAKE CARE OF TYC AND EXITS                  
*                                                                               
*                                                                               
ERRSBAD  RES      0                 INCORRECT FPT                               
         LI,R15   X'4A'             SET TYC                                     
         B        ERRXIT                                                        
*                                                                               
*                                                                               
ERRXIT   B        TMX1                                                          
         TITLE    '** LOG - 550 PROCESSOR CONFIGUATION LOGGING **'              
*                                                                               
* 550 PROCESSOR CONFIGURATION LOGGING                                           
*                                                                               
* LINK   R0                                                                     
* EVERYTHING CLOBBERED                                                          
*                                                                               
550PCL   RES      0                                                             
         DO       #550*#ERRORLOG                                                
         MTW,0    LOGFLAG                                                       
         BEZ      *R0                                                           
*                                                                               
         PUSH     R0                SAVE LINK                                   
         LB,R1    CNFGTYPE          GET NUMBER OF UNITS                         
550PCL10 LB,R2    CNFGADDR,R1       GET ADDR OF UNIT                            
         LI,R3    X'38'             MASK FOR CLUSTER                            
         BAL,R6   GETLBUF                                                       
         B        NOBUFFER          CANT                                        
*                                   OK                                          
         ENABLE                                                                 
         LI,R8    X'41'                                                         
         STB,R8   *R7               TYPE = X'41'                                
*                                                                               
         LI,R6    2                 FIRST ENTRY                                 
550PCL20 LB,R4    CNFGADDR,R1       GET ADDR                                    
         CS,R2    R4                IS IT THE SAME CLUSTER                      
         BNE      550PCL30          NO, LOG THIS CLUSTER                        
*                                   YES, ADD TO THIS LOG                        
         SLS,R4   8                 POSITION ADDR                               
         POLP,R5  0,R4              GET STATUS TO R5                            
         STCF     R5                SAVE CONDITIONS                             
         STW,R5   CNFGSTAT,R1       SAVE STATUS                                 
         SLS,R4   -8                PUT ADDR BACK                               
         STH,R4   R5                PUT ADDR IN AORD                            
*                                                                               
         LB,R4    CNFGTYPE,R1                                                   
         STB,R4   R5                PUT IN TYPE ALSO                            
*                                                                               
         STW,R5   *R7,R6            PUT IN LOG                                  
         AI,R6    1                 BUMP PTR                                    
         BDR,R1   550PCL20          AND LOOP                                    
*                                                                               
550PCL30 RES      0                                                             
         AI,R1    1                 ADJUST R1 UP ONE                            
         LI,R5    LOGCOUNT                                                      
         STB,R6   *R7,R5            WORD COUNT                                  
         BAL,R0   PUSHLOG           STACK LOG ENTRY                             
         BDR,R1   550PCL10          LOOP                                        
*                                                                               
NOBUFFER RES      0                                                             
         PULL     R0                RESTORE LINK                                
         FIN      550 AND ERROR LOGGING                                         
         B        *R0               AND RETURN                                  
*                                                                               
*                                                                               
         FIN                        #ERRORLOG                            804.010
*                                                                               
         OLAYEND                                                                
         END                                                                    
