MONPROC  SET      1
DISCBPROC SET     2                                                     DISCB
BITS     SET      1
         SYSTEM   UTS
         PCC      0
PV:      RES
         DEF      PV:               PATCHING DEF
*M*      PV       PRIVATE PACK OPEN/CLOSE/SWITCH LOGIC
         PAGE
         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
R8       EQU      8
R9       EQU      9
R10      EQU      10
R11      EQU      11
R12      EQU      12
R13      EQU      13
R14      EQU      14
R15      EQU      15
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
         SPACE    2
*        DEFS
         DEF      CLOSEPV           DETACH VOLUME FROM DCB (AND MAYBE USER)
         DEF      PVERR             PRIVATE VOLUME SUA
         DEF      CLSVNO            DETACH ALL VOLUMES FROM DCB
         DEF      SWXPV             CONSEC FILE SWITCH DCB TO OTHER VOL.
         DEF      OPV               ATTACH VOLUME(S) TO DCB (AND USER)
*        REFS
         REF      ACCN              SCRATCH FILE ACCOUNT VERIFICATION
         REF      ACNCFU            (+13) DISMOUNT LOGIC - REMOVE CFUS
         REF      ASPIN             RESET SPIN BIT IN JIT
         REF      AVRID             MOUNT MODE
         REF      AVRNOU            >=0
         REF      AVRTBL            SERIAL# AND FLAGS
         REF      AVRTBLNE          SIZE OF AVRTBL
         REF      AVRTBLSIZ         SIZE OF AVRTBL (TAPE PART)
         REF      BATAPE            AVRX <=> DCTX
         REF      BGRCFU            DISMOUNT LOGIC - REMOVE CFUS
         REF      CFUSIZE           DISMOUNT LOGIC - REMOVE CFUS
         REF      CHKCUR            CHECK USERS ABILITY TO GET PACKS
         REF      CLEARHI           SET SPIN BIT IN JIT - CLEAR CHKCUR FLAG
         REF      CLRBBUF           BUFFER MANAGEMENT FOR RDVTOC
         REF      DCT16             MESSAGE GENERATION
         REF      DCT3              PARTITIONED CHECKS
         REF      DCT4              DEVICE TYPE CHECKS
         REF      DERES             RELEASE TEMPORARILY ALLOCATED SPINDLE
         REF      DHHIT             CHECK PRIOR ASSOCIATION
         REF      E:SL              WAIT FOR VERIFICATION, MOUNT
         REF      GETBBUF           BUFFER MANAGEMENT FOR RDVTOC
         REF      GETFUN            OUTPUT ACCOUNT INITIALIZATION
         REF      GETORG            ORG CHECKS
         REF      GETOVC            CHECK/CLOSE ALL OPEN VOLS
         REF      GETSEC            BUFFER FOR ACCOUNT CHECK
         REF      GETSNADR          FIND SERIAL #S IN DCB
         REF      GETVDCTX          DEVICE MANIPULATION
         REF      GETVNO            GETVNO
         REF      HGP               MOVE BITMAP TO VTOC
         REF      HOWALO            JOB TYPE OF ORIGINAL USER
         REF      IOSPIN            WAIT FOR IO TO FINISH
         REF      J:BASE            TEMP AREA
         REF      J:DCBLINK         SEARCH FOR DCBS OPEN TO VOLUME
         REF      J:JIT             CHECK JOB TYPE
         REF      J:RNST            CHECK IF M:LINK OCCURRED
         REF      JB:CUR            USER RESOURCE COUNTS
         REF,1    JB:PMTS           COUNT PACK MOUNTS
         REF,1    JB:SLNK           SHARED SERIAL# CHAIN HEAD
         REF,1    JB:XLNK           EXCLUSIVE SERIAL# CHAIN HEAD
         REF      LPART             SEARCH RUNNING BATCH JOBS
         REF      LSERIAL           RUN SERIAL# CHAINS
         REF      MBSOP#            SEARCH RUNNONG BATCH JOBS
         REF      MSGOUT            TALK TO OPERATOR
         REF      MSROCTY           TALK TO OPERATOR
         REF      NXTVOL            OPEN ALLVOLS FOR KEYED/RANDOM
         REF      PLB:MIN           SEARCH RUNNING BATCH JOBS
         REF      PLX1SR4           SUBROUTINE EXIT
         REF      PULLEXIT          SUBROUTINE EXIT
         REF      PULLEXIT1         SUBROUTINE EXIT
         REF      PVQUEUE           READ ACCOUNT DIRECTORY
         REF      QUEUE             READ/WRITE VTOCS
         REF      RAT:DCT4          GET RESOURCE TYPE
         REF      RESBLK            DCB MANAGEMENT FOR READ/WRITE
         REF      RSERIAL           CHECK RESOURCE TYPE
         REF      RWREX             DCB MANAGEMENT FOR READ/WRITE
         REF      S:CUN             CURRENT USER
         REF      S:MBSF            KICK BATCH SCHEDULER
         REF      SAVCBD            DCB MANAGEMENT FOR READ/WRITE
         REF      SETPVI            POINT DCB TO VOLUME
         REF      SETSPIN           SET S:ASPIN BIT FOR FIRST USER
         REF      SETVNO            PUT VOLUME IN DCB
         REF      SETVNO1           PUT VOLUME 1 IN DCB
         REF      SH:RBCU           GIVE BACK SHARED SLLOCATION
         REF      SH:RGCU           GIVE BACK PUBLIC MOUNT ON ERRORS
         REF      SOLICIT           INDICATE REQUEST TO KEYIN
         REF      SV:RSIZ           SEARCH RUNNING BATCH JOBS
         REF      T:REG             WAIT FOR VERIFICATION/MOUNT
         REF      TSERIAL           SEARCH SERIAL# CHAINS
         REF      U:MISC            WAIT FOR VERIFICATION/MOUNT
         REF      UH:DL             CHECK FOR YC/BRK/ERR/ABRT
         REF      USECHK2           CHECK USERS ABILITY TO GET PACKS
         REF      WRTSEC10          UPDATE ACCOUNT DIRECTORY IF NO NAME
         REF      YFF               SEARCH DCB NAME CHAIN
         REF      Y0A               FLAG BITS
         REF      Y06               FLAG BITS
*
K0       EQU      0
K2       EQU      2
KA       EQU      10
K1FFFF   EQU      X'1FFFF'
         TITLE    '**** CLOSEPV ****'
*DO*
*F*
*        NAME:    CLOSEPV
*
*        PURPOSE: TO TERMINATE A DCB'S USE OF A PRIVATE VOLUME
*
*        DESCRIPTION: THE DCB IS DETACHED FROM THE VOLUME.
*         THE USER IS ALSO DETACHED IF CALLED FROM SWXPV OR NONE
*         OF THE FOLLOWING IS TRUE:
*          1. THE CAL IS M:CLOSE WITHOUT REMOVE
*          2. THE USER HAS OTHER DCBS OPEN TO THE VOLUME
*          3. THE USER IS BATCH AND THE VOLUME IS SHARED
*          4. THE USER IS NOT AT LEVEL-0 OF LDLNKS AND AVRNOU>1
*FIN*
*D*      NAME:    CLOSEPV
*D*      INTERFACE: SETPVI,RDVTOC,WRVTOC,CLRBBUF,GETSNADR,GETOVC,GETVNO
*D*               RAT:DCT4,ASPIN,HOWALO,MSGOUT,GETVDCTX
*D*      DESCRIPTION: THE VTOC IS UPDATED IF IT HAS CHANGED.
*D*               THE PUSHALL IS EXAMINED TO DETERMINE CAL TYPE AND OPTIONS
*D*               IF A REMOVE IS TO BE EFFECTED, THE OTHER DCBS ARE CHECKED
*DO*
*D*               TO MAKE SURE THE VOLUME IS NOT IN USE.
*        INPUT:   R6=DCB ADR
*                 DCB:VNO=THE VOLUME NO. OF THE VOLUME BEING CLOSED
*                 DCB:PAT AND DCB:VDCTX MAY NOT POINT TO THE VOLUME
*                         IN VNO
*                 DCB:OVC=A COUNT OF THE NO. OF OPENED VOLUMES
*                 ALL DATA HAS BEEN WRITTEN TO THE VOLUME (BBUD,MIUD=0)
*
*        CALL:    BAL,R0  CLOSEPV
*
*        OUTPUT:  DCB:OVC DECREMENTED
*                 AVRNOU  (OF THE AVRTBL ENTRY ASSOCIATED WITH THE VOL)
*                         IS DECREMENTED
*                 THE VOLUME'S CYLINDER BIT MAP IS WRITTEN ONTO THE VTOC
*
*        REGS:    ALL REGISTERS NONVOLATILE
*FIN*
CLOSEPV0 OR,0     Y8                ENTRY FROM SWITCH
CLOSEPV  EQU      %
         PUSH     16,R0
         LI,R3    BAOVC             DECR OVC NOW TO PREVENT LOOPS
         MTB,-2   *R6,R3
         BNC      CPV35             WENT NEGATIVE
         BAL,D4   SETPVI           *LOCATE AVRTBL ENTRY AND SET
*                                   DCB:PAT AND DCB:VDCTX
*                                   UPDATE VTOC CYLINDER BIT MAP
         PUSH     R2                SAVE VOLUME'S DCT INDEX
         LW,R3    Y8                IF NOT UPDATED, DONT
         EOR,R3   6,R7
         BLZ      CPV25
         STW,R3   6,R7
         BAL,R0   RDVTOC                READ VTOC INTO BUF1
         B        CPVVTOCERR        ERROR
         LW,R7    PAT,R6                R7=AT ADR
         LW,R0    BUFF1             IS IT A VTOC
         CW,R0    T:LBL
         BNE      CPVVTOCERR        NO, GIVEIT UP
         INT,R3   VTOC:MAPWL+BUFF1     *MOVE ALLOCATION TABLE BIT MAP
         LI,R2    9                     AND NVAT TO VTOC
         CH,R3    *R7,R2
         BG       CPVVTOCERR        SCREWED UP SOMEWHERE
CPV10    AI,R3    VTOC:BITMAP-VTOC:NVAT R3=NO. OF WORDS BEING MOVED
         AI,R7    AT:NVAT-1             R7=ADR OF AT:NVAT-1
CPV20    LW,R0    *R7,R3
         CW,R0    BUFF1+VTOC:NVAT-1,R3 DONT WRITE IF UNCHANGED
         BE       %+2
         OR,R5    Y8                SET UPDATED BIT
         STW,R0   BUFF1+VTOC:NVAT-1,R3
         BDR,R3   CPV20
         STS,R5   BUFF1             SET UPDATED FLAG IF UPDATED
         BAL,R0   WRVTOC            WRITE IF UPDATED
         B        CPVVTOCERR        ERROR
CPV25    RES
         BAL,0    CLRBBUF           AND RELEASE BUFFER
         PULL     R2                R2=ADR OF VOLUME'S AVRTBL ENTRY
         AI,R2    -BATAPE           GET AVRX
         MTH,-1   AVRNOU,2             *DECREMENT THE VOLUME'S NO. OF
         BGZ      CPV40                 USERS COUNT AND THE DCB'S # OF
CPV35    EQU      %                     OPEN VOLUME'S COUNT
         BAL,SR4  PVERR0
CPV40    RES
         LW,7     TSTACK            GO LOOK AT THE PLIST
         AI,7     -16               IF THE CAL IS A CLOSE
         LW,8     1,7               CEHCK IF CALLED BY SWXPV
         BLZ      CPV50             YES, ALWAYS REMOVE
         AI,7     -1
         CW,7     1,7
         BNE      %-2               FIND THE PUSHALL
         LW,8     -3,7              OP CODE
         CI,8     X'15'             IS IT CLOSE
         BNE      CPV100            NO, DISMOUNT UNLESS TSTF
         LW,7     -4,7              PLIST+1 ADDR
         LW,7     0,7
         CI,7     X'20'             REM OPTION
         BAZ      CPV80             NO, LEAVE IN USE
CPV50    LD,14    AVRTBL,2          GET AVR ENTRY
         LI,9     2                 MIN VALUE FOR PUBLIC
         AI,15    0                 IF PUBLIC, ALWAYS CAN REMOVE
         BLZ      CPV55
         LI,9     1                 FOR LINK TEST IF NOT PUBLIC
         LC       J:JIT
         BCS,12   CPV55             ONLINE, GHOST OK
         MTH,0    AVRID,2           IS IT EXCLUSIVE
         BLEZ     CPV80             NO, CANT RELEASE
CPV55    RES      0
         LI,15    X'FF'             IF LINKED TO, RELEASE ONLY IF
         AND,15   J:RNST            NO OTHER DCBS ARE OPEN TO IT
         BEZ      %+3               EVEN IN SAVED DCBS
         CH,9     AVRNOU,2          9=2  IF PUBLIC, 1 OTHERWISE
         BNE      CPV80             MORE OPEN, CANT RELEASE
         LW,15    6                 NOT THIS ONE
         LW,5     Y002              MUST BE OPEN
         AI,5     DCBPRIVBIT        AND PRIV
         LW,8     J:DCBLINK
CPV65    RES
         LW,7     *8                END OF CHAIN
         SW,7     8                 LENGTH OF CHAIN
         AI,7     -1
         LW,4     2                 SAVE AVRX
CPV60    LW,6     *8,7
         CW,6     YFF               IS THIS A DCB ADDRESS
         BANZ     CPV70             NO
         CW,15    6                 IS IT THE ONE WERE TRYING TO CLOSE
         BE       CPV70             IGNORE IT
         CS,5     0,6               IS IT OPEN AND PRIV
         BNE      CPV70             NO
         BAL,0    GETSNADR          13=SN TBL
         BAL,0    GETOVC            3=# OPEN
         CI,3     1                 ONLY ONE IF CONSEC
         BNE      %+3
         BAL,0    GETVNO            3= WHICH ONE
         MTB,-3   3                 SET FLAG TO CHECK ONLY ONE
         CW,14    *13,3             ANY THE SAME ONE
         BE       CPV80             YES, DONT RELEASE
         BDR,3    %-2
CPV70    BDR,7    CPV60             NEXT DCB ADDR
         LW,7     *8                GET FLINK IF THERE IS ONE
         LW,8     0,7
         BNEZ     CPV65
         LW,2     4
         AI,2     BATAPE
         LW,3     4
         BAL,11   RAT:DCT4
         LI,14    0
*                                   1 = RESOURCE TYPE INDEX
*                                   2 = DCT INDEX
*                                   3 = AVR INDEX
*                                   6 = DCB ADR
*                                   14 = RESET SPIN BITS
         LH,7     AVRID,3           TEST HOW ALLOCATED
         BGZ      %+3               EXCLUSIVE BATCH - DECR JIT
         LC       J:JIT             SHARED - DECR JIT UNLESS BATCH
         BCR,12   %+2               BATCH SHARED - MUST BE PUBLIC
         MTB,-1   JB:CUR,1
         BAL,11   ASPIN             ALWAYS RESET SPIN BIT IN JIT
         MTH,-1   AVRNOU,3          DECREMENT 1 FOR THE USER
         BNEZ     CPV80             STILL IN USE IF NON ZERO
*                                   EXCLUSIVE WILL BE TAKEN CARE OF IN
*                                   T:DSMNT BY SUBTRACTING JB:MAX FROM CU
         BAL,11   HOWALO            FIND OUT WHO ORIGINALLY GOT THE DRIVE
*                                   AND RETURN IT IN 0;
*                                   RESET GLOBAL SPIN BIT
         CI,7     0                 TEST FOR EXCLUSIVE
         BGZ      CPV80             YES
         MTH,-1   *0,1              DECREMENT GLOBAL COUNT
         STW,11   S:MBSF
CPV80    EQU      %
         PULL     16,R0
         B        *R0
CPV100   LW,8     TSTFBIT           IF TSTF, DONT RELEASE RESOURCE
         CW,8     TSTF,6
         BAZ      CPV50
         B        CPV80
TSTF     EQU      16
TSTFBIT  EQU      Y0008
         SPACE    5
*O*      MESSAGE: YYNDD VTOC ERROR
*O*      MEANING: I/O ERROR HAS OCCURRED TRYING TO UPDATE A PRIVATE VTOC
*O*      ACTION:  CONFER WITH VOLUME OWNER OR SYSTEM ANALYST
CPVVTOCERR RES
         LI,R5    CPV25             SET RETURN FROM MSGOUT
         BAL,R0   GETVDCTX          GET DCTX
         LW,R1    R3                PUT IN GOOD REG
         BAL,13   MSGOUT            OUTPUT MESSAGE TO OPERATOR
         TEXTC    ' VTOC ERROR'
         TITLE    '**** OPENPV ****'
*DO*
*F*
*        NAME:    OPENPV
*
*        PURPOSE: TO BEGIN A DCBS USE OF A PRIVATE VOLUME
*
*        DESCRIPTION: OPENPV DETECTS AND REPORTS ANY RESOURCE
*         ALLOCATION ABNORMALS (20 AND 49). IT CALLS MTPV IF
*         NECESSARY TO MOUNT AND VERIFY THE VOLUME
*FIN*
*D*      NAME:    OPENPV
*D*      INTERFACE: GETVNO,GETSNADR,S:DAVR,RAT:DCT4,DHHIT,S:TSER,-S,-X
*D*               CLEARHI,SSPIN,SETPVI,CHKCUR,MTPV,DERES,USECHK2,T:REG
*D*      DESCRIPTION: IF THE REQUIRED VOLUME IS BEING VERIFIED, THE USER
*D*               SLEEPS FOR A FEW SECONDS UNTIL IT ISNT. IF HTE
*D*               VOLUME IS NOT MOUNTED AND VERIFIED, MTPV IS CALLED,
*D*               RESOURCE LIMITS AND BATCH EXCLUSIVE USE PERMITTING.
*D*               IF THE VOLUME IS MOUNTED AND VERIFIED, THREE CASES EXIST:
*D*               IF THE USER ALREADY HAS THE VOLUME (J:ASPIN SET), TE
*D*               DCB IS SET TO POINT TO THE DEVICE AND AVRNOU INCREMENTED.
*D*               IF THE VOLUME IS NOT IN USE BY ANYONE, THE USER AND DCB
*D*               ARE ATTACHED TO IT, RESOURCE LIMITS AND BATCH EXCLUSIVE
*D*               USE PERMITTING.
*D*               IF THE VOLUME IS IN USE BY OTHER USER(S), NO GLOBAL
*D*               RESOURCE IS REQUIRED, BUT USER LIMIT AND BATCH EXCL
*DO*
*D*               CHECKS ARE PERFORMED BEFORE ATTACHING THE DEVICE.
*        INPUT:   R6=DCB ADDRESS
*                 DCB:VNO=VOLUME NO.
*
*        CALL:    BAL,R11 OPENPV
*
*        OUTPUT:  DCB:VNO=0, IF UNABLE TO MOUNT THE VOLUME
*                            DCB:VDCTX,PAT=0: IF RNST ESCAPE
*                            DCB:PAT=0,VDCTX=VOLUME# IF FOREIGN VOL
*                            DCB:VDCTX=0,PAT=ABNORMAL CODE IF RESOURCE EERR
*                 DCB:VNO UNCHANGED IF VOLUME MOUNTED
*                            DCB:VDCTX,PAT POINT TO MOUNTED VOLUME
*                            AVRNOU,DCB:OVC INCREMENTED
*
*        REGS:    ALL VOLATILE EXCEPT R6,R8-R11
*FIN*
OPENPV   RES      0
         PUSH     4,8               SAVE REGS
AV10     RES      0
         BAL,R0   GETVNO
         BEZ      AVX               JOB ALREADY ABORTED
         BAL,R0   GETSNADR
         SD,R4    R4                FIND THE SN ANYWHERE
         BAL,R0   S:DAVR
         BAL,15   AV30SN            SET NOT PUBLIC IN 15
         LW,R5    R2
         AI,R2    BATAPE            AND DCT INDEX
         BAL,R11  RAT:DCT4          GET RAT INDEX
         LD,14    AVRTBL,5
         CW,15    Y08               VER
         BANZ     AV13              WAIT A BIT
         CW,15    Y2
         BAZ      AV30SN            NOT VERIFIED
         CI,R3    1                 IF NOT PRIMARY REQUEST,
         BE       %+3               MUST NOT BE A PRIMARY VOLUME
         CW,R15   Y02
         BANZ     AVE2005           THERE'S MORE THAN ONE PRIMARY IN SET
         BAL,R11  DHHIT
         BANZ     AV29              IF HES ALREADY GOT IT, GIVE IT TO HIMM
         LW,3     *D2,3             GET SERIAL #
         LH,0     AVRID,5
         BLZ      AVE2001           LOCKED OUT
         MTH,0    AVRNOU,5          CHECK USER COUNT
         BEZ      PRENOTPUB         NOBODY, USE IT
         BDR,0    AVE2002           EXCLUSIVE, ANOTHER USER
         LC       J:JIT
         BCS,12   AV27              ONLINE OR GHOST,NO REQUEST REQUIRED
         BAL,0    S:TSERS           DID HE ASK FOR IT
         BNEZ     AVR99             YEP, GIVE IT TO HIM
         BAL,0    S:TSERX           CHECK EXCLUSIVE
         BNEZ     PVERR22           RABBIT BLEW IT
         BIR,15   AV26              IF PUBLIC, WE CAN USE WITHOUT REQUEST
         B        AVE2003           NO REQUEST AND NOT PUBLIC
         SPACE 4
AVR99    RES      0
*                                   RESET ALLOCATION IN PROGRESS AND
*                                     SET J:ASPIN BIT
*                                   SH:RBCU COUNTED UP FOR EACH BATCH JOB
*                                   DESCRIBED AS SHARED
*                              THIS COUNTS IT DOWN IF PACK IS ALREADY IN USE
         MTH,-1   SH:RBCU,1         GIVE IT BACK
AV26     BAL,11   CLEARHI
         MTH,0    AVRNOU,5
         BNEZ     NOTS
*                                   SET GLOBAL SPIN BIT BASED ON JOB TYPE
*                                   FOR FIRST USER ON DRIVE
         BAL,11   SETSPIN
NOTS     RES      0
         MTH,1    AVRNOU,5          COUNT IT
AV29     RES      0
         MTH,1    AVRNOU,5          INCREMENT FOR DCB
         LI,R7    BAOVC             AND IN DCB
         MTB,2    *R6,R7
         BAL,R15  SETPVI            SET DCB POINTERS
AVX      RES      0
         PULL     4,8
         B        *11
         SPACE 4
AV27     RES      0
*                 ON LINE CHECK  CUR:MAX
*                 SHARED
         BAL,11   CHKCUR
         B        AV26              BEEN HERE BEFORE(ALLOC)
         BLE      AVE4902           OVER/JOB
         B        AV26
         PAGE
AV30SN   EQU      %
         BIR,15   MTPV              NO CHECKS IF PUBLIC
         LW,3     *D2,3             SERIAL#
         BAL,11   ISITX            CK SERIAL NR FOR EXCULSIVE
         B        AV35             ON-LINE/GHOST AND OK
*                                  BATCH -OK
         BAL,0    S:TSER            CHK SHARED DON'T UNLINK
         BNEZ     AV40              ALL ACCOUNTED FOR
         BAL,0    S:TSERX
         BEZ      AVE2003           NO REQUEST
AV35 RES 0
         BAL,9    USECHK2           CHECK RESOURCE LIMITS
         B        AVE4902           USER OVER
         B        AVE4901           GLOBAL OVER
AV40     RES      0
         B        MTPV              GO REQUEST A MOUNT
*
*        ERROR RETURNS
*
AVE20    AI,4     X'1000'-AVE2001   CNVT TO 20 MIT SUBCODE
AVEXX    ENABLE
         LI,5     X'1FFFF'
         STS,4    PAT,6             PUT IT AWAY
         BAL,5    DERES
AVEXX1   RES
         LI,4     0
         LI,5     BAVDCTX           ZAP VDCTX TOO
         STB,4    *6,5
         LI,5     BAVNO             ZAP VNO TOO
         STB,4    *6,5
         PULL     4,8
         B        *R11              ABORT RETURN FROM OPENPV
         PAGE
AVE49    AI,4     X'2480'-AVE4901
         B        AVEXX
*E*      ERROR: 49-01
*E*      DESCRIPTION: ATTEMPT TO EXCEED USER RESOURCE LIMIT
AVE4901  BAL,4    AVE49
*E*      ERROR: 49-02
*E*      DESCRIPTION: ATTEMPT TO EXCEED SYSTEM RESOURCE LIMIT
AVE4902  BAL,4    AVE49
*E*      ERROR: 20-01
*E*      DESCRIPTION: ATTEMPT TO USE VOLUME LOCKED OUT BY OPERATOR
AVE2001  BAL,4    AVE20
*E*      ERROR: 20-02
*E*      DESCRIPTION: ATTEMPT TO USE VOLUME EXCLUSIVELY IN USE
AVE2002  BAL,4    AVE20
*E*      ERROR: 20-03
*E*      DESCRIPTION: ATTEMPT TO USE VOLUME NOT REQUESTED ON !LIMIT
AVE2003  BAL,4    AVE20
*E*      ERROR: 20-05
*E*      DESCRIPTION: ATTEMPT TO USE TWO PRIMARY VOLUMES IN A SET
AVE2005  BAL,11   DHHIT             DEALLOCATE ONLY IF NOT HIS YET
         LI,4     X'1005'           (SET ABN CODE)
         BAZ      AVEXX
         LI,5     X'1FFFF'
         STS,4    PAT,6             ONLY SET CODE IF ITS HIS
         B        AVEXX1
PRENOTPUB RES 0
         BAL,11   ISITX
         B        JAV11            ON-LINE/GHOST AND OK
*         BATCH
         BAL,0    S:TSERS           UNK IF THERE
         BNEZ     AV24              IT WAS, SET SHARE
         BAL,0    S:TSERX           EXCL?
         BEZ      AVE2003           NOT REQUESTED
JAV11    RES      0
*        INC CUR AND GLOBAL
         BAL,9    USECHK2           CHECK RESOURCE LIMITS
         B        AVE4902           USER OVER
         B        AVE4901           GLOBAL OVER
         LW,0     S:CUN             SET EXCL IF BATCH
         LC       J:JIT
         BCR,12   %+2               IT IS
AV24     LI,0     0                 SET SHARED IF NOT BATCH EXCL
         STH,0    AVRID,5           SET ID   EXCLUSIVE
         B        AV26
         SPACE    2
AV13     EQU      %                 WAIT A BIT
         PUSH     R6
         LW,R6    S:CUN
         LI,SR4   10                SLEEP FOR 12 SECONDS
         STW,SR4  U:MISC,R6
         LI,R6    E:SL
         BAL,SR4  T:REG
         PULL     R6
         B        AV10              TRY AGAIN
         TITLE    '**** ISITX ****'
*        PURPOSE : TO CHECK SERIAL NR AGAINST EXCLUSIVE BATCH LIIST
*                 IF BATCH REQUESTED EXCLUSIVE ,ABN = 2002
*
*        INPUT:   R3=SERIAL NR
*        CALL:    BAL,11 ISITX
*                 +1 GHOST/ON-LINE AND NOT IN EXCLUSIVE LIST
*                 +2 BATCH -OK RABBIT HAS CHECKED IT
*
*
*
ISITX    LC       J:JIT
         BCR,12   PLX1SR4          BATCH -RABBIT CHECKED
         LI,4     MBSOP#+LPART
ISITXL   LB,1     PLB:MIN,4        PARTITION CHAIN FOR EXCLUSIVE LIST
         BEZ      ISITXN
ISITXL1  CW,3     TSERIAL,1
         BE       AVE2002          CAN'T HAVE IT(BATCH REQUESTED)
         LB,1     LSERIAL,1
         BNEZ     ISITXL1
ISITXN   AI,4     -(SV:RSIZ+1)
         BGZ      ISITXL
         B        *11              OK TO REQUEST
         TITLE    '**** PVERR ****'
*S*      SCREECH CODE: 46-21
*S*      TYPE: SUA
*S*      REPORTED BY: PV
*S*      MESSAGE: PRIVATE PACK LOGIC INCONSISTENCY
*S*      REGISTERS: R11 IS POINT OF DETECTION
PVERR    PSW,11   TSTACK            SAVE ADDRESS OF ERROR
         BAL,SR4  CLSVNO            TRY TO CLOSE AS MUCH AS POSIBLE ANY
*                                   ANY OPEN VOLUMES
         PULL     11
PVERR0   EQU      %
         SUA      X'46',X'21'
*
*F*      NAME:    CLSVNO
*F*      PURPOSE: REDUCE DCB:OVC TO ZERO (THEREBY REDUCING AVRNOU FOR
*F*               THE APPROPRIATE SPINDLES).
*F*      DESCRIPTION: THE CURRENT VOLUME (DCB:VNO) IS CLOSED FOR
*F*               CONSECUTIVE FILES, 1 TO DCB:OVC FOR OTHERS.
*D*      NAME:    CLSVNO
*D*      CALL:    BAL,11 CLSVNO
*D*      INPUT:   R6=DCB ADDRESS
*D*      REGISTERS: R0, R2-R4 ARE CLOBBERRED.
*D*      INTERFACE: GETOVC,GETORG,SETVNO,CLOSEPV
*D*      DESCRIPTION: ALL OPEN VOLUMES ARE CLOSED USING CLOSEPV
CLSVNO   EQU      %                 CLOSE VOLUME NUMBER
         BAL,R0   GETOVC            GET OPEN VOLUME COUNT
         BEZ      *11               RETURN--NONE OPEN
         BAL,0    GETORG            IF CONSEC, WHATEVER IT SAYS
         BL       %+2               IS RIGHT
         BAL,R0   SETVNO            SET VOLUME NUMBER
         BAL,R0   CLOSEPV           CLOSE VOLUME POINTED TO BY VNO
         BDR,3    %-2               CLOSE UNTIL NONE OPEN
         B        *11               AND RETURN
         TITLE    '**** RDVTOC **** WRVTOC ****'
*        PURPOSE: TO READ OR WRITE PRIVATE VOLUME'S VTOC
*
*        INPUT:   R6=DCB ADR
*                 DCB:VDCTX=VOLUME'S DCT INDEX
*                 (WRVTOC ONLY) VTOC IN BUFF1 - WORD 0 NEGATIVE IF UPDATED
*                 NO WRITE WILL OCCUR IF VTOC NOT UPDATED
*
*        CALL:    BAL,R0 RDVTOC
*                 BAL,R0 WRVTOC
*
*        OUTPUT:  DCB:BUF1=ADR OF VTOC BUFFER
*                 D3=BUF1 ADR
*
*        REGS:    ALL REGISTERS USED BY REDSECB + R2,R3,D1 VOLATILE
*                 IF NO WRITE OCCURS, ONLY R11 IS CHANGED
*
WRVTOC   RES      0
         PUSH     0
         LW,SR4   T:LBL             CHECK UPDATED FLAG
         XW,SR4   BUFF1
         BGZ      PULLEXIT1         NO, EXIT GOOD
         OR,R6    Y06               SET QRITE CODE
         LI,D3    BUFF1             SET BUFER ADDRESSS
         B        RDVTOC1
RDVTOC   EQU      %
         PUSH     R0
         BAL,R0   CLRBBUF           WRITE OUT BUFF1 IF NECESSARY
         BAL,R0   GETBBUF           GET NEW ONE
         STW,R0   BUFF1             ZAP WORD ZERO FOR :LBL TEST
RDVTOC1  RES                        ENTRY FOR WRVTOC
         BAL,R0   GETVDCTX          GET DCTX TO READ
         LW,D1    R3                IN D1
         SLS,D1   16
         BAL,SR3  RWREX             SAVE AND SETUP DCB
         LW,R0    Y01               INCREMENT FCN
         AWM,R0   FCN,R6
         AND,R6   M17               SCRUB WRITE CODE
         LW,SR3   TYC,R6            SAVE OLD TYC
         LW,R1    BTYC              CLEAR BAD BITS
         STS,R0   TYC,R6
         BAL,SR4  QUEUE
         BAL,SR4  IOSPIN
         XW,SR3   TYC,R6            RESTORE/GET TYC
         BAL,R0   RESBLK            RESTORE DCB
         LI,D3    BUFF1             RESTORE BUFF1 ADDRESS
         CW,SR3   BTYC              DID WE GET ERROR
         BAZ      PULLEXIT1         NO, RETURN GOOD
         B        PULLEXIT
         TITLE    '***** SWXPV *****'
*DO*
*F*
*        NAME:    SWXPV
*        PURPOSE: TO SWITCH A CONSECUTIVE FILE FROM THE CURRENT
*                 PRIVATE VOLUME TO THE VOLUME REFERENCED IN R3
*FIN*
*DO*
*D*      NAME:    SWXPV
*        INTERFACE: CLOSEPV,SETVNO,OPENPV,GETVNO,PULLEXIT
*        DESCRIPTION: SWXPV CALLS CLOSEPV IF A VOLUME IS CURRENLTY
*         ATTACHED TO THE DCB. THEN CALLS OPENPV FOR THE NEW ONE.
*         ANY RESULTING ABNORMAL CODE IS RETURNED IN R10
*        INPUT:   R6=DCB ADR
*                 R3=NEW VOLUME NUMBER
*
*        CALL:    BAL,R0
*
*        OUTPUT:  DCB:VNO,DCB:PAT,DCB:SWXV POINT TO THE REQUESTED VOLUME
*                 OR DCB:VNO=0 AND VDCTX,PAT INDICATE WHY (SEE OPENPV)
*
*FIN*
*D*      REGISTERS: R1-R5,R7,R11 CLOBBERRED
*
SWXPV    RES      0
         PUSH     R0
         LI,2     BAVNO             IF NONE OPEN, DONT CLOSE
         LB,2     *6,2
         BEZ      %+2
         BAL,0    CLOSEPV0          CLOSE/REMOVE THE CURRENT OPEN VOLUME
         BAL,R0   SETVNO            SET DCB:VNO=REQUESTED VOLUME
         PUSH     4,D1              SAVE SOME REGS
         BAL,R11  OPENPV            OPEN THE REQUESTED VOLUME
         PULL     4,D1
         BAL,R0   GETVNO            WAS THE VOLUME MOUNTED
         BNEZ     PULLEXIT              YES,EXIT
         LI,SR3   K1FFFF           *WAS THE VOLUME NOT MOUNTED BECAUSE
         AND,SR3  PAT,R6            THE UNIT WAS UNAVAILABLE
         BNEZ     %+2               GOT ONE
         LI,10    X'1406'**-1       MUST BE RNST ABORT
         SCS,10   -7
         B        PULLEXIT          RETURN TO CALLER FOR FIXIT
         TITLE    '**** OPV ****'
*DO*
*F*
*        NAME:    OPV
*
*        PURPOSE: TO OPEN A FILE ON A PRIVATE VOLUME SET
*FIN*
*D*      NAME:    OPV
*D*      CALL:    BAL,11 OPV
*D*      INPUT:   R6=DCB ADDRESS
*D*               R9=R3 FROM LOCCODE FOR INSN OR OUTSN, OR FLAG
*D*                 (NEGATIVE VALUE) IF CALLED FROM SETACOG JUST
*D*                 TO GET THE RIGHT # OF VOLS MOUNTED.
*D*      OUTPUT:  R3=0, IF ERROR RETURN AND R10 CONTAINS ERROR CODE.
*D*                 =2, IF NORMAL RETURN (SUCCESSFUL)
*D*        DCB:PRIV SET; DCB:SWXV RESET
*D*        DCB:VSND=DISPLACEMENT OF SN LIST IN DCB FROM (DCB:FLP)
*D*        DCB SN LIST AND PRIMARY VTOC SN LIST MATCH AND CONTAIN ALL
*D*         UNIQUE SNS FROM EITHER LIST IF THE DCB IS NOT IN-ONLY OR
*D*         JUST THOSE FROM VTOC IF IN:ONLY.
*D*        ALL REQUIRED SPINDLES PROPERLY ALLOCATED AND INDICATED.
*D*        THE VOLUME'S ACCOUNTDIRECTORY NAME IS SET IF DCB OS OUT/OUTIN
*D*         AND THE NAME IS NOT YET PRESENT.
*D*      INTERFACE: SETVNO,OPENPV,GETVNO,GETVDCTX,SETVNO1,SETPVI,
*D*        CLOSEPV,GETSNADR,GETFUN,GETORG,NXTVOL,GETSEC,RWREX,PVQUEUE,
*D*        IOSPIN,RESBLK,WRTSEC10
*D*      REGISTERS: R6 SAVED.
*D*      DESCRIPTION: OPV CALLS OPENPV TO ATTACH THE REQUIRED VOLUMES
*D*       TO THE DCB AND USER. IT EXTENDS THE SN LIST ON THE PRIMARY
*D*       VOLUME IF AN INOUT OR OUT DCB SPECIFIES NEW ONES. IT PUTS
*D*       THE ACCURATE SN LIST IN THE DCB. IT CHECKS THE VOLUME SET'S
*D*       ACCOUNT AGAINST THE DCB ACCOUNT OR INITIALIZES IT FOR OUT
*D*       DCBS IF IT NEEDS IT.
*
OPV      EQU      %
         PUSH     SR4
         LI,R2    BAVSND           *SET DCB:VSND EQUAL TO WORD
         AI,9     -1                DISPLACEMENT OF PRIVATE VOLUME
         BLZ      OPV10             CALLED FROM SETACOG, DONT SET VSND
         STB,9    *R6,R2            SERIAL NO TABLE
OPV10    LI,R3    DCBPRIVBIT+DCBSWXVBIT
         LI,R2    DCBPRIVBIT
         STS,R2   PRIV,R6           SET DCB:PRIV; RESET DCB:SWXV
*
OPV25    LI,R3    0                *OPEN THE FIRST VOLUME
OPV30    AI,R3    1
         BAL,R0   SETVNO
         BAL,R11  OPENPV            *OPEN THE VOLUME SPECIFIED IN VNO
         BAL,R0   GETVNO
         BNEZ     OPV70
         LI,SR3   K1FFFF           *WAS VOLUME UNABLE TO BE MOUNTED
         AND,SR3  PAT,R6            BECAUSE UNIT UNAVAILABLE
         BNEZ     OPV210                YES
*                                       NO,VOL NOT MOUNTED BECAUSE
*                                          JOB ABORTED
         BAL,R0   GETVDCTX         *WAS THE JOB ABORTED BECAUSE A
*                                   FOREIGN VOLUME WAS MOUNTED
         BEZ      OPV50                 NO
         STW,R3   SR2                   YES,SAVE FOREIGN VOLUME NO.
         BAL,R0   SETVNO1           SET DCB FOR PRIMARY VOLUME
         BAL,R15  SETPVI
         BAL,R0   RDVTOC            READ PRIMARY VOLUME VTOC INTO BUF1
         B        OPV50             GIVE UP IF ERROR
         LW,R4    BUFF1+VTOC:SNTD   CHOP LIST AT FREIGN ONE
         AI,SR2   -1
         STW,SR2  BUFF1,R4
         LI,3     -1
         STW,3    BUFF1             SET UPDATED FLAG
         BAL,0    WRVTOC            AND WRITE IT
         NOP                        IGNORE ERRORS
OPV50    EQU      %                *CANNOT OPEN FILE ON PRIVATE VOLUME,
*E*      ERROR: 14-03
*E*      DESCRIPTION: INTERRUPTED MOUNT OPERATION, OPEN ABORTED.
         LI,10    X'1406'**-1
         B        OPV210
OPV70    RES      0
         BIR,9    OPV131            SETACOG CALL, ALREADY HAVE SN LIST
         CI,R3    1                 WAS THE PRIMARY VOLUME JUST OPENED
         BNE      OPV131                NO
         BAL,R0   RDVTOC                NO,READ VTOC INTO BUF1
         B        OPV180            ERROR READING VTOC
OPV75    EQU      %                 MUST VERIFY THAT THIS VOLUME
*                                   IS INDEED THE PRIMARY VOLUME.
*                                   IF IT IS NOT, WE MUST MOUNT THE
*                                   PRIMARY VOLUME.
*
         BAL,R0   GETSNT            R7 = VTOC:SNT
         LW,R7    1,R7              GET PRIMARY SN
         CW,R7    BUFF1+1           IS THIS IT
         BE       OPV79             YES
         BAL,0    CLOSEPV0          CLOSE VOLUME
         BAL,R0   GETSNADR
         AI,D2    1
         STW,R7   *D2               PRIMARY SN TO DCB:SNT
         B        OPV25             REOPEN PRIMARY VOLUME
OPV79    BAL,D2   GETFUN
         CI,D1    1                 IS THIS AN INPUT-ONLY FILE
         BE       OPV110                YES
         BAL,R0   GETSNADR              NO, CHKEC TO SEE
OPV80    AI,D2    X'80001'                  IF ANY
         LW,SR1   *D2                       NEW
         BAL,R0   GETSNT  R7=VTOC:SNT ADR  VOLUMES ARE  BEING ADDED
*                         R4=SN COUNT      TO  THE  SET
         ANLZ,R3  OPV90             IF NO MORE WILL FIT,
         CI,R3    BUFF1+511         DONT ADD ANY
         BGE      OPV100
OPV90    CW,SR1   *R7,R4
         BE       OPV100
         BDR,R4   OPV90
         STS,D2   BUFF1             NEW VOLME, SET BUFFER UPDATED
         STW,SR1  1,R3              SET NEW VOLUME#
         MTW,1    0,R7
OPV100   BDR,R2   OPV80
OPV110   BAL,R0   GETSNT            MOVE VT0C:SNT TO  DCB:SNT
         BAL,R0   GETSNADR          REESTABLISH D2
         LI,R2    3
         CB,R4    *D2,R2
         BG       OPV190                ERROR,NOT ENOUGH ROOM IN THE
*                                             DCB FOR VT0C:SNT
         LI,R2    2
         STB,R4   *D2,R2
OPV120   LW,SR1   *R7,R4
         STW,SR1  *D2,R4
         BDR,R4   OPV120
OPV130   BAL,R0   WRVTOC           *UPDATE VOLUME TABLE OF CONTENTS,IF
*                                   CHANGED AND RELEASE BUF1
         B        OPV180            ERROR OCCURRED
OPV131   RES      0                 MAKE SURE THAT THE PROPER # OF VOLS IS OPEN
         BAL,R0   GETORG
         BL       OPV140            CONSECUTIVE FILE,ONLY OPEN THE
*                                                    PRIMARY VOLUME
         BAL,SR4  NXTVOL           *KEYED OR RANDOM FILE,DOES THE NEXT
*                                                         VOLUME EXIST
         BL       OPV30                 YES,OPEN NEXT VOLUME IN SET
         BAL,R0   SETVNO1               NO,ALL VOLUMES IN SET OPENED
         BAL,D4   SETPVI                   POINT DCB TO PRIMARY VOLUME
OPV140   BIR,9    OPV170            SETACOG CALL: ALREADY CHECKED ACCN
         BAL,R0   GETSEC            *GET INDEX BUFFER (D3=BUF2 ADR)
         LI,D1    DPADFDA          *D1=DISC ADR OF PRIVATE VOL ACCOUNT D
OPV150   BAL,SR3  RWREX
         BAL,SR4  PVQUEUE          *READ ACCOUNT DIRECTORY INTO BUF2
         BAL,SR4  IOSPIN           *WAIT UNTIL READ COMPLETED
         BAL,R0   RESBLK
         LI,R7    J:JIT+ACCN
         LW,R0    FLD,R6
         BEZ      %+2               IT'S A SCRATCH
         BAL,R0   GETACNADR         R7=DCB:ACN ADR
         LW,SR3   0,R7
         LW,SR4   1,R7              SR3,SR4=DCB:ACN
         LW,R0    BUFF2+4           *DOES THE VOL HAVE AN ACCOUNT
         BNEZ     OPV160                YES
         BAL,D2   GETFUN                NO,VOLUME NOT OWNED
         CI,D1    KA
         BAZ      OPV170            FILE DIRECTORY SHOULD BE EMPTY TOO
*                                                EXIST ON UNOWNED VOL
         STD,SR3  BUFF2+4           SET ACCOUNT
         LI,D1    DPADFDA              D1=DISC ADDR OF PRIV AD
         LI,R0    OPV170            RETURN TO 'OPV170' FROM WRTSEC
         PUSH     9,D1                     (PARALLEL PULL IN WRTSEC)
         LI,D3    BUFF2             BUFFER ADDRESS
         B        WRTSEC10          UPDATE PRIVATE ACCOUNT DIRECTORY
OPV160   CD,SR3   BUFF2+4           ACCOUNTS MUST BE SAME
         BNE      OPV200                NO
OPV170   LI,R3    K2               *SET R3 EQUAL TO NORMAL RETURN AND
         B        OPVX              EXIT
*E*      ERROR: 0D-01
*E*      DESCRIPTION: ERROR READING VTOC TO UPDATE DCN SN LIST
OPV180   LI,SR3   X'0D02'**-1
OPV210   SCS,SR3  -7
         B        OPV220
*E*      ERROR: 0D-00
*E*      DESCRIPTION: NOT ENOUGH ROOM IN DCB FOR SN LIST
OPV190   LI,SR3   X'D'             *ERROR CODE=NOT ENOUGH ROOM IN
         B        OPV220            DCB:INSN FOR PRIVATE VOLUME SNT
*E*      ERROR: 14-00
*E*      DESCRIPTION: DCB:ACN NOT SAME AS PRIVATE VOLUME ACCOUNT.
OPV200   LI,SR3   X'14'             ERROR CODE DCB:ACN NOT EQUAL
OPV220   LI,R3    K0                PRIVATE VOLUME ACCOUNT NO.
OPVX     XW,R3    *TSTACK           EXIT
         B        0,R3
         TITLE    '**** GETSNT ****'
*        PURPOSE: TO CALCULATE THE ADDRESS OF A PRIVATE VOLUME'S
*                 SERIAL NO. TABLE (WITHIN VTOC)
*
*        INPUT:   D3=VTOC BUF ADR
*
*        CALL:    BAL,R0  GETSNT
*
*        OUTPUT:  R7=ADR OF VTOC SERIAL NO. TABLE
*                 R4=NO. OF SERIAL NOS IN THE TABLE
*
*        REGS:    ONLY R7,R4 VOLATILE
*
GETSNT   EQU      %
         LI,R7    VTOC:SNTD
         LW,R7    *D3,R7
         AW,R7    D3
         LW,R4    0,R7
         B        *R0
         SPACE    3
GETACNADR EQU     %
         LI,R2    HAACD
         LH,R7    *R6,R2
         AW,R7    FLP,R6
         B        *R0
         TITLE    '**** S:DAVR ****'
*DO*
*F*      NAME:    S:DAVR
*        PURPOSE: TO SEARCH THE DAVRTBL SUBTABLE OF THE AVRTBL FOR A
*                 DEVICE OF THE SAME TYPE AS SPECIFIED FOR THE FILE,
*                 GIVEN A SEARCH CRITERIA
*FIN*
*DO*
*D*      NAME:    S:DAVR
*        INPUT:   R3=VOLUME NO,IF SEARCHING FOR A SERIAL NO.
*                   =0,IF LOOKING FOR AN UNUSED DAVRTBL ENTRY
*                   =-1,IF DAVRTBL SERIAL NO. TO BE IGNORED
*                 R4 (BYTE-0)=AVRTBL FLAGS TO SEARCH FOR
*                 R4 (RIGHT HWD)=FFFF IF AVRNOU MUST BE 0
*                               =0    IF ANY AVRNOU IS OK
*                 R5 (BYTE-0)=MASK FOR FLAG SEARCH
*                 R6=DCB ADR
*                 D2=ADR OF DCB PRIVATE VOLUME SERIAL NO. TABLE,
*                    IF R3 IS GREATER THAN ZERO
*
*        CALL:    BAL,R0 S:DAVR
*
*        OUTPUT:  (ONLY IF ENTRY LOCATED)
*                 R2=AVRTBL INDEX OF ENTRY
*                 R5=ADDRESS OF AVRTBL ENTRY
*
*        RETURN:  (R0),IF ENTRY NOT LOCATED
*                 (R0)+1,IF ENTRY LOCATED
*
*        REGS:    ALL NONVOLATILE EXCEPT R2,R7,R14,R15
*                 AND R5 IF ENTRY LOCATED
*FIN*
DAVRFE   EQU      AVRTBLSIZ         FIRST DIRECT ACCESS AVRX
DAVRLE   EQU      AVRTBLNE          LAST+1 AVRX
*
S:DAVR   EQU      %
         LI,R2    DAVRFE-1          R2=INDEX OF DAVRTBL ENTRY
DA10     AI,R2    1
         CI,R2    DAVRLE
         BGE      DA25              END OF DAVRTBL ENCOUNTERED
DAAD     LD,D3    AVRTBL,R2
         CI,R3    0                 IS THE SERIAL NO TO BE IGNORED
         BL       DA20                  YES
         BNE      DA15                  NO,LOOK FOR MATCHING SERIAL NO.
         CI,D4    0                     NO,LOOK FOR UNUSED AVRTBL ENTRY
         BLZ      DA10              IS PUBLIC, CAN'T BE 0 SER#
         CI,D3    0
         BNE      DA10              NOPE
         B        DA20              YUP
DA15     CW,D3    *D2,R3            ARE THE SERIAL NOS EQUAL
         BNE      DA10                  NO
DA20     CS,R4    D4                    YES,IS THIS ENTRY WANTED
         BNE      DA10                          NO
         CH,R4    AVRNOU,R2         IS AVRNOU     O K
         BANZ     DA10              NO
         LW,R7    R2                GET DCT INDEX FOR
         AI,R7    BATAPE            PARTITIONED DEVICE AND RESOURCE TYPE
         LC       DCT3,R7           CHECKS
         BCS,2    DA10              PARTITIONED, CANT USE THIS ONE
         LB,R14   DCT4,R7           GET DEVICE TYPE
*  CHECK DEVICE TYPES AND SET IF DCB=0--ERR IF HGP NOT SAME
         LI,7     BARNDEV
         CB,4     *6,7              ARE WE SETTING TYPE
         BANZ     %+2               NO, MUST BE RIGHT
         STB,14   *6,7              SET TYPE
DAJD     CB,14    *6,7
         BNE      DA10              DON'T MATCH
         ANLZ,R5  DAAD              DWD ADDRESS OF ENTRY
         SLS,R5   1                 WORD ADDRESS
         AI,R0    1                             YES,ENTRY LOCATED
DA25     RES
         B        *R0
         TITLE    '*** S:TSER, -S, -X ***'
*F*      NAME:    S:TSER
*F*      PURPOSE: SEARCH TSERIAL TABLE FOR A PRIVATE SERIAL NUMBER
*D*      NAME:    S:TSER
*D*      ENTRY:   S:TSERX
*D*      ENTRY:   S:TSERS
*D*      CALL:    BAL,0
*D*               BNE FOUND IN CHAIN
*D*      INPUT:   JB:SLNK OR JB:XLNK HAS HEAD OF CHAIN
*D*               LSERIAL= LINK TABLE
*D*               TSERIAL=SERIAL# TABLE
*D*               RSERIAL=DEVICE TYPE TABLE
*D*               R3=SERIAL #
*D*      DESCRIPTION: CHAIN IS SEARCHED FOR NATCH WITH R3. IF FOUND,
*D*               DEVICE TYPE IS MOVED TO DCB:RNDEV, AND IF CALLED AT
*D*               S:TSERS, ENTRY IS REMOVED FROM CHAIN.
*D*      OUTPUT:  DCB:RNDEV=DEVICE TYPE OF PACK IF REQUESTED.
*D*      REGISTERS: ALL SAVED
S:TSERX  EQU      %
         PUSH     5                 SAVE ID
         LI,5     JB:XLNK-BA(LSERIAL)    BYTE DISP TO LINK IN JIT
STSER    EQU      %
         PUSH     0
         LB,5     LSERIAL,5
         BEZ      TSEXIT
         CW,3     TSERIAL,5
         BNE      %-3
         B        SETTYPE           IN DCB
*
*
S:TSERS  EQU      %                 UNLINK SHARED SERAIL #
         PUSH     5                 SAVE USER ID
         LI,5     JB:SLNK-BA(LSERIAL)   BYTE DISP TO LINK IN JIT
         PUSH     0
TSER1    LW,0     5                 SAVE PREV INDEX FOR DELINKING
         LB,5     LSERIAL,5
         BEZ      TSEXIT            NOT THERE
         CW,3     TSERIAL,5
         BNE      TSER1
         PUSH     5
         LB,5     LSERIAL,5         FOUND, DELINK IT
         XW,0     5
         STB,0    LSERIAL,5
         PULL     5
         STW,3    S:MBSF            START OTHERS WHO MOGHT SHARE IT
         LB,0     LSERIAL           HEAD OF FREE ENTRIES
         STB,0    LSERIAL,5
         STB,5    LSERIAL
SETTYPE  LB,0     RSERIAL,5         SET TYPE IN DCB
         LI,5     BARNDEV
         STB,0    *6,5
TSEXIT   STCF     *TSTACK           PUT CC IN R0
         PULL     0                 GET RETUNR AND C ODE
         PULL     5                 RESTORE USER #
         LC       0                 RESTORE COND CODES
         B        *0                RETURN
*  DON'T UNLINK THE SHARED SERIAL ENTRY
S:TSER   EQU      %
         PUSH     5                 SAVE USER #
         LI,5     JB:SLNK-BA(LSERIAL)   BYTE DISP TO LINK IN JIT
         B        STSER
         SPACE    2
MOUNTMES EQU      %
         DATA,6   'MOUNT '
         DATA,2   X'0000'
COUNT    DATA     X'13404040'
DISMES   TEXT     'DISM'
         TITLE    '**** MOUNDISMT  MOUNT1 ****'
*DO*
*F*      NAME:    MOUNDISMT
*        PURPOSE: TO CONSTRUCT (MOUNDISMT) AND OUTPUT A
*                 MOUNT, DISMT, OR ERROR MESSAGE TO THE
*                 OPERATOR FOR PRIVATE VOLUME MOUNTING FUNCTIONS
*FIN*
*DO*
*D*      NAME:    MOUNDISMT
*        ENTRY:   MOUNT1
*        INTERFACE: MSROCTY,RAT:DCT4,T:REG
*        SCRATCH: MESSAGE IS BUILT IN J:BASE
*        INPUT:
*         MOUNDISMT R2=AVR INDEX (BIT0 SET IF DISMT)
*                   R3=EBCDIC SERIAL NUMBER
*
*         MOUNT1    R0-R4 TEXTC MESSAGE (R1 MUST NOT BE 'MOUN')
*
*        CALL:    BAL,R11
*
*        OUTPUT:  AVR ENTRY CLEARED IF ERROR MESSAGE
*                 OR IF USER YC,BREAK OR OPER ERR,ABRT
*                 IF DISMT, INACTIVE CFUS ARE ZAPPED
*                 MOUNT WAITS FOR OPERATOR KEYIN
*                 DISMT JUST RETURNS IMMEDIATELY
*                 R0=2 IF OPERATOR KEYIN RECEIVED
*                 R0=-2 IF ESCAPE FROM WAIT
*
*        REGS:    R2,R5-R11 NON-VOLATILE
*FIN*
MOUNDISMT RES     0
         LW,R1    MOUNTMES          ASSUME MOUNT
         LW,R4    R3                R4=SERIAL NO
         LW,15    2                 SAVE AVR INDEX
         BGEZ     MDSM3
         LI,R1    BGRCFU            IF ANY INACTIVE CFU POINT HERE,
         LI,R3    X'F0000'          ZAP THEM
         AI,R2    X'3C00'+BATAPE
         SLS,R2   16
MDSM1    LC       *R1
         BCS,12   MDSM2             ACTIVE
         CS,R2    2,R1
         BNE      MDSM2
         STW,R1   2,R1
MDSM2    AI,R1    CFUSIZE
         CW,R1    ACNCFU+13
         BLE      MDSM1
         LW,R2    R15               RESTORE AVR INDEX
         LW,R1    DISMES            NO, DISMT
MDSM3    AI,R2    BATAPE
         LD,R2    DCT16,R2
         LW,R0    COUNT             MOUNT,SAVE,OR DISMT MESSAGE
         SLD,R2   8
         AND,R2   M16
         AI,3     ','
         OR,R2    MOUNTMES+1
MOUNT1   RES      0
         LCI      5
         STM,0    J:BASE+1
         LW,R12   Y8                MAKE PLIST
         LI,R13   J:BASE+1
         PUSH     9,R5              SAVE REGS AND PLIST IN STACK
MOUNT10  EQU      %
         LW,R7    TSTACK
         AI,R7    -1                R7 POINTS TO PLIST
         LI,SR1   K2
         LI,R5    J:JIT
         PUSH     15                SAVE AVR INDEX
         BAL,11   MSROCTY
         PULL     15                RESTORE AVR INDEX
         LW,2     15
         BLZ      MOUNT3            IF DISMT, JUST EXIT
         LW,3     S:CUN
         LW,R1    J:BASE+2          GET 'MOUN','DISM'
*                                   SEE IF WAIT IS NECESSARY
*
         CW,R1    MOUNTMES          MOUNT
         BE       AVRWT
AVRCLEAR EQU      %
         LD,4     AVRTBL,2
         INT,5    5                 CLEAR FLAGS, GET PUBLIC ONE
         BCR,8    MOUNT20           NOT SET, NO CLEANUP
         AI,2     BATAPE            RELEASE GHOST RESOURCE IF PUBLIC
         BAL,11   RAT:DCT4
         MTH,-1   SH:RGCU,1
         AI,2     -BATAPE
MOUNT20  RES
         LI,4     0                 CLEAR SER #
         STD,4    AVRTBL,2
         STB,4    SOLICIT,2
         STH,4    AVRNOU,2          HAD BETTER ALREADY BE 0
MOUNT3   EQU      %
         PULL     9,R5              RESTORE REGS
         B        *R11
*
*
AVRWT    EQU      %
         BAL,11   AVRWTCHK          DID WE MISS KEYIN
         LI,6     60                SLEEP FOR 60*1.2 SECONDS
         STW,6    U:MISC,3          ASSUMES E:SL IS ABOUT 18
         LI,6     E:SL
         BAL,11   T:REG
         BAL,11   AVRWTCHK          IS IT TIME TO GO BACK
         B        MOUNT10           NO, PUT OUT MOUNT AGAIN
AVRWTCHK EQU      %
         LI,0     -2                SET ERR FLAG FOR USECHECK
         LH,R6    UH:DL,R3          GET ERR,ABRT,BRK, & EC FLAGS
         CI,R6    X'F000'
         BANZ     AVRCLEAR          YES
         LI,0     2
         MTB,0    SOLICIT,2         DID WE GET AVR OR KEYIN
         BEZ      MOUNT3
         CH,3     AVRID,2           DID SOMEONELSE STEAL IT
         BE       *R11              NO, KEEP WAITING
         B        MOUNT3
         TITLE    '**** MTPV ****'
*DO*
*F*
*        NAME:    MTPV
*
*        PURPOSE: TO MOUNT A PRIVATE VOLUME AND TO VERIFY THE SERIAL NO
*
*        DESCRIPTION: MTPV TALKS TO THE OPERATOR ABOUT MOUNTING
*         THE VOLUME (MOUNTS,ERRORS, ETC.). IT READS THE VTOC, MOVES
*         THE ALLOCATION TABLE TO CORE AND BUILDS THE SN LIST IF
*         NECESSARY.
*FIN*
*DO*
*D*      NAME:    MTPV
*        INTERACTION: GETVNO,GETSNADR,S:DAVR,MOUNDISMT,MOUNT1,DISMT,
*         DERES.
*        DESCRIPTION: S:DAVR SEARCHES AVRTBL FOR THE PORPER SPINDLE
*         TO USE-- FIRST FOR THE CORRECT VOLUME PREMOUNTED, THEN AN
*         UNUSED SPINDLE, THEN ANY PREMOUNTED VOLUME, THEN ANY SECONDARY
*         AVRED VOLUME, THEN ANY PRIMARY AVRED VOLUME. IF NONE OF
*         THESE IS AVAILABLE, S.C.22. IF THE SPINDLE HAS A VOLUME AVRED,
*         A DISMOUNT MESSAGE IS OUTPUT. IF THE SPINDLE DOESNT HAVE THE
*         CORRECT SERIAL NUMBER, A MOUNT MESSAGE IS OUTPUT.
*         WHEN THE CORRECT VOLUME HAS BEEN MOUNTED, ITS VTOC IS READ
*         AND THE INFORMATION CONTAINED THEREIN IS MOVED TO THE PROPER
*         PLACES IF IT MAKES SENSE. OTHERWISE AN APPROPRIATE ERROR
*         MESSAGE IS OUTPUT, FOLLOWED BY A REPEAT OF THE MOUNT MESSAGE.
*        INPUT:   R6=DCB:ADR
*                 DCB:VNO=VOLUME NO. OF THE VOLUME TO BE MOUNTED
*
*        CALL:    ENTERED FROM AV40 IN OPENPV
*                 RETURNS TO AV10 IN OPENPV
*
*        OUTPUT:  DCB:VNO=0, IF UNABLE TO MOUNT THE VOLUME
*                            DCB:VDCTX,PAT=0: IF RNST ESCAPE
*                            DCB:PAT=0,VDCTX=VOLUME# IF FOREIGN VOL
*                 DCB:VNO UNCHANGED IF VOLUME MOUNTED
*                 AVR:SN=SERIAL NO. OF THE REQUESTED VOLUME
*                 AVR:AVR SET
*                 AVRID=0
*                 AVR:PRIM SET ACCORDING TO THE VTOC.
*                 AVR:VER SET WHILE THE SERIAL NO IS BEING VERIFIED AND
*                     THE BIT MAP IS BEING MOVED TO THE ALLOCATION
*                     TABLE. THIS FIELD GETS RESET WHEN AVR GETS SET
*
*        REGS:    ALL VOLATILE EXCEPT R6
*FIN*
MTPV     RES      0
MT10     BAL,R0   GETVNO                R3=DCB:VNO
         BAL,R0   GETSNADR              D2=DCB:SNT,R2=SN COUNT
         LI,4     X'FFFE'           ALLOW PUBLIC PREMOUNTS
         LW,R5    Y18               INIT & VER BITS MUST BE OFF
         BAL,R0   S:DAVR            LOOK FOR SN IN AVRTBL
         B        MT30              NO ENTRY
         LW,R3    Y08               NO, SET VER FLAG
         STS,R3   1,R5
         B        MT88              AND GO VERIFY THE PACK
MT30     LI,R3    0                *SEARCH AVRTBL FOR ENTRY WITH ZERO
         LW,R5    YB8               SERIAL NO AND PUB=0,AVR=0,INIT=0,
         LI,R4    X'FFFF'           VER=0,NOU=0,NON-PARTITIONED
         BAL,R0   S:DAVR
         B        MT40                  EMPTY ENTRY NOT LOCATED
         B        MT80                  ENTRY LOCATED,OUTPUT MOUNT MSG
MT40     LI,R3    -1               *SEARCH AVRTBL FOR ENTRY WITH ANY
*                                   SERIAL NO AND PUB=0,AVR=0,INIT=0,
         BAL,R0   S:DAVR            VER=0,NOU=0,NON-PARTITIONED
         B        MT50                  ENTRY NOT LOCATED
         B        MT80                  ENTRY LOCATED,OUTPUT MOUNT MSG
MT50     OR,R4    Y2               *SEARCH AVRTBL FOR ENTRY WITH ANY
         LW,R5    YBE               SERIAL NO  AND PUB=0,AVR=1,INIT=0,
         BAL,R0   S:DAVR            VER=0,MTD=0,PRIM=0,NOU=0
*                                   & NON-PARTITIONED
         B        MT60                  ENTRY NOT LOCATED
         B        MT70                  ENTRY FOUND,OUTPUT DISMOUNT MSG
MT60     OR,R4    Y02              *SEARCH AVRTBL FOR ENTRY WITH ANY
         BAL,R0   S:DAVR            SERIAL NO AND PUB=0,AVR=1,INIT=0,
*                                   VER=0,PRIM=1,NOU=0,NON-PARTITIONED
         BAL,R11  PVERR22           UNIT UNAVAILABLE FOR MOUNT
MT70     LW,R3    0,R5              OUTPUT A DISMOUNT MESSAGE
         LW,1     Y08               GRAB ENTRY WITH VER BIT
         STS,1    1,5
         OR,R2    Y8                SET NEGATIVE TO NOT AVRCLEAR
         STW,1    0,5               ZAP SO NOBODY WAITS FOR IT
         BAL,SR4  MOUNDISMT         *OUTPUT A DISMT MESSAGE
MT80     RES      0                 OUTPUT A MOUNT MESSAGE
         BAL,R0   GETVNO                R3=DCB:VNO
         BAL,R0   GETSNADR              D2=DCB SERIAL NO TABLE ADR
         LW,R3    *D2,R3                R3=VOLUME SERIAL NO
         LW,R0    Y08              *PUT SERIAL NO IN AVRTBL ENTRY;
         LI,R1    KF0000            SET VER AND XCL ONLY
         STW,R3   0,R5
         STS,R0   1,R5
         LW,R2    R5                RECALCULATE AVR INDEX
         AI,R2    -AVRTBL
         SLS,R2   -1
         MTB,1    SOLICIT,2         MARK DRIVE AS SOLICITED
         LW,4     S:CUN
         STH,4    AVRID,2           ID TO AVR TABLE
         BAL,SR4  MOUNDISMT
         BIR,R0   MT164             WAS THE JOB ABORTED BY THE OPERATOR
         CW,R3    0,R5              WAS THE REQUESTED VOLUME MOUNTED
         BE       MT88                  YES
         LW,R1    Y08                      DAVRTBL AGAIN
         STS,R0   1,R5
         B        MT160             RELEASE RESOURCE AND TRY AGAIN
*                                   FROM THE TOP
MT88     EQU      %
         LI,3     JB:PMTS           COUNT MOUNTS
         MTB,1    0,3
         PUSH     R5                (SAVE AVRTBL ENTRY ADR)
         AND,R6   M17               CLEAR FOREIGN VOLUME FLAG (BIT 14)
         AI,2     BATAPE            READ VTOC INTO BUF1
         LI,3     BAVDCTX           SET DCTX SO RDVTOC CAN FIND IT
         STB,2    *6,3
         BAL,0    RDVTOC
         B        MT175             ERROR
         PULL     R5                    R5=AVRTBL ENTRY ADR
         LI,R1    BUFF1             VTOC BUFFER ADDRESS
         LCI      3
         LM,D2    *R1                   D2=:LBL (IF VOLUME INITIALIZED)
         CW,D2    T:LBL             IS THE VOLUME INITIALIZED
         BNE      MT180                 NO,OUTPUT ERROR MESSAGE
*                                       YES;D3,D4=VOLUME SERIAL NO
         CW,D3    0,R5             *DID THE OPERATOR MOUNT THE REQUESTED
*                                   VOLUME
         BNE      MT170                 NO,OUTPUT ERROR MESSAGE
*                                       YES
         LW,R7    7,R1
         BLZ      MT180             1ST CYL AVAIL, BAD NEWS
         LW,7     6,R1              CHECK PFA CNTL WD
         CI,7     X'70000'
         BNE      MT180             NO GOOD
         LI,R7    K1FFFF           *MOVE THE VOLUME'S CYLINDER BIT MAP
         AND,R7   1,R5              TO ITS ALLOCATION  TABLE
         AI,R7    HGP                   R7=ADR OF VOLUME'S ALLOCATION TB
         LI,3     X'FFFF'           CHECK THAT BIT MAP WILL FIT FIRST
         LW,2     VTOC:MAPWL,R1     SIZE OF PACK BITMAP
         CS,2     4,7
         BG       MT195             WONT FIT
         LH,3     2                 GET CYLSZ, IF THERE
         BNEZ     MT100
         LI,3     X'FF'             USE     CYLSZ IN CORE HGP
         STB,3    BUFF1             MAKE WRITE HAPPEN
         AND,3    1,7
         STH,3    2
         STW,2    VTOC:MAPWL,1
MT100    EQU      %
         LI,4     7                 SET CORE HGP TO SAME CYLSZ AS PACK
         STB,3    *7,4
         INT,3    4,7               GET SIZE OF CORE BITMAP
         AND,2    M16               SIZE OF PACK MAP
         SW,3     2                 #WORDS TO ZAP
         AI,3     1                 +1 FOR BDR
         AI,2     2                 MOVE NVAT TOO
         LI,4     5                 START AT WORD 5
         LW,0     *1,4
         STW,0    *7,4
         AI,4     1
         BDR,2    %-3               MOVE ALL PACK BITMAP
         LI,0     0
         BDR,3    %-4               THEN ZAP THE REST
MT110    LW,R4    R1
         AW,R4    VTOC:SNTD,R1          R4=ADR OF VTOC SERIAL NO. TABLE
         LW,3     0,R4
         CI,3     X'FFF00'          MAX SN COUNT
         BANZ     MT180             BAD VTOC
         BAL,R0   GETVNO            WAS A PRIMARY VOLUME REQUESTED
         CI,R3    1     R3=VNO
         BNE      MT140                 NO
         LW,R3    Y02                   YES,SET AVR:PRIM
         STS,R3   1,R5
         LW,R3    0,R4              IS THIS AN UNUSED VOLUM&
         BEZ      MT140                 YES,PUT SERIAL NO IN SNT
MT130    LW,R3    1,R4                  NO,IS THIS THE PRIMARY VOLUME
         CW,R3    1,R1
         BE       MT150                        YES,CONTINUE
         LI,R2    0                            NO,RESET VER AND PRIM
         LW,R3    Y0A                             FLAGS IN AVRTBL ENTRY
         STS,R2   1,R5                            (LEAVE VOL PREMOUNTED)
         LW,R3    1,R4                            AND PUT PRIMARY VOLUME
         BAL,R0   GETSNADR                        NO IN DCB SERIAL NO
         LI,R2    1                               TABLE AND SEARCH
         STW,R3   *D2,R2                          DAVRTBL FOR PRIMARY
         B        MT160
MT140    BAL,R0   GETSNADR         *SECONDARY VOLUME REQUESTED
         LI,R2    1
         LW,R3    *D2,R2                R3=SERIAL NO OF PRIMARY VOLUME
         LW,R0    0,R4                  IS THIS AN UNUSED VOLUME
         BEZ      MT145
*                                           NO,DOES THE VOLUME BELONG
         CW,R3    1,R4                         TO THE SET
         BE       MT150                            YES
         B        MT190                            NO,ERROR
MT145    LI,D2    -1                    YES,SET UPDATED FLAG
         STW,D2   BUFF1
         STW,R2   0,R4                          IN VTOC BUFFER
         STW,R3   *R4,R2
MT150    RES      0
         PUSH     5                 SAVE ENTRY ADDRESS
         BAL,R0   WRVTOC            UPDATE VTOC IF CHANGED
         B        MT175             ERROR, GIVE UP ON IT
         PULL     5
*                                  *RESET AVR:VER,SET  AVR:AVR  TO
         LW,R2    Y2                INDICATE THAT VOLUME MOUNTED AND
         LW,R3    Y68               VERIFIED
         STS,R2   1,R5              SET FLAGS
         SPACE    3
MT160    RES      0
         BAL,5    DERES             RELEASE RESOURCE IN CASE IT CHANGES
         B        AV10
         SPACE    2
MT164    RES      0
*        GET TYPE FROM DCB IN BADEVTP
         LI,R2    0
         LI,R3    K1FFFF
         STS,R2   PAT,R6
         LI,3     BAVNO             ZAP VNO AS ERROR FLAG
         LB,R5    *R6,R3            SAVE IT IN CASE FOREIGN VOL ABORT
         STB,R2   *R6,R3
         CI,R6    K20000  WAS JOB ABORTED BECAUSE FOREIGN VOLUME MOUNTED
         BAZ      MT168       NO,SET DCB:VDCTX=0
         AND,R6   M17         YES,SET DCB:VDCTX=FOREIGN VOLUME NO.
         LW,R2    R5
MT168    LI,R3    BAVDCTX
         STB,R2   *R6,R3
         B        MT160
MT170    BAL,R11  MT184             OUTPUT 'XXXX REEL NO. ERROR'
*O*      MESSAGE: XXXX REEL NO. ERROR
*O*      MEANING: PRIVATE VOLUME DOESNT MATCH OPERATOR KEYIN
*O*      ACTION: MOUNT THE CORRECT VOLUME
         TEXTC    'XXXX REEL NO. ERROR'
MT175    PULL     5
         BAL,11   MT184             OUTPUT 'VTOC I/O ERROR'
*O*      MESSAGE: XXXX VTOC I/O ERROR
*O*      MEANING: ERROR OCCURRED TRYING TO VERIFY PRIVATE VOLUME
*O*      ACTION: MOUNT ON A BETTER SPINDLE OR ABORT THE JOB.
         TEXTC    'XXXX VTOC I/O ERROR'
MT180    BAL,R11  MT184             OUTPUT 'XXXX NOT INIT'
*O*      MESSAGE: XXXX NOT INIT
*O*      MEANING: PRIVATE VOLUME HAS NOT BEEN INITIALIZED OR WAS CLOBBERRED
*O*      ACTION: MOUNT THE CORRECT VOLUME OR ABORT THE JOB
         TEXTC    'XXXX NOT INIT'
MT184    LCI      5                 GET MESSAGE IN 0,1,2,3,4
         LM,R0    *R11
         SCD,0    8                 PUT SERIAL# IN BYTES 1,2,3,4
         LW,R0    0,R5
         SCD,0    -8
         LW,15    5                 GET AVR INDEX FOR CLRDAVR
         AI,15    -AVRTBL
         SLS,15   -1
         BAL,SR4  MOUNT1
         B        MT160
*O*      MESSAGE: XXXX NOT IN SET
*O*      MEANING: THE INDICATED PRIVATE SECONDARY VOLUME HAS A DIFFERENT
*O*       PRIMARY THAN THE ONE IT WAS MOUNTED FOR.
*O*      ACTION: MOUNT THE CORRECT VOLUME (IF THERE IS ONE) OR ABORT THE
*O*       JOB (CAUSING THE SN LIST OF THE PRIMARY TO BE TRUNCATED)
MT190    RES
         AI,R6    K20000           *SET 'FOREIGN VOLUME' FLAG AND TYPE
         BAL,R11  MT184             'XXXX NOT IN SET' AND GIVE OPERATOR
         TEXTC    'XXXX NOT IN SET' A CHANCE TO MOUNT THE CORRECT VOLUME
*                                   (IF VOLUMES HAVE DUPLICATE SN'S) OR
*                                   ABORT THE JOB
*
MT195    RES                        VTOC TOO BIG
         BAL,11   MT184             OUTPUT 'VTOC TOO BIG'
*O*      MESSAGE: XXXX VTOC TOO BIG
*O*      MEANING: THE INDICATED VOLUME'S CYLINDER SIZE IS TOO SMALL FOR
*O*       THE SPINDLE ON WHICH IT IS MOUNTED (SYSGEN CYLIN OPTION)
*O*      ACTION: MOUNT IT ON A SPINDLE WHERE IT FITS
         TEXTC    'XXXX VTOC TOO BIG'
*
*
T:LBL    TEXT     ':LBL'
YB8      DATA     X'B8000000'
YBE      DATA     X'BE000000'
Y68      DATA     X'68000000'
Y18      DATA     X'18000000'
*
*
*
*S*      SCREECH CODE: 22-00
*S*      REPORTED BY: PV
*S*      MESSAGE: PRIVATE VOLUME ALLOCATION ERROR
*S*      TYPE: SUA
PVERR22  SUA      X'22'
BTYC     DATA     X'00FC0000'
KF0000   EQU      X'F0000'
K20000   EQU      X'20000'
         END

