         TITLE    '          A N A L Y Z E     C O N T R O L    R O O T'        
         SPACE    2                                                             
************************************************************************        
*                                                                      *        
#SYSTEM  SET      'CP-R'      SET SYSTEM ASSEMBLING FOR (CP-R = RBM)  *         
*                                                                      *        
************************************************************************        
*                                                                               
*                                                                               
         SYSTEM   SIG7                                                          
*                                                                               
*                                                                               
        DO       (#SYSTEM='CP-V')                                               
         SYSTEM   BPM                                                           
        ELSE     (#SYSTEM='CP-R')                                               
         SYSTEM   CPR                                                           
*                                                                               
*                                                                               
K:PAGE   EQU      X'174'            LOC OF CELL WITH LINES PER PAGE             
K:JCP1   EQU      X'150'            LOC OF CELL WITH ATTEND FLAG                
        FIN                                                                     
         PAGE                                                                   
         SPACE    2                                                             
         DEF      ANALYZE           NAME OF PROGRAM AND THIS SEGMENT            
         DEF      CCREAD                                                        
         DEF      NOTFIRST                                                      
         DEF      REWUNLD                                                       
         DEF      CRSHBUF                                                       
         DEF      CRSHRROS                                                      
         DEF      EOT                                                           
         DEF      FCOMMENT                                                      
         DEF      LIMITV                                                        
         DEF      LIMPTR                                                        
         DEF      MAPPAGE                                                       
         DEF      MTDEVADD                                                      
         DEF      MTDEVADL                                                      
         DEF      NOMAP,NOTRACE,NOTABLE,NODUMP                                  
         DEF      NUMDUMPS                                                      
         DEF      PAGE                                                          
         DEF      #LINES            NUMBER OF LINES PER PRINTER PAGE            
         DEF      FGDBKGSW,ATTENDSW                                             
         DEF      INDCB,ERRDCB      INPUT, ERROR CORRECTION DCB ADDRESS         
         DEF      CPRAREA,MAPAREA,DATAAREA                                      
         DEF      K:JCP1            ATTEND MODE FLAG FAKE FOR CP-V              
         DEF      K:PAGE            FAKE SYSTEM CELL WITH LINES PER PAGE        
         DEF      LL:LO             CORRESPONDENCE OF LL TO LO                  
         DEF      LL:EC             LL TO ERROR CORRECTION DEVICE               
         DEF      IN:EC             INPUT TO ERROR CORRECTION DEVICE            
         DEF      IN:LL             INPUT TO LL                                 
*                                                                               
         DEF      LOGLINE           LOG A MESSAGE TO LL, LO                     
         DEF      LOGERR            ALT ENT TO LOGLINE                          
         PAGE                                                                   
         SPACE    2                                                             
         REF      READCC                                                        
         REF      ANALMAP                                                       
         REF      ANALYSIS                                                      
         REF      INITIATE                                                      
         REF      POSTPOSN                                                      
         REF      M:C,M:SI,M:LO,M:LL   PARAM INPUTS, LISTING OUTPUTS DCBS       
*                                                                               
        DO       (#SYSTEM='CP-V')                                               
         REF      M:UC              ONLINE TERMINAL                             
         REF      JIT               ON-LINE / BKG SWITCH FOR CP-V PGMS          
        ELSE     (#SYSTEM='CP-R')                                               
         REF      F:X1,F:X2,F:X3,F:X4    DCB'S FOR  DATA, SYSTEM, MAP,          
         REF      M:OC              TAPE INPUT FILES; ERROR CORR DEVICE         
        FIN                                                                     
         PAGE                                                                   
         SPACE    2                                                             
*                           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                                                                   
         SPACE    2                                                             
*                          UNIVERSAL LOCATION OF SYSTEM ID                      
*                                                                               
K:SYSTEM EQU      X'2B'                                                         
*                                                                               
*                                                                               
#CPR     SET      X'80'             CP-R ID IN SYSTEM ID CELL                   
*                                                                               
*                                                                               
*                                                                               
*                          SEGMENT NUMBER DEFINITIONS                           
*                                                                               
SEG1     SET      1                                                             
SEG2     SET      2                                                             
SEG3     SET      3                                                             
         PAGE                                                                   
*                                                                               
*                           PROCEDURE DEFINITIONS                               
*                                                                               
U:PCB    CNAME                      DEFINE U:PCB ACCORDING TO SYSTEM            
         PROC                                                                   
        DO       (#SYSTEM='CP-V')                                               
         B        %+2               HOP AROUND CELL FOR LOC OF STACK            
U:PCB    DATA     -1                ADDRESS OF PUSH/PULL STACK IN CP-V          
         STW,R0   U:PCB             SET ADDRESS AS GIVEN BY CP-V LOADER         
         DEF      U:PCB               ALLOW OTHERS TO GET TO IT                 
        ELSE     (#SYSTEM='CP-R')                                               
         REF      U:PCB             USE OLOADS STACK VIA ITS SYMBOL             
        FIN                                                                     
         PEND                                                                   
*                                                                               
         OPEN     Q,I                                                           
TXTS     CNAME    0                                                             
TXT      CNAME    0                                                             
TXTC     CNAME    1                                                             
         PROC                                                                   
Q        SET      S:UT(AF)                                                      
I        SET      S:NUMC(Q)                                                     
Q(I+1)   SET      ' '                                                           
Q(I+2)   SET      ' '                                                           
Q(I+3)   SET      ' '                                                           
         DO       NAME=0                                                        
LF       TEXT     S:PT(Q(1),Q(2),Q(3),Q(4))                                     
         LIST     0                                                             
         ORG      %-1                                                           
         TEXT     AF                                                            
         ELSE                                                                   
LF       DATA     (((I)**8+Q(1))**8+Q(2))**8+Q(3)                               
         LIST     0                                                             
         ORG      %-1                                                           
         TEXTC    AF                                                            
         FIN                                                                    
         LIST     1                                                             
         PEND                                                                   
*                                                                               
PUSH     CNAME    1,(#SYSTEM='CP-V')  PUSH REGISTERS INTO STACK                 
PULL     CNAME    0,(#SYSTEM='CP-V')  PULL REGISTERS FROM STACK                 
         PROC                                                                   
         DO       NUM(AF)=1         SAVE ONLY ONE REGISTER                      
LF(1)    GEN,1,7,4,20    NAME(2),X'8'+NAME(1),AF(1),U:PCB                       
         ELSE     NUM(AF)>1         SAVE MULTIPLE REGISTERS                     
LF(1)    LCI      AF(1)&X'F'                                                    
         GEN,1,7,4,20     NAME(2),X'A'+NAME(1),AF(2),U:PCB                      
         FIN                                                                    
         PEND                                                                   
         TITLE    'MAIN CONTROL FOR ANALYZE '                                   
         SPACE    4                                                             
ANALYZE  RES      0         START OF ANALYZE FOR CPR (RBM)  AND/OR  CP-V        
         U:PCB                      DEFINE STACK FOR SYSTEM                     
*                                                                               
        DO       (#SYSTEM='CP-V')                                               
*                                                                               
********  1    IF NOT IN CP-V BACKGROUND, THEN IN FOREGROUND                    
*                                                                               
         LW,R10   JIT               ARE WE IN BACKGROUND ?                      
         BGEZ     IFRBMEND            YES, SWITCHES ASSEMBLED FOR BKG           
*                                                                               
         LI,R0    1                 SET IN FOREGROUND                           
         LI,R1    M:SI              SET PARAM INPUT DCB                         
         LI,R2    M:UC              SET ERROR CORRECTION DCB                    
         LI,R3    1                 SET ATTEND MODE ON                          
         LCI      4                 STORE STATII IN 4 WORDS; FGDBKGSW,          
         STM,R0   FGDBKGSW          INDCB, ERRDCB, ATTENDSW                     
*                                                                               
*                                                                               
        ELSE     (#SYSTEM='CP-R')                                               
         PAGE                                                                   
*                                                                               
********..1   IF RUNNING IN BACKGROUND                                          
*                                                                               
         LC       X'4E'             ARE WE IN BACKGROUND ?                      
         BCS,4    IFBKGPGM            YES, DCB'S OK; TEST ATTEND                
*                                                                               
         LI,R0    1                 SET FOREGROUND PROGRAM SWITCH               
         LI,R1    M:SI              SET PARAM INPUT DCB                         
         LI,R2    M:C               SET ERROR CORRECTION DCB                    
         LI,R3    1                 SET ATTEND MODE ON                          
         LCI      4                 STORE STATII IN 4 WORDS; FGDBKGSW,          
         STM,R0   FGDBKGSW          INDCB, ERRDCB, ATTENDSW                     
         B        IFFGDEND                                                      
*                                                                               
IFBKGPGM RES      0         TEST IF BACKGROUND PROGRAM IS ATTENDED              
         LW,R0    K:JCP1            HAS THE INDICATOR BEEN SET ?                
         CI,R0    2                                                             
         BAZ      IFFGDEND            NO, LEAVE UNATTENDED                      
*                                                                               
         MTW,+1   ATTENDSW          SET ATTENDED                                
         PAGE                                                                   
         SPACE    2                                                             
IFFGDEND RES      0         TEST IF IN RBM OR CPR                               
*                                                                               
********..1   IF OPERATING SYSTEM IS NOT CP-R                                   
*                                                                               
         LB,R1    K:SYSTEM          DETERMINE IF RUNNING RBM                    
         CI,R1    #CPR              ARE WE IN CP-R ?                            
         BE       IFRBMEND            YES, KEEP CP-R NAMES                      
*                                                                               
         LW,R1    L(C'RBMM')        CHANGE DEFAULT FILE NAMES                   
         STW,R1   MAPAREA+2                                                     
         LW,R1    L(C'RBMF')                                                    
         STW,R1   CPRAREA+2                                                     
*                                                                               
*                                                                               
        FIN      (#SYSTEM='CP-R')                                               
         SPACE    3                                                             
*                                                                               
********..1   IFEND                                                             
*                                                                               
IFRBMEND RES      0                                                             
         PAGE                                                                   
*                                                                               
********..1   SET INDICATOR FOR FIRST TIME                                      
*                                                                               
         LI,R0    0                                                             
         STW,R0   NOTFIRST                                                      
         M:OPEN   M:LL              OPEN COMMAND LIST OUTPUT LOG                
         M:OPEN   M:LO              OPEN ANALYZE OUTPUT                         
*                                                                               
********..1   SET VFC FOR M:LO                                                  
*                                                                               
        DO       (#SYSTEM='CP-V')                                               
         M:DEVICE M:LO,(VFC)        SET VFC ON                                  
         M:DEVICE M:LO,(PAGE)       STEP TO A NEWPAGE TO                        
         M:DEVICE M:LO,(NLINES)     GET NUMBER OF LINES PER PAGE                
        ELSE     (#SYSTEM='CP-R')                                               
         M:VFC    M:LO,(VFC)                                                    
         LB,R8    K:PAGE            GET NUMBER OF LINES FOR CP-R/RBM            
        FIN                                                                     
*                                                                               
         STW,R8   #LINES            SAVE FOR REST OF ANALYZE                    
*                                                                               
********..1   SEGLOAD THE CONTROL CARD READ SEGMENT                             
*                                                                               
         LI,R15   SEG1              SET SEGMENT NUMBER, AND                     
         BAL,R14  LOADSEG           GO LOAD THAT SEGMENT                        
         PAGE                                                                   
*                                                                               
********..1   DO UNTIL BLOCK COMPLETED WITH NO NEW CONTROL CARDS READ           
*                                                                               
DOCCR    RES      0                                                             
*                                                                               
********..2     SET INDICATOR FOR NO CONTROL CARDS READ AND ONEDUMP             
*                                                                               
         LI,R0    0                                                             
         STW,R0   CCREAD                                                        
         STW,R0   NUMDUMPS                                                      
         MTW,1    NUMDUMPS                                                      
*                                                                               
********..2     PERFORM CONTROL CARD READ (SETS INDICATOR IF ANY ':'            
********..2     CARD READ. ALSO ADJUSTS ONEDUMP IF ALL ON TAPE.)                
*                                                                               
         BAL,R14  READCC                                                        
         B        CCREADER            REPORT ERROR                              
*                                                                               
********..2     IF FIRST TIME OR IF CONTROL CARD READ                           
*                                                                               
         MTW,0    CCREAD                                                        
         BNEZ     %+3                                                           
         MTW,0    NOTFIRST                                                      
         BNEZ     IFCCREND                                                      
*                                                                               
********..3       RESET INDICATORS FOR FIRST TIME                               
*                                                                               
         MTW,1    NOTFIRST                                                      
         PAGE                                                                   
*                                                                               
********..3       DO UNTIL DISPLAY COMPLETE (IF ALL OPTION FROM MAG TAPE        
********..3       HAS BEEN INVOKED THIS BLOCK MAY LOOP).                        
*                                                                               
DODSP    RES      0                                                             
*                                                                               
********..4         PERFORM INITIATE                                            
*                                                                               
         BAL,R14  INITIATE                                                      
         B        INITERR             REPORT ERROR                              
*                                                                               
********..4         IF NOT END OF TAPE                                          
*                                                                               
         MTW,0    EOT                                                           
         BNEZ     IFEOTELS                                                      
*                                                                               
********..5           SET MAPPAGE TO 0                                          
*                                                                               
         LI,R0    0                                                             
         STW,R0   MAPPAGE                                                       
         PAGE                                                                   
*                                                                               
********..5           IF THE USER WANTS THE MAP SORTED AND PRINTED              
*                                                                               
         MTW,0    NOMAP                                                         
         BNEZ     IFMAPEND                                                      
*                                                                               
********..6             SEGLOAD AND PERFORM MAPSORT; AND SO INDICATE.           
*                                                                               
         LI,R15   SEG2              SET SEGMENT NUMBER WE NEED, AND             
         BAL,R14  LOADSEG           GO LOAD IT                                  
         BAL,R14  ANALMAP                                                       
         B        MAPERR              REPORT ERROR                              
*                                                                               
********..5           ENDIF                                                     
         PAGE                                                                   
*                                                                               
IFMAPEND RES      0                                                             
*                                                                               
********..5           SEGLOAD AND PERFORM ANALYSIS                              
*                                                                               
         LI,R15   SEG3              SET SEGMENT NUMBER WE NEED, AND             
         BAL,R14  LOADSEG           GO LOAD IT                                  
         BAL,R14  ANALYSIS                                                      
         B        ANLZERR             REPORT ERROR                              
*                                                                               
         B        IFEOTEND                                                      
*                                                                               
********..4         ELSE IF EOT                                                 
*                                                                               
IFEOTELS RES      0                                                             
*                                                                               
********..5           SET TO EXIT BLOCK                                         
*                                                                               
         LI,R0    1                                                             
         STW,R0   NUMDUMPS                                                      
*                                                                               
********..4         ENDIF                                                       
         PAGE                                                                   
*                                                                               
IFEOTEND RES      0                                                             
*                                                                               
********..4         SEGLOAD INITIATE AND CC READ                                
*                                                                               
         LI,R15   SEG1              SET TO RELOAD SEGMENT 1                     
         BAL,R14  LOADSEG           AND LOAD IT                                 
*                                                                               
********..4         CLOSE FILES                                                 
*                                                                               
         M:CLOSE  F:X1                                                          
         M:CLOSE  F:X2                                                          
         M:CLOSE  F:X3                                                          
         M:CLOSE  F:X4                                                          
         PAGE                                                                   
*                                                                               
********..3       ENDDO                                                         
*                                                                               
         MTW,-1   NUMDUMPS                                                      
         BG       DODSP                                                         
*                                                                               
         BAL,R14  POSTPOSN          DO POST-PROCESS TAPE POSITIONING            
         NOP      0                    SHOULD BE NO ERRORS POSSIBLE             
*                                                                               
********..2     ENDIF                                                           
*                                                                               
IFCCREND RES      0                                                             
*                                                                               
********..1   DOEND                                                             
*                                                                               
         MTW,0    CCREAD                                                        
         BG       DOCCR                                                         
*                                                                               
********..1   TERMINATE NORMALLY                                                
*                                                                               
         M:EXIT                                                                 
         PAGE                                                                   
         SPACE    2                                                             
LOGLINE  RES      0         LOG STRING OUT OUTPUT DEVICES                       
*                 R2 =  ADDRESS OF STRING                                       
*                 R1 =  BYTE LENGTH OF STRING                                   
*                                                                               
         CAL1,1   IN:LL             WAS INPUT SAME AS LL DEVICE ?               
         CI,R8    1                 IF YES, LINE ALREADY ON LL                  
         BE       LOGLINE1            YES, DO NOT WRITE TO LL                   
*                                                                               
*                                                                               
*                                                                               
LOGERR   RES      0         ALTERNATE ENTRY; FORCE LINE ON LL                   
         M:WRITE  M:LL,(BUF,*R2),(SIZE,*R1),(WAIT)                              
*                                                                               
LOGLINE1 RES      0         TEST IF NEED TO LOG TO LO                           
         CAL1,1   LL:LO             ARE LL AND LO THE SAME DEVICE ?             
         CI,R8    1                 IF YES, ONLY WRITE LINE ONCE                
         BE       *R14                ON LO VIA LL; RETURN                      
*                                                                               
         M:WRITE  M:LO,(BUF,*R2),(SIZE,*R1),(WAIT)                              
         B        *R14              RETURN                                      
         PAGE                                                                   
         SPACE    1                                                             
        DO       (#SYSTEM='CP-V')                                               
         SPACE    2                                                             
LOADSEG  RES      0         LOAD REQUIRED SEGMENT                               
         LW,R1    R15               COPY SEGMENT NUMBER                         
         EXU      CPVSEGLD,R1       EXECUTE THE PROPER SEGLD CAL                
         STW,R15  SEGMENT#          SAVE SEGMENT NOW LOADED                     
         B        *R14              AND RETURN                                  
*                                                                               
*                                                                               
CPVSEGLD EQU      %-1       SEGMENT LOAD CALS                                   
SEGLD1   M:SEGLD  'ANLZ1'           1                                           
SEGLD2   M:SEGLD  'ANLZ2'           2                                           
SEGLD3   M:SEGLD  'ANLZ3'           3                                           
*                                                                               
*                                                                               
        ELSE     (#SYSTEM='CP-R')                                               
         PAGE                                                                   
         SPACE    2                                                             
LOADSEG  RES      0         LOAD SEGMENT FOR CP-R OR RBM                        
         LI,R1    1                 SET INDEX FOR SEG NO IN FPTS                
         LB,R0    K:SYSTEM          DECIDE WHAT TYPE OF LOAD NEEDED             
         CI,R0    #CPR              ARE WE IN CP-R ?                            
         BE       LOADSEG1            CPR, DO ACTIVATES                         
*                                                                               
         STH,R15  RBMSEGLD,R1       STORE SEGMENT NUMBER TO LOAD                
         M:SEGLOAD,CAL    RBMSEGLD    LOAD THE SEGMENT, RBM STYLE               
         B        LOADSEG5          AND DO COMMON EXIT                          
*                                                                               
*                                                                               
LOADSEG1 RES      0         ACTIVATE NEXT SEGMENT FOR CP-R                      
         LW,R0    SEGMENT#          WAS A SEGMENT ACTIVATED EARLIER ?           
         BEZ      LOADSEG2            NO, SKIP ERASE                            
*                                                                               
         STH,R0   ERASEFPT,R1       SET NUMBER TO ERASE                         
         M:ERASE,CAL  ERASEFPT      GET RID OF THE OLD SEGMENT                  
*                                                                               
LOADSEG2 RES      0         GO GET THE NEW SEGMENT                              
         STH,R15  ACTFPT,R1         SET ITS NUMBER                              
         M:ACT,CAL   ACTFPT         ACTIVATE IT                                 
*                                                                               
LOADSEG5 RES      0         SAVE SEGMENT NOW LOADED                             
         STW,R15  SEGMENT#                                                      
         B        *R14              RETURN                                      
         PAGE                                                                   
         SPACE    2                                                             
ERASERR  RES      0         ERROR ERASING A SEGMENT                             
         LW,R15   SEGMENT#          SET NUMBER WE COULD NOT ERASE               
         LI,R2    ERASERRM          SET LOCATION OF MESSAGE                     
         LI,R1    @ERASERM-1        SET BYTE LOC OF NUMBER IN MESSAGE           
         B        ERASEGER          OFF TO COMMON ERROR MSG UPDATER             
*                                                                               
*                                                                               
SEGERR   RES      0         ERROR LOADING A SEGMENT                             
         LI,R2    SEGERRM           SET MESSAGE LOC                             
         LI,R1    @SEGERRM-1        SET BYTE LOC OF SEG NUMBER IN MSG           
*                                                                               
*                                                                               
ERASEGER RES      0         PUT SEGMENT NUMBER IN ERROR MESSAGE AT R2           
         AI,R15   C'0'              MAKE SEGMENT NUMBER A GRAPHIC CHAR          
         STB,R15  *R2,R1                                                        
         AI,R1    1                 SET TRUE LENGTH OF MESSAGE                  
         B        ABEND             GO DO COMMON ERROR PROCESSING               
         PAGE                                                                   
         SPACE    2                                                             
RBMSEGLD M:SEGLOAD,FPT   (SEG,0),(ERR,SEGERR)    LOAD RBM SEGMENT               
*                                                                               
ERASEFPT M:ERASE,FPT     (SEG,0),(ERR,ERASERR)   ERASE PREVIOUS CPR SEG         
*                                                                               
ACTFPT   M:ACT,FPT       (SEG,0),(ERR,SEGERR)    ACTIVATE NEXT CPR SEG          
*                                                                               
*                                                                               
*                                                                               
        FIN      (#SYSTEM='CP-R')                                               
         PAGE                                                                   
         SPACE    2                                                             
CCREADER RES      0         ERROR READING CONTROL CARDS                         
         LI,R2    CCERRM            SET ERROR MESSAGE                           
         LI,R1    @CCERRM           AND LENGTH                                  
         B        ABEND             GO DO COMMON ERROR REPORTING                
*                                                                               
*                                                                               
INITERR  RES      0         ERROR DURING INITIATE - TAPE POS, ETC               
         LI,R2    INIERRM           SET MESSAGE                                 
         LI,R1    @INIERRM            AND LENGTH                                
         B        ABEND             GO DO COMMON ERROR REPORTING                
*                                                                               
*                                                                               
MAPERR   RES      0         ERROR DURING SORTED MAP PRINT                       
         LI,R2    MAPERRM                                                       
         LI,R1    @MAPERRM                                                      
         B        ABEND                                                         
*                                                                               
*                                                                               
ANLZERR  RES      0         ERROR DURING CRASH ANALYSIS                         
         LI,R2    ANLERRM                                                       
         LI,R1    @ANLERRM                                                      
         B        ABEND                                                         
         PAGE                                                                   
         SPACE    2                                                             
ABEND    RES      0         COMMON ABORT ERROR MESSAGE PRINT PROCESSOR          
         LCI      0                 SAVE ALL UNCHANGED REGISTERS                
         STM,R0   CRSHBUF+100       IN CRASH BUFFER, WHICH IS FREE NOW ?        
         BAL,R14  ABENDMSG          OUT MESSAGE TO PRINTER (AND CONSOLE)        
         MTW,+00  CRSHBUF+100+10    WAS THERE AN R10 ERROR CODE ?               
         BEZ      TERM                NO, TERMINATE NOW                         
*                                                                               
         LB,R10   CRSHBUF+100+10    FETCH ERROR CODE                            
         LI,R1    2                 SET 2 DIGITS TO DO                          
         LI,R2    BA(ABNDM+2)       SET WHERE TO STORE LAST DIGIT               
         BAL,R14  CONVERT           CONVERT THE NUMBER                          
         LW,R10   CRSHBUF+100+8     SET ADDRESS OF THE CAL                      
         AI,R10   -1                ADJUST TO ACTUAL ADDRESS                    
         LI,R2    BA(ABNDM+6)+2     SET CHAR LOC                                
         LI,R1    5                 SET CHARACTER COUNT                         
         BAL,R14  CONVERT                                                       
         LI,R2    BA(ABNDM+10)+3                                                
         LI,R1    5                                                             
         LW,R10   CRSHBUF+100+10                                                
         BAL,R14  CONVERT                                                       
         LI,R2    ABNDM             SET LOC OF MESSAGE                          
         LI,R1    @ABNDM                                                        
         BAL,R14  ABENDMSG          OUT IT WHERE EVER                           
*                                                                               
*                                                                               
TERM     RES      0         END OF ERROR PROCESSING                             
         LCI      0                 RESTORE REGISTERS IN CASE OF A              
         LM,R0    CRSHBUF+100       DUMP IS REQUESTED                           
         M:XXX                      ABORT FOR NOW                               
         PAGE                                                                   
         SPACE    2                                                             
ABENDMSG RES      0         OUT A MESSAGE TO THE PRINTER                        
*                                   AND TO THE CONSOLE IF IN ATTEND MODE        
         PUSH     R14               SAVE RETURN                                 
         BAL,R14  LOGERR            OUT LINE                                    
         PULL     R14               RECOVER LINK                                
*                                                                               
ABNDMSG1 RES      0         TEST IF ERROR REPORTED TO ERROR CORRECTION          
         MTW,+00  ATTENDSW          ARE WE ALLOWING ERROR CORRECTION ?          
         BEZ      *R14                NO, RETURN TO ABORT                       
*                                                                               
         CAL1,1   LL:EC             IS M:LL THE SAME AS ERROR CORR DEV ?        
         CI,R8    1                 I.E., IS INPUT ON LINE OR FROM OC ?         
         BE       *R14                YES, HE CAN TRY THIS OVER AGAIN           
*                                                                               
         M:WRITE  *ERRDCB,(BUF,*R2),(SIZE,*R1),(WAIT)  LET HIM KNOW             
         B        *R14              AND EXIT TO STOP                            
         PAGE                                                                   
         SPACE    2                                                             
CONVERT  RES      0         CONVERT NUMBER IN R10 TO EBCDIC                     
*                                   STORE R1 DIGITS RIGHT TO LEFT               
*                                   STARTING AT BYTE ADDRESS IN R2              
         SLD,R10  -4                SHIFT A DIGIT INTO R11                      
         SLS,R11  -28               RIGHT JUSTIFY IT THERE                      
         AI,R11   C'0'              CONVERT TO EBCDIC (MOSTLY)                  
         CI,R11   C'9'              IS IT A HEX DIGIT ?                         
         BLE      %+2                 NO, DECIMAL, OK AS IS                     
         AI,R11   -(X'FA'-X'C1')    ADJUST TO HEX CHARACTER                     
         STB,R11  0,R2              STORE IT AWAY                               
         AI,R2    -1                STEP TO NEXT PLACE TO LEFT                  
         BDR,R1   CONVERT           AND GO GET NEXT DIGIT                       
*                                                                               
         B        *R14              RETURN                                      
         PAGE                                                                   
         SPACE    2                                                             
SEGERRM  TXT      ' FATAL ERROR LOADING SEGMENT   '                             
ERASERRM TXT      ' FATAL ERROR ERASING SEGMENT   '                             
CCERRM   TXT      ' FATAL ERROR READING CONTROL STATEMENTS'                     
INIERRM  TXT      ' FATAL ERROR PROCESSING DATA FILES'                          
MAPERRM  TXT      ' FATAL ERROR IN MAP PRINTING: REASON STATED',;               
                  ' BEFORE DUMP'                                                
ANLERRM  TXT      ' FATAL ERROR ANALYZING SAVED DATA'                           
ABNDM    TXT      ' ERROR XX FROM CAL AT XXXXX FOR DCB AT XXXXX'                
ENDMSGS  RES      0                                                             
*                                                                               
*                                                                               
*                                                                               
@SEGERRM SET      4*(ERASERRM-SEGERRM)                                          
@ERASERM SET      4*(CCERRM-ERASERRM)                                           
@CCERRM  SET      4*(INIERRM-CCERRM)                                            
@INIERRM SET      4*(MAPERRM-INIERRM)                                           
@MAPERRM SET      4*(ANLERRM-MAPERRM)                                           
@ANLERRM SET      4*(ABNDM-ANLERRM)                                             
@ABNDM   SET      4*(ENDMSGS-ABNDM)                                             
         PAGE                                                                   
*                                                                               
*                           DATA AND CONSTANTS                                  
*                                                                               
#LINES   DATA     0                 LINES PER PAGE                              
EOT      DATA     0                 >0 ==> EOT FROM TAPE, NO DUMP ON FILES      
NOTFIRST DATA     0                 0 ==> READ 1ST CMD INPUT; >0 ==> NTH        
REWUNLD  DATA     0                 POST-PROCESSING TAPE POSITIONING SW         
*                                   0  =>  NOTHING                              
*                                   1  =>  UNLOAD                               
*                                   2+ =>  REWIND                               
MAPPAGE  DATA     0                 FIRST PAGE NUMBER OF SORTED MAP             
*                                                                               
*                                                                               
CCREAD   DATA     0                 CONTROL CARD READ STATUS SWITCH             
*        USE: SET TO 0 BEFORE CALLING READCC TO READ CONTROL CMDS.              
*             ON RETURN:    CCREAD > 0  ==> DO AN ANALYZE.                      
*                           CCREAD = 0  ==> IF NOTFIRST = 0  ANALYZE            
*                                              NOTFIRST > 0  SKIP ANALYZE       
*             AFTER AN ANALYZE (OR SKIPPED ANALYZE):                            
*                           CCREAD > 0  ==> LOOP FOR MORE CONTROLS              
*                           CCREAD = 0  ==> TERMINATE.                          
*                                                                               
CRSHRROS DATA     1000              INDEX NUMBER OF LAST SECTOR OF              
*                                   DUMP FILE MOVED FROM TAPE                   
LIMPTR   DATA     0                 POINTER TO NEXT SET OF LIMITS TEMP          
LIMITV   RES      0         10 GROUPS OF LIMITS FOR DUMP RANGES                 
         DATA     0,0,0             VIRT/REAL, BEGIN, END                       
         LIST,1   1                                                             
         DO1      29                                                            
         DATA     0,0,0             ROOM FOR 29 MORE                            
         LIST     1                                                             
         PAGE                                                                   
         SPACE    2                                                             
*                           OUTPUT CONTROL SWITCHES SET BY PARAMETERS           
*                                                                               
*                               0 ==> PRODUCE OUTPUT; >< 0 ==> DON'T            
*                                                                               
NOMAP    DATA     0                 MAP OUTPUT                                  
NOTABLE  DATA     0                 TABLES, ETC                                 
NOTRACE  DATA     0                 TRACE OUTPUT                                
NODUMP   DATA     0                 NO HEX CORE DUMP                            
*                                                                               
*                                                                               
PAGE     DATA     0                 PAGE NUMBER OF CURRENT OUTPUT PAGE          
*                                                                               
*                           NAMES OF INPUT FILES FOR CP-R                       
*                                                                               
CPRAREA  DATA     X'10000000'       GOOD COPY OF CP-R MONITOR                   
         DATA     'SP'                                                          
         TXT      'CPRFILE'                                                     
         TXT      '        '                                                    
*                                                                               
DATAAREA DATA     X'10000000'       SAVED COPY OF MEMORY                        
         DATA     'SP'                                                          
         TXT      'CRASH   '                                                    
         TXT      '        '                                                    
*                                                                               
MAPAREA  DATA     X'10000000'       COPY OF SYSGEN MAP                          
         DATA     'SP'                                                          
         TXT      'CPRMAP  '                                                    
         TXT      '        '                                                    
*                                                                               
         PAGE                                                                   
         SPACE    2                                                             
*                           SWITCH: IF AN INPUT TAPE SPECIFIED                  
*                                   -1 ==> NO INPUT SPECIFIED                   
*                                    2 ==> INPUT SPECIFIED AS OPLABEL           
*                                    5 ==> INPUT SPECIFIED AS DEVICE            
MTDEVADL DATA     -1                NO INPUT SPECIFIED INITIALLY                
*                                                                               
         BOUND    8                                                             
MTDEVADD DATA     0,0,0             NAME OF INPUT SPECIFIED                     
*                                                                               
*                                                                               
NUMDUMPS DATA     0                                                             
FCOMMENT DATA     1                 COMMENT SW; 0 ==> OFF, 1 ==> ON             
*                                                                               
*                                                                               
SEGMENT# DATA     0                 CURRENT SEGMENT LOADED; 0 ==> NONE          
*                                                                               
*                                                                               
         RES      8                                                             
CRSHBUF  RES      256               BUFFER FOR CRASH FILE:                      
*                                   USED TO COPY FILES FROM TAPE BACK           
*                                        TO RAD FOR CRASH TAPES.                
*                                   USED TO READ 1 BLOCK OF CRASHFILE           
*                                        INTO BY 'FINDCORE' IN SEG 3            
         PAGE                                                                   
         SPACE    2                                                             
        DO       (#SYSTEM='CP-V')                                               
*                                                                               
*                                                                               
K:JCP1   DATA     0                 FAKE CELL FOR ATTEND MODE STATUS            
K:PAGE   GEN,8,24 37,0              FAKE NUMBER OF LINES PER PAGE               
*                                                                               
******************THE FOLLOWING 4 WORDS MUST STAY IN THE ORDER VVVVVV++         
*                 GIVEN. SEE CODE AT 'ANALYZE' FOR WHY.              <<         
FGDBKGSW DATA     0                 0 ==> BKG PGM; 1 ==> ON-LINE PGM <<         
INDCB    DATA     M:C               COMMAND INPUT DCB                <<         
ERRDCB   DATA     M:C               ERROR CORRECTION DCB             <<         
ATTENDSW DATA     0                 0 IF BFG; 1 IF ON-LINE           <<         
***************************************************************AAAAAA++         
*                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        
*                                                                               
LL:LO    M:DEVICE,L  M:LL,(CORRES,M:LO)     LL DCB SAME AS LO DCB ?             
LL:EC    M:DEVICE,L  M:LL,(CORRES,*ERRDCB)  LL DCB SAME AS ERROR CORR ?         
IN:EC    M:DEVICE,L  *INDCB,(CORRES,*ERRDCB)  INPUT VS ERROR CORRECTION         
IN:LL    M:DEVICE,L  *INDCB,(CORRES,M:LL)     INPUT VS LL DCB                   
         PAGE                                                                   
*                                                                               
F:X1     DSECT    1                                                             
*                                                                               
F:X1     M:DCB    (FILE,'CPRANLZDTA'),(KEYED),(KEYM,3),(IN),(DIRECT),;          
                  (RECL,1024),(SAVE)                                            
*                                                                               
F:X2     DSECT    1                                                             
*                                                                               
F:X2     M:DCB    (FILE,'CPRANLZCPR'),(KEYED),(KEYM,3),(IN),(DIRECT),;          
                  (RECL,1024),(SAVE)                                            
*                                                                               
F:X3     DSECT    1                                                             
*                                                                               
F:X3     M:DCB    (FILE,'CPRANLZMAP'),(CONSEC),(IN),(SEQUEN),;                  
                  (RECL,80),(SAVE)                                              
*                                                                               
F:X4     DSECT    1                                                             
*                                                                               
F:X4     M:DCB    (DEVICE,'9T'),(FILE,'CPRCRSTAPE'),(IN),(CONSEC),;             
                  (SEQUEN),(RECL,1024),(TRIES,15),(SN,'PCPR')                   
*                                                                               
         PAGE                                                                   
         SPACE    2                                                             
        ELSE     (#SYSTEM='CP-R')                                               
         PAGE                                                                   
         SPACE    2                                                             
******************THE FOLLOWING 4 WORDS MUST STAY IN THE ORDER VVVVVV++         
*                 GIVEN. SEE CODE AT 'ANALYZE' FOR WHY.              <<         
FGDBKGSW DATA     0                 0 ==> BKG PGM; 1 ==> FGD PGM     <<         
INDCB    DATA     M:C               COMMAND INPUT DCB                <<         
ERRDCB   DATA     M:OC              ERROR CORRECTION DCB             <<         
ATTENDSW DATA     0                 NOT USED IN CP-V                 <<         
***************************************************************AAAAAA++         
*                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        
*                                                                               
LL:LO    M:CORRES,FPT (DCB1,M:LL),(DCB2,M:LO)   LL VS LO FOR SAME DEVICE        
LL:EC    M:CORRES,FPT (DCB1,M:LL),(DCB2,*ERRDCB)  LL VS ERR CORR                
IN:EC    M:CORRES,FPT (DCB1,*INDCB),(DCB2,*ERRDCB) IN VS ERR                    
IN:LL    M:CORRES,FPT (DCB1,*INDCB),(DCB2,M:LL)    IN VS LL                     
*                                                                               
*                                                                               
        FIN                                                                     
         USECT    ANALYZE           RETURN TO CODE CSECT                        
         PAGE                                                                   
         SPACE    3                                                             
         END      ANALYZE                                                       
