MONPROC  SET      1
ANSPROC  SET      1
         SYSTEM   UTS
         PCC      0
OPN      EQU      %
SYN      SET      1
         SPACE    3
         BOUND    8
K3FF     EQU      X'3FF'
K7       EQU      X'7'
DENS     EQU      ACS
K1       EQU      X'1'
K3       EQU      X'3'
KF       EQU      X'F'
K1FFFF   EQU      X'1FFFF'
KN1      EQU      -X'1'
KN2      EQU      -X'2'
KN4      EQU      -X'4'
         SPACE    3
         OPEN     WXBUFSIZ,XBUFSIZ
WXBUFSIZ EQU      X'200'
XBUFSIZ  EQU      X'800'
         PAGE
R0       EQU      0
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
*
DESC     EQU    17      BYTES 1-3,WD 17,DCB-DESCRIPTORS TEMP STOR IN OPN
TSTF     EQU      16                TEST FILE FLAG IN DCB-WD 16,BIT 12
         SPACE    2
         REF      DCTSIZ,DCT4,OH:NM
         REF      OV:NMSZ,SB:RTY,SV:LSIZ,SV:RSIZ
         REF      OPNER
         SPACE    3
         SPACE    1
         DEF      OPN
         SPACE    2
         REF      DCBNCHK,GETFUNA
         REF      CHKBIT
         REF      GETFUN
         REF      OPNDEV#
         REF      PULLEXIT,PULLEXIT1
         REF      PUSHALL
         REF      RESBTD
         REF      SAVRSZ
         REF      XFF
         REF      Y001
         REF      Y01
         REF      Y002
         REF      OERX
         REF      OPNX
         REF      MSRMOVE
         OPEN     TDA
TDA      EQU      5
         REF      LOCCODE
         REF      Y04
         REF      J:JIT
         REF      J:CPPO
         REF      Y00FF
         REF      Y00FE,Y08
         REF      Y004
         REF      SETFUNCN
         REF      M16
         REF      S:CUN
         REF      CFUSIZE
         REF      CHKFLACN
         LW,1     0
         B        OPNTV,1
OPNTV    EQU      %
         B        MSROPN
         B        OPNER
         SPACE    3
         SPACE    3
*        R5 = JIT ADDRESS
*        R6 = DCB ADDRESS
*        R7 = ADR OF PARAMETER LIST
*        CALLING SEQUENCE--BAL,SR4 MSROPN
*
MSROPN   EQU      %
         BAL,R1   PUSHALL
         LI,SR3   X'2E'             OPEN AN OPEN DCB
         LW,D2    Y002              IS DCB ALREADY OPEN
         LS,D2    FCD,R6
         BNEZ     OERX
         LI,R4    X'20000'          PRESERVE SHARE
         AND,R4   QBUF,R6            FROM OPN PRIME, ETC.
         STW,4    QBUF,R6
         LW,2     -1,7              ADD XFPT FLAG TO R4
         AND,2    BT31TO0+18
         LW,4     0,7               F'S & A & V
         AND,4    M16
         OR,4     2
         CI,4     X'22000'          CHK A OR XFPT
         BAZ      %+2               BRANCH IF STANDARD
         AI,7     1                 NON-STANDARD
         BAL,R2   CHKBIT0
         REF      CHKBIT0
         STS,D1   ERA,R6            ERROR ADDRESS IS PRESENT
         BAL,R2   CHKBIT            CHECK FOR ABNORMAL ADDRESS
         STS,D1   ABA,R6            STORE ABNORMAL ADDRESS
         BAL,R2   CHKBIT            CHECK FOR BUFFER ADDRESS
         STS,D1   BUF,R6            STORE BUFFER ADDRESS
         BAL,R2   CHKBIT            CHECK FOR RECORD LENGTH
         BAL,R0   SAVRSZ
         LI,R3    BANRA
         BAL,R2   CHKBIT            CHECK FOR TRIES
         STB,D1   *R6,R3            NUMBER RECOVERY TRIES ALLOWED
         BAL,R2   CHKBIT            CHECK FOR ORGANIZATION
         BAL,R0   MSROPN51
         LI,D2    K7                ACS NOW 3 BITS
         BAL,R2   CHKBIT            CHECK FOR ACCESS
         STS,D1   ACS,R6            STORE FILE ACCESS
         BAL,R2   CHKBIT            CHECK FOR FUNCTION
         BAL,R0   SETFUNC
         BAL,R2   CHKBIT            CHECK FOR GENERATION NUMBER
         NOP                        GEN NOT IMPL.
         BAL,R2   CHKBIT            CHECK FOR FILE OPTION
         BAL,R0   MSROPN52
         LI,D2    K1FFFF            NEW MASK
         BAL,R2   CHKBIT            CHECK FOR USELB
         STS,D1   FPARAM,R6
         BAL,R2   CHKBIT            CHECK FOR TAPE LABEL ADDRESS
         STS,D1   TLB,R6            STORE TAPE LABEL
         LI,R3    BAKEYM
         BAL,R2   CHKBIT
         STB,D1   *R6,R3            MAXIMUM KEY LENGTH
         BAL,R2   CHKBIT
         BAL,R0   MSROPN5           DEVICE OPTION
         BAL,R2   CHKBIT            BYTE DISPLACEMENT
         BAL,R0   RESBTD
        LI,R3    BACOS             REEL NO
         BAL,R2   CHKBIT
        STB,D1   *R6,R3
         LW,D1    RLIM,R6           MERGE ASSIGN VALUE OF RSTORE
         SLD,D1   -16
         CI,D1    '><'
         BNE      %+3
         SLS,D2   -16
         STW,D2   RSTORE,R6
         BAL,R2   CHKBIT            NEWX
         BAL,R0   SETNEWX
         BAL,SR4  CHKANS1
         B        %+3
         LI,R3    BACONCAT          CONCATINATION
         B        %+2
         LI,R3    BASPARE           SPARE
         BAL,R2   CHKBIT            SPARE
         STB,D1   *R6,R3
         SLS,D3   1
         BAL,R2   CHKBIT            GET FPT VALUE OF RSTORE
         B        LRECL             IS SPECIFIED, INSERT
         B        NRSTOR            NOT, SKIP
NOTLRECL EQU      %
         LI,D2    X'FFFF'
         STS,D1   RSTORE,R6         RT. 16 BITS TO RSTORE
         AND,D1   Y00FF             EXTENDED
         BEZ      %+2               NO
         AW,D1    Y08               YES, SET THE FLAG
         LW,D2    Y08FF             GET MASK
         STS,D1   NLR,R6            AND PUT THE REST IN NLR
NRSTOR   EQU      %
         CI,4     X'22000'          MORE PARAMS IF EXTENDED FPT
         BAZ      ENDP
         BAL,R2   CHKBIT
         B        P21               P21...DENSITY
CHK22    EQU      %
         BAL,R2   CHKBIT
         B        P22
CHK23    EQU      %
ENDP     EQU      %
         BAL,SR4  CHKASN
         CI,SR4   3
         BE       CAL11N3           BYPASS FOR DEVICE
         STH,R4   D3
         SLS,D3   -2                FLAGS
         LW,D4    Y01
         STS,D3   NXTF,R6
         LI,R2    0
         STW,R2   DESC,R6           ZAP THE SEARCH OPN MASK
         LW,R2    Y004              RESET NOSEP BIT IF DCB
         LI,R3    X'200'            NOSEP BIT
         AND,R2   FCD,R6            HAS BEEN OPENED BEFORE
         BEZ      %+2
         STS,R2   NOSEP,R6
         LI,R3    X'40000'          NXTA
         LI,D2    X'20000'          CYL
         LI,D4    X'200'            NOSEP
         LI,R5    -3
         CI,R4    X'22000'          IF ADJ DCB OR EXTENDED FPT
         BAZ      %+2
         LI,R5    -7                SKIP EXTRA WORD
         LC       *R7,R5
         BCR,2    %+2
         STS,D2   CYL,R6
         BCR,4    %+2
         STS,D4   NOSEP,R6
         BCR,8    %+2
         LI,R2    X'40000'
         STS,R2   NXTA,R6
*        SET BRS FROM FPT WD 0, BIT 12 TO INDICATE TEST FILE
         LI,R2    -1
         CI,R4    X'22000'
         BAZ      %+2
         LI,R2    -2
         LW,R2    *R2,R7
         BAL,SR4  CHKANS1
         B        NOABCERR
         CW,R2    Y001              ANS FPT BIT
         BAZ      NOABCERR          NO
         LI,R5    X'800'            ANS DCB BIT
         STS,R5   ABCERR,R6
NOABCERR EQU      %
         SLS,R3   1
         STS,R2   TSTF,R6           REALLY BRS, USED HERE FOR TEST FILE FLAG
         AND,R2   R3
         BEZ      %+3
         LI,D1    1
         BAL,R0   SETFUNCN         FORCE IN MODE FOR TEST FILE
*
*        ANALYZE FILE DEPENDENT OPTIONS
*        THESE MUST BE MERGED WITH M:DCB AND !ASSIGN OPTIONS
*
*
CAL11N3   EQU     %
         REF      J:DCBLINK
         LI,R2    X'1FFFF'
         AND,R2   J:DCBLINK
         BEZ      CAL11N9           NO DCBS
         LI,R3    X'E0000'
CAL11N4  CW,R3    2,R2
         BANZ     CAL11N5
         BDR,R2   CAL11N6
         AI,R2    1
CAL11N5  CW,R3    3,R2
         BAZ      CAL11N6
         B        %-3
CAL11N6  CW,R6    3,R2
         BNE      CAL11N8
         AI,R2    1
         LW,R3    TSTACK
         STW,R2   -4,R3  DCB NAME ADDR TO R8 IN STACK
         B        CAL11N9
CAL11N8  AI,R2    3
         CW,R3    1,R2
         BANZ     CAL11N4
         LW,R2    1,R2
         BNEZ     CAL11N4
CAL11N9  RES      0
         CI,4     X'2000'           CHK A
         BAZ      %+5               STANDARD
         CI,4     X'4000'
         BAZ      MSROPN7P          NO VARIABLE STUFF
         LW,2     4
         B        %+4
         LI,R2    K3FF
         AND,R2   R4
         BEZ      SETFUN            NOVARIABLE%SINCE STAND,THEN NO DEV
*                                   MERGE FILE PARAMETERS
         LI,D3    K1FFFF            DID USER PREALLOCATE SPACE FOR FILE
         AND,D3   FLP,R6            PARAMETERS
         BEZ      MSROPN7G          NO SPACE FOR VARIABLE
         REF      M3
         AND,R2   M3
*        IF ASN CHANGES, ZAP CYL BIT IF NOT SPECIFIED IN OPEN FPT
         BEZ      MSROPN10          ASN NOT SPECIFIED
         CI,R2    5                 ANS FPT CODE
         BNE      %+2
         LI,R2    X'A'              ANS DCB CODE
         LI,R3    X'F'
         CS,R2    ASN,R6            IS ASN THE SAME IN FPT AS DCB
         BE       MSROPN09          YES, LEAVE CYL ALONE
         LI,R5    -3
         LC       *R7,R5            WAS CYL SPEC IN FPT
         BCS,2    MSROPN09          YES, LEAVE IT ON
         AI,R3    DCBCYLBIT         NO, ZAP IT
MSROPN09 STS,R2   ASN,R6
*                                   READY TO MERGE
*                                   R1 = DIS IN PLIST
*                                   R2 = DIS IN MONITOR BUF
*                                   D3 = NEW BUFFER ADR
*                                   D4 = FLP ADR
MSROPN10 AW,R7    R1                SKIP TO VLP'S IN FPT
         LI,D1    X'15'             VLP'S 1-X'15'
         LW,R1    R4                SAVE WORD1
MSROPN11 EQU      %
         BAL,R4   LOCCODE           DID WE FIND CODE
         B        MSROPN99          DIDNT FIND
*                                   FOUND
         CI,D1    X'12'             SEARCH OPEN VLP CODE
         BNE      MSROPN11A         NO
         LI,R2    2                 BYTE INDEX
         LB,R2    D2,R2             # OF WORDS
         BEZ      MSROPN12          =0,  NOT PRESENT
         AW,R3    R7                ADDRESS OF VLP
         LW,R3    1,R3              PICK UP MASK
         STW,R3   DESC,R6           SAVE IT
         B        MSROPN12          AND CONTINUE
MSROPN11A EQU     %
         CI,D1    9                 IF 9 CODE, SET PYRAMID PARAMETERS
         BNE      MSROPN12
         AW,R3    R7
         LW,R3    1,R3
         STW,R3   WRDL0,R6
MSROPN12 EQU      %
         LI,R2    -16
         CI,D1    7
         BE       %+2               LEAVE OUTSN FOR LATER
         STB,D1   *TSTACK,R2        VLP CODE TO B0 OF R8
         LW,R2    R3                SAVE DISP
         XW,D3    R7
         BAL,R4   LOCCODE
         B        MSROPN99A
MSROPN98B EQU     %
         LD,R4    R2
         SLD,R4   2                 CONVERT TO BTD
         AI,R5    KN1
         AI,R4    KN2
         LB,R0    *D3,R4            USER SIZE CANT BE LARGER THAN
         CB,R0    *R7,R5            RESERVED AREA
         BLE      MSROPNA1
         LB,R0    *R7,R5
MSROPNA1 EQU      %
         AI,R5    KN1
         STB,R0   *R7,R5
         LW,R4    R2
         XW,R2    R3
         XW,D3    R7
         BAL,SR1  MSRMOVE
         LW,R2    R4                RESTORE FPT:VLP DISPLACEMENT
         XW,D3    R7
         AI,D1    0                 CHK FOR 2ND PASS FOR FPT:VLP
         BG       MSROPN99A         NO
         AI,D1    9                 RESTORE 2NDARY CODE
MSROPN98D EOR,D1  XF                RESTORE ORIGINAL CODE
         REF      XF
MSROPN98A XW,D3   R7                RESTORE PLIST POINTERS
MSROPN99 EQU      %
         BDR,D1   MSROPN11
*        CLEAR FILE OPENED FLAG IF FNAME VLP IN FPT
         BAL,SR4  DCBNCHK
         B        MSROPN99B
         CI,SR1   1
         BNE      MSROPN99B
*                   SKIP F.E. CLEAR IF STEP'S ADJ DCB
         REF      UH:FLG
         LW,R4    S:CUN
         LH,R4    UH:FLG,R4
         CI,R4    X'4000'
         BAZ      MSROPN99C             NOT STEP
         CI,R1    X'2000'
         BANZ     MSROPN99B             STEP'S ADJ DCB
MSROPN99C EQU     %
         LI,D1    0
         STS,D1   J:CPPO
MSROPN99B EQU     %
         LW,R4    R1
         B        MSROPN7
MSROPN99A EQU     %
         CI,D1    8                 IF NEITHER SN, SKIP
         BG       MSROPN98A
         CI,D1    7
         BL       MSROPN98A
         LI,R4    -16
         LB,R4    *TSTACK,R4
         EOR,R4   D1
         CI,R4    X'F'
         BE       MSROPN98A
         EOR,D1   XF
         BAL,R4   LOCCODE
         B        MSROPN98D
         AI,D1    -9
         B        MSROPN98B
MSROPN7G EQU      %
         AW,R7    R1                SKIP TO VLP'S IN FPT
MSROPN7  EQU      %
         CI,R4    X'2000'
         BAZ      SETFUN
         CI,R4    X'1000'
         BAZ      OPNPXIT           OUT-NO DEV INFO
         LI,D1    X'C'
         BAL,R4   LOCCODE
         AND,D2   XFF
         AW,R3    D2
         AW,R7    R3
         B        OPNPDV1
*  OPEN' PLIST    NO VARIABLE
MSROPN7P EQU      %
         AW,R7    R1
         CI,R4    X'1000'
         BAZ      OPNPXIT           OUT-NO DEV INFO
*  DEVICE ORIENTED FPT
OPNPDV1  EQU      %
         REF      CHKBIT1
         BAL,2    CHKBIT1
         B        %+2
         B        OPNPDV2
         LCI      4
         LM,SR3   1,7
         STM,SR3  15,6
         AI,R1    3
OPNPDV2  EQU      %
         SLS,D3   1
         BEV      OPNPDV3
         LW,D1    *7,R1
         STW,D1   21,6              SEQUENCE ID
         LW,R3    Y04
         STS,R3   5,6
         AI,R1    1
OPNPDV3  EQU      %
         LI,R3    4*19
         BAL,R2   CHKBIT
         STB,D1   *6,R3             DATA TAB
         LI,D2    X'E0000'
         BAL,R2   CHKBIT
         B        %+2
         B        %+3
         SLS,D1   24
         STS,D1   14,6              COUNT TAB
         BAL,R2   CHKBIT
         B        %+2
         B        OPNPDV5
         LI,D2    X'1FFFF'
         STS,D1   19,6              HEADER ADR
         LB,D1    D1
         LI,R3    4*20
         STB,D1   *6,R3             AND HEADER TAB
OPNPDV5  EQU      %
         LI,D2    X'E0000'
         BAL,R2   CHKBIT
         B        %+2
         B        %+3
         SLS,D1   17
         STS,D1   10,6              LINES PER PAGE
         LW,D2    Y00FE
         BAL,R2   CHKBIT
         B        %+2
         B        %+3
         SLS,D1   17
         STS,D1   19,6              SPACE
         BAL,R2   CHKBIT
         B        %+2
         B        OPNPXIT           NO P8 BITS
         LW,D3    D1
         SLS,D3   9
         LW,R3    D1
         BAL,R2   CKBTGP
         LI,D2    X'8000'           BIT 16
         SLS,D1   25-16
         STS,D1   0,6               DRC
         BAL,R2   CKBTGP
         LI,D2    X'20000'          BIT 14
         SLS,D1   26-14
         STS,D1   0,6               BCD
         BAL,R2   CKBTGP
         LI,D2    X'200'            BIT 22
         SLS,D1   27-22
         STS,D1   0,6               PACK
         BAL,R2   CKBTGP
         LW,D2    Y08               BIT 4
         SLS,D1   28-4
         STS,D1   5,6               SEQ
         BAL,R2   CKBTGP
         LI,D2    X'4000'           BIT 17
         SLS,D1   29-17
         STS,D1   0,6               FBCD
         BAL,R2   CKBTGP
         LI,D2    X'100'            BIT 23
         SLS,D1   30-23
         STS,D1   0,6               VFC
         BAL,R2   CKBTGP
         LI,D2    X'4000'           BIT 1M
         SLS,D1   31-17
         STS,D1   1,6               L
OPNPXIT  EQU      OPNX
         B        OPNX
CKBTGP   EQU      %
         SLS,D3   1
         BEV      3,R2
         LW,D1    R3
         B        0,R2
SETFUN   EQU      %
*                                   SET IT TO INPUT
         BAL,D2   GETFUN
         BNEZ     SETFUN1           USER SPECIFIED FUNCTION
         LI,D1    K1
SETFUN1  EQU      %
         LCW,D2   D1
         AND,D1   D2                CLEAR EXTRA BITS
         LI,D2    X'EFFFF'
         AND,D2   ASN,R6            RESET EXT
         CI,D2    8                 CHK ANS
         BANZ     %+2               YUP
         AND,D2   NB31TO0+12        RESET PRIV
         STW,D2   ASN,R6
         BAL,R0   SETFUNCN
*                                   DID PLIST ASSIGN TO FILE
*                                   SET FUNCTION COUNT TO ZERO
*                                   IN CASE I/O IS TO BE DONE DURING
*                                   OPEN
         LI,R2    BAFCN
         STB,D2   *R6,R2            NO ACTION
         LI,R2    X'F'
         AND,R2   ASN,R6
         BEZ      OPENER01          BAD ASN, NOT SET
         ANSB     ANS%ASN
NOTANSDCB EQU     %
         AI,R2    KN4
         BLEZ     MSROPN21,R2
         B        OPENER01
         REF      OPENER01
*
*
SETNEWX  LI,D2    X'FFFF'
         SLD,D1   8
         STS,D1   WRDL0,R6
         B        *R0
*
LRECL    EQU      %
         BAL,SR4  CHKANS1
         B        NOTLRECL
         SLS,D1   17
         LI,D2    X'E0000'
         STS,D1   LRCSZ,R6
         B        NRSTOR
*
CHKANS1  EQU      %
*                      RETURNS SKIPPING IF DCB WILL BE ANS AFTER
*                         FPT MERGE
         PUSH     SR4
         BAL,SR4  CHKASN
         CI,SR4   5
         BGE      PULLEXIT1         ANS
         B        PULLEXIT          NOT ANS
         SPACE    2
CHKASN   EQU      %      RETURNS FPT:ASN IF NON-ZERO, ELSE RETURNS
*                                   DCB:ASN
         PUSH     SR4
         LI,SR4   X'7'
         AND,SR4  R4
         BNEZ     PULLEXIT
         LI,SR4   X'F'
         AND,SR4  ASN,R6
         B        PULLEXIT
         SPACE    3
*
ANS%ASN  EQU      %
         CI,R2    X'A'
         BNE      NOTANSDCB
*
MSRLBT   EQU      %
         LW,D1    0,6
         AND,D1   NB31TO0+23        CLEAR FCI
         STW,D1   0,6
         REF      M6,TB:FLGS,SV:DFTP
         LI,1     BADEVTP
         LB,4     *6,1              TYPE
         AND,4    M6
         LC       TB:FLGS,4         KIND OF DEVICE
         BCR,8    %+2               NOT TAPE
         BCR,4    DTAPE
         LI,4     X'80'+SV:DFTP     DEFAULT
         STB,4    *6,1              TYPE
DTAPE    RES      0
MSRLBT1  BAL,D2   GETFUNA
         BANZ     %+2
         B        OPNLA
         B        OPNLO
         B        OPNFIL
         B        MSRLBT
         B        OPENDEV
MSROPN21 RES      0                 OPENCOR
*
*        DCB ASN = 4, COMMON JOURNAL TYPE
*
         REF      BGRCFU,ACNCFU,GETACNADR,GETFILADR
CFU#CJ   EQU      16                JOURNAL CFU TYPE
*
         BAL,R0   CHKFLACN
         BAL,R0   GETFILADR         A(FILENAME)
         XW,R7    KBUF,R6           AND SAVE IN KBUF
         PUSH     R7                TEMPORARILY
         BAL,SR1  SCANJRNLCFU       LOOK FOR JRNL IN CFUS
         LI,SR1   0                 NOT FOUND RETURN
         PULL     R7                FOUND RETURNS HERE
         STW,R7   KBUF,R6           RESTORE KBUF
         AI,SR1   0                 DID WE FIND IT
         BEZ      OPENER            NO, OPEN ERROR
         LI,D4    X'1FFFF'
         STS,D3   11,R6             SAVE CFU ADDRESS
         MTH,2    *D3               INCREMENT USE COUNT
         LI,D1    2
         BAL,R0   SETFUNCN          SET FUNCTION
         LW,D4    Y002
         STS,D4   FCD,R6            SET DCB OPEN
         B        OPNX              AND RETURN
*
*        SCAN THE CFU'S FOR A COMMON JOURNAL CFU
*
SCANJRNLCFU EQU   %
         LI,R2    BGRCFU            START OF CFU'S
         LW,R1    ACNCFU+13
         AI,R1    -BGRCFU-8
         SLS,R1   -3                NUMBER OF CFU'S
*
SCANCONT EQU      %
         LI,R7    2
         LB,R3    *R2,R7
         CI,R3    CFU#CJ            JOURNAL CFU TYPE
         BE       JRNLFND           YES
NOMATCH  EQU      %
         AI,R2    CFUSIZE
         BDR,R1   SCANCONT
         B        *SR1              NOT FOUND EXIT
*
JRNLFND  EQU      %
         PUSH     2,R1
         BAL,R0   GETACNADR         A(ACCOUNT)
         PULL     2,R1
         LW,D1    0,R7              ACCT NAME
         LW,D2    1,R7
         LW,R5    KBUF,R6           A(FILENAME)
         SLS,R5   2
         LB,R4    0,R5              BYTE COUNT
         AI,R4    1
         STB,R4   R5                SET UP FOR CBS
         LI,R7    4
         LI,R4    5
         LH,R3    *R2,R7            DW INDEX TO ACCT
         CD,D1    *ACNCFU+13,R3
         BNE      NOMATCH           NOT THIS JRNL CFU
         LH,SR3   *R2,R4
         SLS,SR3  2                 BA(FILENAME
         LW,SR4   R5
         CBS,SR3  0                 CHECK FILENAMES
         BNE      NOMATCH           NOT THIS JRNL CFU
         LW,D3    R2                CFU ADDR TO R14
         AI,SR1   1
         B        *SR1              FOUND CFU RETURN
*
OPENER   LI,SR3   K3
         B        OPNER             OPEN ERROR
*
*
SETFUNC  CI,D1    X'200'            CHK P BIT
         BAZ      SETFUNCN          NOT ON
         LW,R2    D1
         LI,R3    X'100'
         SLD,R2   9
SHARE    EQU      7
         STS,R2   SHARE,R6          STUFF THE S BIT
         B        SETFUNCN
*
*
MSROPN52 LI,D2    3
         SLD,D1   30                REL/SAVE
MSROPN53 STS,D1   FIL1,R6
         B        *R0
MSROPN51 LI,D2    X'70'
         SLS,D1   4
         DO       ORG=FIL1
         B        MSROPN53
         ELSE
         STS,D1   ORG,R6
         B        *R0
         FIN
P21      EQU      %
         SCS,D1   -6                HANDLE P21...DENSITY
         LW,D2    Y04
         STS,D1   DENS,R6
         B        CHK22
P22      EQU      %
         SLS,D1   7
         LI,D2    X'80'
         STS,D1   ACS,R6
         B        CHK23
MSROPN5  RES      0
         LW,3     0,6
         AND,3    NB31TO0+23        RESET FCI
         STW,3    0,6
         LW,R3    D1
         AI,D1    X'10000'
         CI,R3    X'18000'
         BAZ      KRD1              DIAGNOSTIC OPEN
         LI,3     X'18000'
         CS,3     D1
         BNE      6G2               NOT TEXT
         LI,2     OV:NMSZ
         LI,D2    X'FFFF'
         LH,3     OH:NM,2
         CS,D1    3
         BE       6G4               FIND
         AI,2     -1
         BGEZ     %-4
         LI,D1    X'FF'             ILLEGAL OPLB
         B        6G2
6G4      LI,D1    0
         CI,2     LAXOP             LOGICAL OPLBX
         BGE      LAXI
         REF      JTX
         LB,3     J:JIT
         SLS,3    -6
         LW,3     JTX,3             OB:-TX
         LB,2     *3,2              GET ASSIGNMENT
         CI,2     DCTSIZ
         BLE      6G5               DEVICE
         AI,2     -LAX
         BG       6GL               LOGICAL
         AI,2     -DCTSIZ-1+LAX     RATX
         LB,D1    SB:RTY,2          DEVICE
         LI,2     0                 RAT=0
         B        %+2               DEVICE+RAT
6G5      LB,D1    DCT4,2
         AI,D1    X'80'
6GX      RES      0
         SLS,D1   8
         AW,D1    2
6G2      RES      0
         LI,R3    X'3F00'
         AND,R3   D1                TYPE CODE
         SLS,R3   -8
         LC       TB:FLGS,R3        LISTING TYPE DEVICE
         BCS,8    KRD1              NO
         BCR,4    KRD1              NO
         OR,D1    BT31TO0+15  YES-SET LISTING BIT
KRD1     EQU      %
         LI,R2    BARNDEV
         STB,R3   *R6,R2            SAVE DEVICE TYPE
         LI,D2    X'1FFFF'
         STS,D1   DSI,R6
         LB,R3    TB:FLGS,R3
         AND,R3   =X'C4'
         CI,R3    X'80'
         BNE      NOT7T             DEVICE NOT 7T TAPE
         LI,R3    X'20200'          DEFAULT PACKED,BIN FOR 7T
         STS,R3   0,R6
NOT7T    EQU      %
         LI,D2    KF
         LI,D1    K3
         DO       ASN=EGV
         B        SETTYC2
         REF      SETTYC2
         ELSE
         STS,D1   ASN,R6
         B        *R0
         FIN
LAXOP    EQU      OV:NMSZ-SV:LSIZ
LAX      EQU      DCTSIZ+SV:RSIZ+2
LAXI     AI,2     -LAXOP
6GL      RES      0
         LB,D1    SB:LTY,2
         AI,2     LAX
         LW,3     Y004
         STS,3    0,6               SET FCI
         B        6GX               PUT IT AWAY
         REF      SB:LTY
Y08FF    GEN,8,8,16 8,X'FF',0
         B        OPNCOR
         REF      OPNCOR
OPNLA    OVERTO   OPNTPSEG,OPNLA#
OPNLO    OVERTO   OPNTPSEG,OPNLO#
         REF      OPNTPSEG,OPNLA#,OPNLO#
OPENDEV  OVERTO   MULSEG,OPNDEV#
         REF      MULSEG,OPNFIL
         END      OPN

