         DEF      TFILE
TFILE    EQU      %
*                 CATALOG NO. 704881 - BPM M:TFILE
MONPROC  SET      1
         SYSTEM   UTS
*
*
*              PROGRAM NAME      M:TFILE
*
*              PROGRAMMER    D. W. HEYING
         PAGE
*                 SYMBOLIC REGISTER DEFINITIONS.
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R5       EQU      5
R6       EQU      6
R7       EQU      7
SR1      EQU      8
SR2      EQU      9
SR3      EQU      10
SR4      EQU      11
D1       EQU      12
D2       EQU      13
D3       EQU      14
D4       EQU      15
         PAGE
*                 IMMEDIATE CONSTANTS USED BY MONITOR.
K0       EQU      0
         PAGE
*                 DECLARE TEMP FILE NAME
         DEF      MSRTFILE
MSRTFILE PUSH     SR4
         LW,SR1   J:BASE
         REF      J:BASE
         PUSH     SR1
         PUSH     R7
         LW,R7    Y002
         REF      Y002
         CW,R7    FCD,R6
         BAZ      1A1
*                 CLOSE DCB WITH DEFAULT.
         LI,R7    X0
         LI,SR1   X'15'
         OVERLAY  CLSSEG,0
         REF      CLSSEG,X0
         REF      MSRRDWT
*                 OPEN DCB WITH OPTIONS:
*                   FILE,KEYED,UPDATE,DIRECT,NAME,ACCT,KEYM
1A1      RES      0
         LI,SR1   X'14'
         LW,R3    *TSTACK           FPT LOC
         LC       *R3               PRESENCE BITS
         LI,R4    4                 INDEX & COUNTER
         BCS,4    1C5               ABN EXISTS
1C3      LI,R1    X'1FFFF'
         AND,R1   *R4,R6            USE DCB ENTRY
         B        1C1
1C5      LW,R1    2,R3              ASSUME ERR EXISTS
         BCS,8    %+2               IT DOES
1C2      LW,R1    1,R3
         BGEZ     1C1               NOT INDIRECT
         CI,R1    X'1FFF0'          CHK FOR REG
         BANZ     1C4               IT'S NOT
         LW,R2    TSTACK            GET J:BASE
         LW,R2    -1,R2
         LW,R1    *R2,R1            INDIRECT THRU REG
         B        1C1
1C4      LW,R1    0,R1              NORMAL INDIRECT
1C1      STW,R1   D3-4,R4           SET D2 & D3
         CI,R4    3
         BE       1C0               DONE
         BDR,R4   %+1
         BCS,8    1C2               USE FPT
         B        1C3               USE DCB
1C0      RES      0
         LW,D1    MSKOP1
         LW,R7    TSTACK
         LCI      3
         PSM,D1   TSTACK
         AI,R7    1
         LCI      8
         LM,D1    TMPOPN
         LI,4     X'FFFF'
         AND,R4   J:JIT
         REF      J:JIT
         SLS,R4   8
         OR,R2    R4
         PUSH     8,D1
         LCI      2
         LM,R1    J:JIT+ACCN
         PUSH     2,R1
STAR     SET      1
         DO       STAR=1
         REF      J:STAR
         LW,SR2   J:STAR+4          CHK *T IN JIT
         BNEZ     OPNIT
         ELSE
         LI,SR2   2
         B        OPNIT
         FIN
TRYOUT   LI,R1    2
         STW,R1   5,R7
OPNIT    EQU      %
         OVERLAY  OPNSEG,0
         REF      OPNSEG,ACCN
         DO       STAR=1
         ELSE
         CI,SR3   K0
         BE       %+2
         BDR,SR2  TRYOUT
         FIN
         BUMP     -13,R1
         PULL     R7
         PULL     SR2
         STW,SR2  J:BASE
         PULL     SR2
         AI,SR3   0
         BNE      *SR2
         LI,SR1   X'11'
         AI,R7 -1    *** ADJUST R7=PLIST-1 HOPE OK RETURNING THRU TFX1
         BAL,SR4  MSRRDWT
         PUSH     SR2
         LI,SR1   X'15'
          PUSH    SR3
         LD,D1    CLSSAV
         PSW,D1   TSTACK
         LW,R7    TSTACK
         PSW,D2   TSTACK
         OVERLAY  CLSSEG,0
         BUMP     -2,R1
         PULL     SR3
         REF      PULLEXIT
         DESTRUCT PULLEXIT
         BOUND    8
CLSSAV   DATA     X'80000000',2
*                 KEYED,DIRECT,UPDATE,SAVE,KMAX
TMPOPN   DATA     2,2,4,2,31
         DATA     X'1000101'
         DATA     X'30000E3'
         DATA     X'2010202'
MSKOP1   DATA     X'C7480001'
         END

