         SYSTEM   SIG7FDP
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
         REF      RCVRBUF,RCVRFLG,SDAA,SYMND,Y08
         REF      INVRN,INVRNSZ,GET256,CLSXX,M17
         REF      CTR2,CTR1,CTR5,SVCBF,LCLX,FRE256
         REF      ALLOQ,M16,BL:IFS,OUTFIL,DEC
         REF      RCVRSV,GI:FRE,SGCBUF,HEXC,INFIL
         REF      MFS,ZAPM,ZAPM1,S:CUN,UH:FLG
         REF      FINWRT,MOVEMES,SETHDR,RBB:ID,RBLIMS
         REF      MBS,PL:LK,X100,Y002
         SREF     RB:FLAG,RBB:HFE,RBB:HIN,RBB:HOU,STB:LNK
         SREF     ACTBIT,HASPBIT
         REF      SGCHD,CTR4,FINFLG,FO1
         REF      BB:RID,BB:DEV,RB%HU,YFF
         REF      CURSID,FIND,FIND1,S:USID,STB:TYP
         REF      0OPRI,RSID
         SREF     MXSTRM,OFFBIT
         REF      BB:COPY,BW:FORM,BH:SID,M7
         REF      NOPGFC,GOF,GIFNC,MBSGFC,JESTAT
         REF      JEDEL,KCOMGFC,SNDGFC,BCSTGFC,OCMGFC
         REF      NCIPRI,FREO,DELPRI,M24
         REF      BW:SDA,ADDFRE,SVIV1
         REF      DELJOB,LSTSECT,TEL%OP1
         REF      FLAGS,RCVRPTR,S:BFIS
         REF      M:XX,PGCNT,RBG,BADRID1
         REF      BB:PI,BH:HPRI,BH:LINK,BH:TPRI
         SREF     BW:FOVL,BB:JDE
         REF      SSIG,SNDDX,SYMX,SSTAT,SAQNSERT
         REF      FIPRI,FREI,RUNPRI
         REF      SVREGS,SVZ
         REF      GI:SDA,GIB:UN
         REF      MFBIT,MFFS,BL:OFS
         REF      BSCBTS,RCVUN,RRBIT,RRRBIT
         REF      SYSD,RRM,NRRM,NRRM1,TMPSTK
         REF      BH:GRAN,BD:ACCT
         DEF      LRRCVR,RCVRABRT,RCVRY,RCVRY1
         CSECT    1                 ---------------------------------------
RCVRY    EQU      %                 GET FLAGS FROM COMBUF LEFT BY RECOVERY.
         LI,R5    0                 FLAG X'2' MEANS DATA CLOBBERED,X'4' MEANS
         LW,R15   2,R7              COMBUFS CLOBBERED, X'1' MEANS OPERATOR
         LB,R1    R15
         STW,R1   RCVUN
         SLS,R15  28                RECOVERY , X'8' MEANS GHOST WASNT RUNNING
         AW,R15   R7                BUT HAS SOMETHING TO RECOVER.  GET COMBUF
         STW,R15  RCVRSV            ADDR. AND STORE IT AND FLAGS IN RCVRSV.
         LC       R15
         BCS,2    ZAP
         BCS,4    ZAP1              -------------------------------------------
         CAL1,1   OPNR              OPEN THE RECOVERY FILE.  IF RBBAT WASN'T
         LC       R15               RUNNING READ COMBUFS ONLY.
         BCS,8    RDCM              -------------------------------------------
         LI,R1    SDKEY             READ IN STATIC DATA RECORD - IF RCVRFLG IS
         LI,R5    SDSIZE            SET IN NEW DATA THIS IS A NESTED RECOVERY.
         AI,R5    X'7FF'
         SLS,R5   -11
         SLS,R5   11
         LI,R9    SDAA
         LW,R8    R5
         CAL1,1   READR
         STW,R15  RCVRSV
         CW,R5    M:XX+13
         BNE      ZAP2
         LI,R1    1
         XW,R1    RCVRFLG
         BNEZ     ZAP3              -------------------------------------------
         LI,R3    32                AGAINST INTERNAL COUNTERS.  IF SOME EXISTS
         SW,R3    PGCNT             READ IT IN.
         SLS,R3   -1
         LW,R1    1,R7
         BLZ      RDDD
         CW,R3    R1
         BNE      ZAP4
RDDD     EQU      %
         AI,R3    0
         BEZ      RDIV
         OR,R3    Y08
         CAL1,8   R3
         SLS,R8   11
         LI,R1    DDKEY
         CAL1,1   READR             -------------------------------------------
RDIV     EQU      %                 READ IN INVIRONMENT AND COMBUF RECORDS.
         LI,R9    INVRN             THE COMBUFS GO INTO A DYNAMIC DATA BUFFER.
         LI,R8    INVRNSZ           WHOSE ADDR. IS SAVED IN RCVRBUF.
         LI,R1    IVKEY
         CAL1,1   READR
RDCM     EQU      %
         BAL,R6   GET256
         LW,R9    R7
         STW,R7   RCVRBUF
         LI,R8    1024
         LI,R1    CMKEY
         CAL1,1   READR             ------------------------------------------
         CAL1,1   CLSXXR
         BAL,R11  INPROG            THERE IS AN ENVIRONMENT TO BE EXECUTED.
INPROGX  EQU      %                 -------------------------------------------
         LI,R7    RCVRCTR1          GET THE COMBUFS FROM THE RECOVERY FILE AND
         STW,R7   RCVRPTR           PERFORM THE REQUESTED TASKS IF NECESSARY
         LI,R7    X'FF'             AND POSSIBLE.WHEN DONE FREE THE COMBUF RECOR
         LS,R7    *RCVRBUF          AREA.
RCVRCTR  EQU      %
         AW,R7    RCVRBUF
         STW,R7   SVCBF
         LI,R2    3
         LB,R2    *R7,R2
         MTB,0    RCVRFLG
         BNEZ     CTR5
         LI,R1    #ABORTS
         CB,R2    ABORTS,R1
         BE       %+3
         BDR,R1   %-2
         B        CTR5
RCVRCTR1 EQU      %
         LB,R7    *SVCBF
         BNEZ     RCVRCTR
         LW,R6    RCVRBUF
         BAL,R4   FRE256            --------------------------------------------
GETIRCVR EQU      %                 PICK UP ANY JOBS IN THE GETI TABLES WHICH
         LI,R1    RUNPRI            HAVE NOT YET BEEN ACCESSED BY THE COOP.
         LH,R2    BH:HPRI,R1        AT THE SAME TIME CLEAR OUT THE RUNNING CHAIN
GIR1     EQU      %
         BEZ      GIR4
         LI,R4    FREI
         LB,R15   BB:PI,R2
         LI,R3    3
         CB,R15   GIB:UN,R3
         BE       GIR15
         BDR,R3   %-2
         LW,R10   BW:SDA,R2
         CW,R10   RRBIT
         BAZ      GIR2
         LH,R15   BH:SID,R2
         CW,R10   RRRBIT
         BANZ     NORR
         LB,R10   BB:PI,R2
         CW,R10   RCVUN
         BE       NORR
         LW,R13   RRRBIT
         STS,R13  BW:SDA,R2
         STB,R13  BB:PI,R2
         LI,R4    RRM
         LI,R10   GIR2-1
TEL%RR   EQU      %
         BAL,R11  HEXC
         STW,R13  SYSD,R4
         LCI      2
         PSM,R1   TMPSTK
         BAL,R8   TEL%OP1
         LCI      2
         PLM,R1   TMPSTK
         B        *R10
NORR     EQU      %
         LI,R4    NRRM
         LD,R10   BD:ACCT,R2
         STW,R10  NRRM1
         STW,R11  NRRM1+1
         BAL,R10  TEL%RR
         LI,R4    DELPRI
         B        GIR2
GIR15    EQU      %
         MTW,1    S:BFIS
         LI,R15   0
         STB,R15  GIB:UN,R3
         STB,R15  BB:PI,R2
         XW,R15   GI:SDA,R3
         STS,R15  BW:SDA,R2
         LI,R4    FIPRI-1
GIR2     EQU      %
         LH,R1    BH:LINK,R2
         LH,R15   BH:HPRI,R4
         STH,R15  BH:LINK,R2
         STH,R2   BH:HPRI,R4
         BNEZ     %+2
         STH,R2   BH:TPRI,R4
         LW,R2    R1
         B        GIR1
GIR4     EQU      %                 --------------------------------------------
         LI,R1    RUNPRI            CLEAR VARIOUS FLAGS AND POINTERS .  AT THIS
         STH,R2   BH:HPRI,R1        TIME THE RECOVERY IS ESSENTIALLY COMPLETE.
         STH,R2   BH:TPRI,R1        THEN DO AN MBS AND START ALL THE SYMBIONTS
         STW,R2   RCVRFLG           TO GET THE SYMBIONT SYSTEM GOING AGAIN.
         BAL,R8   SVIV1             FINALLY EXIT TO RELEASE THE COMBUF AND
         STW,R2   SVCBF             CONTINUE NORMAL OPERATION.
         STW,R2   PL:LK
         LI,R11   INFIL-1
         LI,R14   OUTFIL-MFS-1
         LI,R1    DELPRI
         BAL,R0   FIND
         B        SETCL
         CI,R1    DELPRI
         BNE      COUNT2
         CI,R2    INFIL
         BG       COUNT1
COUNT    AI,R11   -1
         B        FIND1
COUNT1   AI,R14   -1
         B        FIND1
COUNT2   EQU      %
         CI,R1    RUNPRI
         BG       COUNT1
         B        COUNT
SETCL    EQU      %
         STW,R14  BL:OFS
         STW,R11  BL:IFS
         AI,R11   1-INFIL
         LCW,11   11
         STW,R11  S:BFIS
         LH,R11   RSID
         AI,R11   2                 PADDING
         STW,R11  S:USID
         BAL,R11  MBS
         LB,R3    SNDDX
         B        STRT2
STRT     EQU      %
         LB,R1    SNDDX,R3
         AND,R1   M7
         BEZ      STRT1
         CLM,R1   RBLIMS
         BCR,9    STRT1+1
         LB,R1    SYMX,R3
         CI,R1    2
         BAZ      STRT1
STRT2    EQU      %
         LB,R1    SSIG,R3
         BNEZ     STRT1
         LB,R1    SSTAT,R3
         BNEZ     STRT1
         LI,R1    'I'
         STB,R1   SSIG,R3
         BAL,R11  SAQNSERT
STRT1    BDR,R3   STRT
         LI,R5    LCLX
         LW,R1    RCVRSV
         B        CTR1+3
*********************************************
RCVRY1   EQU      %                 PROCESS RECOVERY OCCURED HERE COMBUF.
         MTW,1    FINFLG            :
         LI,R1    RC2               SET THE TOP BYTE OF RCVRFLG AND THEN SEND
         STW,R1   RCVRPTR           RECOVERY OCCURED TO ALL RBTS IN THE MESSAGE
         MTB,1    RCVRFLG           FILES.  THEN EXIT BACK TO RCVRCTR.
         LW,R5    RBLIMS+1
         B        %+2
RC2      EQU      %
         AI,R5    -1
         CW,R5    RBLIMS
         BL       RC3
         LW,R9    RB:FLAG,R5
         STW,R9   FLAGS
         CI,R9    ACTBIT
         BAZ      RB%HU
         CW,R9    HASPBIT
         BANZ     FSTRM
         SREF     2780BIT
         CW,R9    2780BIT
         BANZ     RB%HU
         BAL,R4   SETHDR
         LI,R4    CTR4
         LI,R1    RCVRMES
         BAL,R11  MOVEMES
         CI,R4    CTR4
         BNE      RC2
         LW,R9    RB:FLAG,R5
         OR,R9    X100
         B        FO1
RC3      EQU      %
         LI,R1    0
         STW,R1   FINFLG
         LI,R1    RCVRCTR1
         STW,R1   RCVRPTR
         B        RCVRCTR1
FSTRM    EQU      %
         LI,R10   0
         LB,R4    RBB:HIN,R5
         BAL,R11  STRMST
         LB,R4    RBB:HOU,R5
         BAL,R11  STRMST
         STB,R10  RBB:HOU,R5
         STB,R10  RBB:HIN,R5
         B        RB%HU
STRMST   EQU      %
         BEZ      *R11
         LB,R3    RBB:HFE,R5
         STB,R4   RBB:HFE,R5
         LB,R10   STB:LNK,R4
         BEZ      %+3
         LW,R4    R10
         B        %-3
         STB,R3   STB:LNK,R4
         B        *R11
**********************************************
INPROG   EQU      %                 CHECK FOR AN ENVIRONMENT AND EXECUTE IT.
         STW,R11  RCVRPTR           :
         LW,R9    FLAGS             THE GHOST SAVES ITS OWN ENVIRONMENT WHEN
         AND,R9   RCVRMSK           IF GOES DOWN INTO THE MONITOR AND IF SVZ IS
         AI,R9    X'20'             ZERO THIS IS VALID.  OTHERWISE THE JIT
         STW,R9   FLAGS             ENVIRONMENT FROM RECOVERY IS CHECKED TO
         XW,R9    SVZ               SEE IF IT SHOWS THE GHOST RUNNING.  IF
         BNEZ     JITIV             NOT INPROG EXITS.  IF SO THIS ENVIRONMENT IS
         LW,R7    SVCBF
         AI,R7    -SGCHD
         AW,R7    RCVRBUF
         STW,R7   SVCBF
         LCI      0                 EXCUTED.  IF AN OPERATOR RECOVERY OCCURED
         LM,R0    SVREGS            THERE MAY NOT BE AN ENVIRONMENT EVEN IF RBBA
         B        *R11              WAS RUNNING  IN THIS CASE THE OPERATOR IS TO
JITIV    EQU      %                 AND THE RECOVERY CONTINUES.  IF THE GHOST HA
         LW,R1    INVRN             NEVER BEEN STARTED THERE IS NO ENVIRONMENT
         AND,R1   M17               AND THIS IS OK.  GOF IS SPECIAL CASED.
         BNEZ     JITIV1
         LC       RCVRSV
         BCS,8    INPROGX
         BCR,1    ZAP5
         LI,R4    OPRM
         LI,R8    INPROGX
         B        TEL%OP1
JITIV1   EQU      %
         CI,R1    CTR2
         BE       INPROGX
         CLM,R1   CTRLIMS
         BCR,9    INPROGX
         LW,R7    SVCBF
         AI,R7    -SGCHD
         AW,R7    RCVRBUF
         LI,R3    X'FF'
         LS,R3    *R7
         CI,R3    GOF
         BE       TRGOF
         CI,R3    GIFNC
         BE       TRGIF
INPROGO  EQU      %
         LW,R3    INVRN+10
         CW,R3    SVCBF
         BNE      %+2
         STW,R7   INVRN+10
         STW,R7   SVCBF
         LCI      0
         LM,R0    INVRN+2
         LPSD,0   INVRN
************************************************
TRGOF    EQU      %                 IF THE CURRENT OPERATION WAS GOF AT THE
         LW,R1    1,R7              TIME OF THE CRASH A FILE MAY HAVE BEEN
         CI,R1    -1
         BNE      INPROGX
         LI,R1    TRGOF1            BE EXECUTED BUT THERE IS NO ONE TO GIVE
TRG      EQU      %
         STW,R1   RCVRPTR           THE FILE TO.  THIS ROUTINE ALLOWS THE GOF TO
         B        INPROGO           COMPLETE BUT THEN RETURNS THE INFORMATION TO
TRGOF1   EQU      %                 THE ENTRY.
         LW,R14   2,R7
         LB,R14   R14
         AI,R14   0OPRI
TRG1     EQU      %
         LW,R10   1,R7
         BEZ      INPROGX
         LI,R1    FREO
         LH,R2    BH:HPRI,R1
         AND,R10  M24
         STW,R10  BW:SDA,R2
         LI,R8    INPROGX
         CI,R14   DELPRI
         BE       ADDFRE
         LH,R3    BH:TPRI,R1
         LW,R10   BW:SDA,R3
         AND,R10  YFF
         STS,R10  BW:SDA,R2
         LH,R10   BH:SID,R3
         STH,R10  BH:SID,R2
         LB,R10   BB:RID,R3
         STB,R10  BB:RID,R2
         LB,R10   BB:DEV,R3
         STB,R10  BB:DEV,R2
         LW,R10   BW:FORM,R3
         STW,R10  BW:FORM,R2
         LB,R10   BB:COPY,R3
         STB,R10  BB:COPY,R2
         LH,R10   BH:GRAN,R3
         STH,R10  BH:GRAN,R2
         LI,R10   BW:FOVL
         BEZ      ADDFRE
         LW,R10   BW:FOVL,R3
         STW,R10  BW:FOVL,R2
         LB,R10   BB:JDE,R3
         STB,R10  BB:JDE,R2
         B        ADDFRE
TRGIF    EQU      %
         LI,R1    4
         LB,R1    *R7,R1
         BEZ      INPROGX
         LI,R1    TRGIF1
         B        TRG
TRGIF1   EQU      %
         LI,R14   NCIPRI
         B        TRG1
*************************************
RCVRABRT EQU      %                 IF AN AIF IS RECIEVED AFTER THE RECOVERY
         CLM,R5   RBLIMS            OCCURED POINT THE JOB IS DELETED  AND
         BCS,9    RCAL              THE SUBMITTER (OPERATOR) IS TOLD VIA THIS
         CW,R9    BSCBTS
         BANZ     LSTSECT
         CI,R9    ACTBIT
         BAZ      LSTSECT
         BAL,R4   SETHDR            ROUTINE.
         NOP
         LI,R1    RABTM
         LI,R11   LSTSECT
         B        MOVEMES
RCAL     EQU      %
         LI,R4    RABTM
         LI,R8    DELJOB
         B        TEL%OP1
******************************************
LRRCVR   EQU      %                 IF A MONITOR BUFFER CARRYING A LOGON RECORD
         LI,R10   RCVRELOG
         B        BADRID1           TELLS THE RBT TO TRY AGAIN.
*******************************************
ZAP      MTB,1    R5                IF THE GHOST CANNOT RECOVER THIS ROUTINE
ZAP1     MTB,1    R5                TELLS THE LOCAL OPERATOR AND EXITS TO
ZAP2     MTB,1    R5                ANOTHER COPY OF THE GHOST WITH CLEAN DATA
ZAP3     MTB,1    R5                AFTER CLEARING UP ALL SORTS OF CORE TABLES.
ZAP4     MTB,1    R5                :
ZAP5     MTB,1    R5                THE ERROR CODE GIVEN IS AN I/O ERR/ABN
         LB,R15   R5                IF NO '*' IS PRESENT.  IF THE '*' IS THERE
         BAL,R11  DEC               IT IS ONE OF THESE:
         LI,R15   '*'               :
         STB,R15  R13                 *  1  =  UNEXPLAINED MISSING ENVIRONMENT
ZAPX     EQU      %                   *  2  =  DYNAMIC DATA WRONG SIZE
         LW,R1    Y002
         CW,R1    M:XX
         BAZ      %+2
         CAL1,1   CLSXXR
         STW,R13  ZAPM1               *  3  =  NESTED RECOVERY
         LI,R4    ZAPM                *  4  =  STATIC DATA WRONG SIZE
         BAL,R8   TEL%OP1             *  5  =  RCVRY SAID COMBUFS BAD
         LW,R1    RCVRSV              *  6  =  RCVRY SAID DATA BAD
         WD,0     X'37'             :
         LB,R2    SGCHD             THESE ARE ALL SYSTEM ERRORS AND SHOULD
         STB,R2   *R1               BE DEBUGED WHENEVER THEY OCCUR.
         AI,R1    -SGCBUF
         STB,R1   SGCHD
         LI,R1    X'10203'
         STW,R1   GI:FRE
         LI,R1    0
         STW,R1   S:BFIS
         STW,R1   PL:LK
         LI,R1    MXSTRM
         BEZ      ZAPX3
         LI,R14   0
ZAPX1    EQU      %
         STB,R14  SSIG,R1
         STB,R14  STB:TYP,R1
         STB,R1   STB:LNK,R1
         MTB,1    STB:LNK,R1
         BDR,R1   ZAPX1
         LI,R1    MXSTRM
         STB,R14  STB:LNK,R1
         LI,R14   1
         STB,R14  STB:LNK
         LW,R1    RBLIMS+1
ZAPX2    CW,R1    RBLIMS
         BL       ZAPX3
         LW,R14   RB:FLAG,R1
         AND,R14  ZAPRBIT
         AI,R14   OFFBIT
         STW,R14  RB:FLAG,R1
         AI,R1    -1
         B        ZAPX2
ZAPX3    EQU      %
         LI,R1    INFIL-1
         STW,R1   BL:IFS
         LI,R1    OUTFIL-MFS-1
         STW,R1   BL:OFS
         WD,0     X'27'
         LW,R14   Y0006
         LI,R15   0
         BAL,R4   ALLOQ
*HERE IT SAYS GJOB RBBAT :SYS ERR ON THE OC
         CAL1,9   1
***********************************************
IOZAP1   BAL,R11  HEXC
         B        ZAPX
***********************************************
RDER     EQU      %
         LH,R15   R10
         AND,R15  M16
         CI,R15   X'4300'
         BNE      IOZAP1
         CI,R1    IVKEY
         BNE      IOZAP1
         LI,R1    0
         STW,R1   INVRN
         B        RDCM
******************************************
OPNR     EQU      %
         GEN,8,24 X'14',M:XX
         DATA     X'C7400009'
         DATA     RDER
         DATA     RDER
         DATA     2
         DATA     2
         DATA     1
         DATA     2
         DATA     X'01000202'
         TEXTC    ':RBBRVR'
         DATA     X'02010202'
         TEXT     ':SYS '
READR    EQU      %
         GEN,8,24 X'10',M:XX
         DATA     X'F8000010'
         DATA     RDER
         DATA     RDER
         PZE      *R9
         PZE      *R8
         PZE      *R1
CLSXXR   EQU      %
         GEN,8,24 X'15',M:XX
         PZE      *0
         DATA     1
****************************************************
RABTM    TEXTC    '*PARTIAL INPUT FILE DELETED BY RECOVERY'
OPRM     TEXTC    '*TASK LOST BY RBBAT DUE TO OPERATOR RECOVERY'
RCVRELOG DATA     X'25F10C5C'
         TEXT     '** RECOVERY OCCURED -- RETRY LOGON'
RCVRMES  TEXTC    '%%%%%%% RECOVERY OCCURED %%%%%%%'
***********************************************
SDKEY    TEXTC    'RBBATSD'
DDKEY    TEXTC    'RBBATDD'
IVKEY    TEXTC    'RBBATIV'
CMKEY    TEXTC    'RBBATCM'
*
*
ABORTS   EQU      %
         DATA,1   0,NOPGFC,GOF,GIFNC,MBSGFC
         DATA,1   JESTAT,JEDEL,KCOMGFC,SNDGFC
         DATA,1   BCSTGFC,OCMGFC
#ABORTS  EQU      BA(%)-BA(ABORTS)-1
         BOUND    4
RCVRMSK  DATA     X'DFFFFFCA'
Y0006    DATA     X'00060000'
ZAPRBIT  DATA     X'06208000'
         BOUND    8
CTRLIMS  DATA     RBG
         DATA     CTR5-2
SDSIZE   EQU      BA(SYMND)-BA(SDAA)+4
*************************************************:
         END

