***********************************************************************
*M*      LIMR     PROCESSES THE LIMIT, MESSAGE, TITLE, POOL, SWITCH
*M*               CONTROL COMMANDS
***********************************************************************
*P*
*P*      NAME:    LIMR
*P*
*P*      PURPOSE: TO PROCESS THE LIMIT, MESSAGE, TITLE, POOL, AND SWITCH
*P*               CONTROL COMMANDS
*P*
*P*      DESCRIPTION: SEE FUNCTION PREAMBLES FOR LIMR, MESSR, TITLR,
*P*               POOLR AND SWITCHR ROUTINES.
*P*
*P*      REFERENCE: BATCH PROCESSING REFERENCE MANUAL
*P*
       CSECT       1
         SYSTEM   SIG7FDP
       PAGE
*                 SYMBOLIC REGISTER DEF'S.
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
         PAGE
*                 CHANGE STACK POINTER AMOUNT SPEC. BY 1ST ARGUMENT.
*                 SECOND ARGUMENT SPEC. AVAILABLE REGISTER.
BUMP     CNAME
         PROC
LF       LI,AF(2) AF(1)
         MSP,AF(2)  TSTACK
         PEND
*                 PUSH OR PULL N WORDS SPECIFIED BY 1ST ARGUMENT INTO
*                 REG'S STARTING AT 2ND ARGUMENT.
PUSH     CNAME    X'9',X'B'
PULL     CNAME    X'8',X'A'
         PROC
         DO       NUM(AF)=1
LF       GEN,1,7,4,3,17 0,NAME(1),AF(1),0,TSTACK
         ELSE
         DO       AF(1)=1
LF       GEN,1,7,4,3,17  0,NAME(1),AF(2),0,TSTACK
         ELSE
         DO       AF(1)=16
LF       LCI      0
         ELSE
LF       LCI      AF(1)
         FIN
         GEN,1,7,4,3,17  0,NAME(2),AF(2),0,TSTACK
         FIN
         FIN
         PEND
         REF      TSTACK
         PAGE
         DEF      LIMR              ENTRY POINT TO MODULE FOR PROCESSING
*,*                                 LIMIT COMMAND
         DEF      MESSR             ENTRY POINT TO MODULE FOR PROCESSING
*,*                                 MESSAGE COMMAND
         DEF      TITLR             ENTRY POINT TO MODULE FOR PROCESSING
*,*                                 TITLE COMMAND
         DEF      POOLR             ENTRY POINT TO MODULE FOR PROCESSING
*,*                                 POOL COMMAND
         DEF      SWITCHR           ENTRY POINT TO MODULE FOR PROCESSING
*,*                                 SWITCH COMMAND
         REF      SL:NAME           INPUT-DETERMINE IF SERVICE LIMIT WAS
*,*                                 SPECIFIED ON CONTROL COMMAND
         REF      SV:LIM            EQU; INPUT-MAXIMUM LENGTH OF SERVICE
*,*                                 LIMIT TABLE USED IN DETERMINING
*,*                                 PRESENCE OF SERVICE LIMITS
         REF      J:TITLE           INPUT-DETERMINE IF SERVICE LIMIT
*,*                                 SPECIFIED ON CONTROL COMMAND EXCEEDS
*,*                                 THE SYSTEM MAXIMUM
         REF      TMPDCPK           EQU; OUTPUT-JIT OFFSET USED TO SAVE
*,*                                 VALUE ON COMMAND
         REF      TMPDPPK           EQU; OUTPUT-JIT OFFSET USED TO SAVE
*,*                                 VALUE SPECIFIED ON COMMAND
         REF      SV:RSIZ           EQU; INPUT-MAXIMUM LENGTH OF RESOURCE
*,*                                 LIMIT TABLE USED IN DETERMINING
*,*                                 PRESENCE OF LIMITS ON CONTROL COMMAND
         REF      SH:RNM            INPUT-DETERMINE IF RESOURCE LIMIT
*,*                                 SPECIFIED ON CONTROL COMMAND
         REF      MPPO              EQU; OUTPUT-OFFSET INTO JIT FOR
*,*                                 STORING LO FROM CONTROL COMMAND
         REF      MPO               EQU; OUTPUT-OFFSET INTO JIT FOR
*,*                                 STORING PO FROM CONTROL COMMAND
         REF      MDPO              EQU; OUTPUT-OFFSET INTO JIT FOR
*,*                                 STORING DO FROM CONTROL COMMAND
         REF      MUPO              EQU; OUTPUT-OFFSET INTO JIT FOR
*,*                                 STORING UO FROM CONTROL COMMAND
         REF      LMXCDCD           ERROR CODE CONSTANT
         REF      ATITLE            OUTPUT-OFFSET INTO JIT FOR STORING
*,*                                 TITLE STRING
         REF      EOCCSCAN          SCAN TO END OF CONTROL COMMAND AND
*,*                                 LIST
         REF      GETDECVAL         GET VALUE ASSOCIATED WITH KEYWORD
*,*                                 ON CONTROL COMMAND
         REF      LIST              LIST SPECIFIED MESSAGE ON CONTROL
*,*                                 COMMAND
         REF      SCCLF             SET CONTROL COMMAND LIST FLAG FOR LL
*,*                                 DEVICE
         REF      WDTBLSRH          SCAN SPECIFIED KEYWORD TABLE
         REF      CHARSCAN          GET NEXT ACTIVE CHARACTER FROM CONTROL
*,*                                 COMMAND
         REF      NAMSCAN           GET KEYWORD FROM CONTROL COMMAND
         REF      QUOTSCAN          GET KEYWORD FROM CONTROL COMMAND
*,*                                 AND COMPARE AGAINST SPECIFIED KEYWORD
         REF      DECSCAN           GET DECIMAL VALUE FROM CONTROL COMMAND
         REF      SS                EQU; OUTPUT-OFFSET INTO JIT FOR
*,*                                 STORING SENSE SWITCH SETTINGS
         REF,1    JB:NFPOOL         OUTPUT-BYTE ADDRESS IN JIT FOR STORING
*,*                                 SPECIFIED IPOOLS/FPOOLS
         REF      CBUF              EQU; INPUT-OFFSET INTO PARAMETER TABLE
*,*                                 CONTAINING BUFFER ADDRESS OF INPUT
*,*                                 RECORD
         REF      CCP               EQU; INPUT-OFFSET INTO PARAMETER TABLE
*,*                                 CONTAINING CHARACTER POSITION OF
*,*                                 NEXT CHARACTER IN INPUT RECORD
         REF      CSL               EQU; INPUT-OFFSET INTO PARAMETER TABLE
*,*                                 FOR CHECKING LENGTH OF CHARACTER
*,*                                 STRING SCANNED
         REF      PLB               EQU; INPUT-BUFFER RETAINING MOST
*,*                                 RECENT CHARACTER STRING SCANNED
         REF      BLNKERCD          ERROR CODE CONSTANT
         REF      COMERCD           ERROR CODE CONSTANT
         REF      KWERCD            ERROR CODE CONSTANT
         REF      LPERCD            ERROR CODE CONSTANT
         REF      DECERCD           ERROR CODE CONSTANT
         REF      RPERCD            ERROR CODE CONSTANT
         REF      TERMERCD          ERROR CODE CONSTANT
         REF      X7FFFFFFF         CONSTANT
         REF      YFFFE             MASK
         REF      CCLIST            LIST MESSAGE CONTROL COMMAND
         REF      RAMR              READ ASSIGN-MERGE RECORD
         REF      WAMR              WRITE ASSIGN-MERGE RECORD
         REF      PRDCRM            EQU; OUTPUT-OFFSET INTO JIT FOR
*,*                                 STORING PERMANENT RAD SPACE REMAINING
         REF      PRDPRM            EQU; OUTPUT-OFFSET INTO JIT FOR
*,*                                 STORING PERMANENT DISK SPACE REMAINING
         REF      TMDCRM            EQU; OUTPUT-OFFSET INTO JIT FOR STORING
*,*                                 TEMPORARY RAD SPACE REMAINING
         REF      TMDPRM            EQU; OUTPUT-OFFSET INTO JIT FOR STORING
*,*                                 TEMPORARY DISK SPACE REMAINING
         REF      J:JIT             INPUT/OUTPUT-JIT ADDRESS
         REF      TSTORCD1          ERROR CODE CONSTANT
         REF      TSTORCD2          ERROR CODE CONSTANT
         REF      PSTORCD1          ERROR CODE CONSTANT
         REF      PSTORCD2          ERROR CODE CONSTANT
         REF      NRESERR           ERROR CODE CONSTANT
         REF      RECORD            INPUT-DETERMINE IF TIME IN :USERS
*,*                                 RECORD IS EXCEEDED BY TIME ON
*,*                                 CONTROL COMMAND
         REF      SCCELF            SET CONTROL COMMAND ERROR LISTING
*,*                                 FLAG
         REF      RESOK             RETURN ADDRESS TO CCIR
         REF      AM:PRDC           EQU; POINTER TO REMAINING RAD SPACE
*,*                                 ALLOCATED IN A-M RECORD
         REF      AM:PRDP           EQU; POINTER TO REMAINING PACK SPACE
*,*                                 ALLOCATED IN A-M RECORD
*
         REF      J:ASPIN           PREMOUNTED BITS IN JIT 26383-F00
         REF      JB:CUR            # USR HAS              26383-F00
         PAGE
K0       EQU      0
K1       EQU      1
K2       EQU      2
K3       EQU      3
KC       EQU      X'C'
K11      EQU      X'11'
K8000    EQU      X'8000'
KN15     EQU      -X'15'
KBLANK   EQU      ' '
KCOMMA   EQU      ','
KCRET    EQU      X'15'
KEOB     EQU      X'26'
KLPAREN  EQU      '('
KPERIOD  EQU      '.'
KRPAREN  EQU      ')'
LR:UNML  EQU      30
LR:UBML  EQU      46
LR:UNMR  EQU      94                DISP IN :USRS TO       26383-F00
*                                   RES NAMES LIMITS ARE   26383-F00
LR:UBMR  EQU      102               SET AT THIS OFFSET     26383-F00
*                                   INTO RECORD            26383-F00
         SPACE    3
         CSECT      0
L500     DATA       0                   SL:NAME OFFSET STORED.
GETPAGE  DATA     X'08000001'
FREEPAGE DATA     X'09000001'
         BOUND    8                 WORKING STORAGE        26383-F00
J:ASPIN2 DATA     0,0               FOR MATCHING JIT       26383-F00
J:ASPIN3 DATA     0,0               INFO AGAINST :USERS    26383-F00
M:DMODY  DATA     X'0A000000'       USED FOR FPT           26383-F00
M:DMODX  DATA     0,X'90000000'     SEARCH FOR RES NAME    26383-F00
CURSPIN  DATA     0                 INTERNAL COUNT         26383-F00
JB:CUR2  DATA     0,0,0,0,0         SPACE FOR INTERNAL CNT 26383-F00
SP:RES   DATA     X'E2D70000'       DEFAULT SPINDLES       26383-F00
         CSECT      1
C1LIMR   EQU      %
TXTFPL   TEXTC    'FPOOL'
TXTIPL   TEXTC    'IPOOL'
XSET     TEXT     'SET '
XRESET   TEXT     'RESE'
TXALL    TEXTC    'ALL'
TXTTIME  TEXT     'TIME'
         PAGE
*F*
*F*      NAME:    LIMR
*F*
*F*      PURPOSE: TO PROCESS THE LIMIT CONTROL COMMAND
*F*
*F*      DESCRIPTION: LIMR IS CALLED BY CCIR WHENEVER A LIMIT CONTROL
*F*               COMMAND IS ENCOUNTERED. THE CONTROL COMMAND IS
*F*               PROCESSED AND OUTPUT ON THE LL DEVICE. THE VALUES
*F*               OBTAINED FOR SERVICE LIMITS ARE COMPARED AGAINST
*F*               MAXIMUMS AND STORED IN THE JIT. IF AN ERROR IS
*F*               DETECTED IN PROCESSING THE COMMAND, THE ERROR EXIT IS
*F*               TAKEN AND A RETURN MADE TO CCIR. OTHERWISE, A NORMAL
*F*               EXIT IS MADE TO CCIR.
*F*
*F*      REFERENCE: BATCH PROCESSING REFERENCE MANUAL
*F*
**********************************************************************
*        LIMR     PROCESS LIMIT  CONTROL COMMAND AND STORE           *
*                 VALUES IN JIT                                      *
*        ENTER WITH                                                  *
*                 (R5) =  JIT  POINTER                               *
*                 (R7) =  ADR OF CC PARM LIST                        *
*                 (SR1)=  CUR CHAR OR ZERO                           *
*        IF LIMIT CC IN ERROR ,  RUN STATUS IS SET FOR ABORT         *
**********************************************************************
LIMR     EQU      %
         PUSH     SR4
         LI,R4    K2
         BAL,SR4  SCCLF             SET CC LIST FLAGS FOR LL DEV
         CI,SR1   KBLANK            CHECK IF CURRENT CHAR IS A BLANK
         BNE      LBLNKERR          ERROR IF NO BLANK
LIMR1    EQU      %
         LI,SR2   KLPAREN
         BAL,SR4  CHARSCAN          CHECK FOR LEFT PAREN
         BCS,8    LLPERR            ERROR IF NO LEFT PAREN
         BAL,SR4  NAMSCAN           GET KEYWORD FOLLOWING LEFT PAREN
         LW,R1     PLB,R7             (R1) = 1ST WORD OF KEYWORD.
*CHECK IF SPECIAL KEYWORD SPECIFIED.
         LI,R2    LTBL1             SCAN LIMIT KEYWORD TABLE.
         LI,R3    NLTBL1            (R3) = NO. OF KEYWORDS.
         LI,R4    LIMR5             (R4) = TRANSFER ADR IF SEARCH FAILS.
         BAL,SR4  WDTBLSRH
         EXU      LJTBL1,R3         JUMP TO SPEC'D LOC.
*CHECK IF A SERVICE LIMIT KEYWORD SPECIFIED.
LIMR5    EQU      %
         LI,R2     SL:NAME            (R2) = ADDR OF OPTION NAMES.
         LI,R3     SV:LIM             (R3) = LENGTH OF TABLE.
         LI,R4    LIMR10            (R4) = TRANSFER SDR IF SEARCH FAILS.
         BAL,SR4   WDTBLSRH           SEARCH OPTION NAME TABLE.
         STW,R3    L500               SAVE INDEX FOR LATER TEST.
         LI,R2    LTBL2             SCAN SERV. LIMIT KEYWORD TABLE.
         LI,R3    NLTBL2            (R3) = NO. OF KEYWORDS.
         LI,R4    LIMR10            (R4) = TRANSFER ADR IF SEARCH FAILS.
         BAL,SR4  WDTBLSRH          SEARCH TABLE.
         EXU      LJTBL2,R3         JUMP TO SPEC'D LOC.
         B        LIMR300
*CHECK IF A RESOURCE KEYWORD SPECIFIED.
LIMR10   EQU      %
         LH,R1    R1                IF RESOURCE SPEC. IGNORE AS ITS
         LI,R2    SV:RSIZ           BEEN PROCESSED IN LOGRT.
LIMR15   EQU      %
         CH,R1    SH:RNM,R2
         BNE      LIMR17
LIMR16   EQU      %
         PUSH     R2
         LI,R1    K8000             SCAN OVER SPEC. VALUE.
         BAL,SR4  GETDECVAL         GET VALUE ASSOCIATED WITH KEYWORD.
         PULL     R2
         LI,R3    1                 CHECK IF RESOURCE WAS FLAGGED IN
         LH,SR2   NRESERR,R3        LOGRT DUE TO EXCEED. MAX.
         CH,SR2   SH:RNM,R2
         BE       LMXCD
         B        NXOPT
LIMR17   EQU      %
         BDR,R2   LIMR15
*RBBAT DETECTS ILLEGAL KEYWORDS AND RESOURCES AND ABORTS THE JOB IF
*THE VALUE SPECIFIED IS NOT ZERO. ASSUME A VALUE OF ZERO WAS SPECIFIED
*OR A KEYWORD THAT ONLY RBBAT IS CONCERNED WITH.
         LI,R1    K8000             SCAN OVER VALUE
         BAL,SR4  GETDECVAL
         B        NXOPT             GET NEXT OPTION
*
*
*CHECK IF TIME EXCEEDS SYSTEM MAX. TIME PUT IN JIT BY RBBAT.
*
TIMECHK  EQU      %
         BAL,SR4  GOGET             GET TIME VALUE IN R2
         LI,R1    15                CHECK IF TIME SPEC'D IN :USERS
         LW,SR2   TXTTIME
TIMECHK3 EQU      %
         CW,SR2   RECORD+LR:UNML,R1
         BE       TIMECHK6
         BDR,R1   TIMECHK3
         LW,R1    L500
         CW,R2    J:TITLE,R1        DOES VALUE EXCEED SYSTEM MAX.
         BG       LMXCD             YES,ERROR
         B        NXOPT             GET NEXT OPTION
TIMECHK6 EQU      %
         CW,R2    RECORD+LR:UBML,R1 DOES VALUE EXCEED :USERS MAX.
         BG       LMXCD             YES, ERROR
         B        NXOPT             GET NEXT OPTION
*E*      MESSAGE: EXPECTED TERMINATOR MISSING
*E*      DESCRIPTION: THE CONTROL COMMAND WAS NOT TERMINATED WITH A
*E*               LEGAL TERMINATOR.
*
*
*MAX NUMBER OF GRANULES OF TEMPORARY RAD STORAGE USED BY JOB.
LTSTORE  EQU       %
         BAL,SR4   GOGET            GET TSTORE VALUE IN R2.
         LI,R1    J:JIT+TMDCRM      COMPARE SPEC'D VALUE AND
         BAL,SR4   SPACECHK         .ADJUSTED MAX SPACE IN JIT.
         B          LTST1           -OK
         LI,SR3    TSTORCD1         -NOT ENUF.
         B         TPABORT          .ERROR EXIT.
LTST1    EQU       %
         STW,R2    J:JIT+TMDCRM     STORE TEMP RAD SPACE.
*PEAK CELLS IN JIT ACTUALLY USED AS COUNT DOWN
         STW,R2    J:JIT+TMPDCPK    STORE PEAK TEMP RAD SPACE
         B         NXOPT            GET NEXT OPTION.
*
*MAX NUMBER OF GRANULES OF TEMPORARY DISK STORAGE USED BY JOB
LTDISK   EQU       %
         BAL,SR4   GOGET            GET TDISK VALUE IN R2.
         LI,R1     J:JIT+TMDPRM     COMPARE SPEC'D VALUE AND
         BAL,SR4   SPACECHK         .ADJUSTED MAX SPACE IN JIT.
         B         LTST2            -OK.
         LI,SR3    TSTORCD2         -NOT ENUF.
         B         TPABORT          .ERROR EXIT.
LTST2    EQU       %
         STW,R2    J:JIT+TMDPRM      STORE TEMP DISK PACK SPACE.
*PEAK CELLS IN JIT ACTUALLY USED AS COUNT DOWN
         STW,R2   J:JIT+TMPDPPK     STORE PEAK TEMP DISK PACK SPACE.
        B          NXOPT             GET NEXT OPTION.
*
*MAX NUMBER OF GRANULES OF PERMANENT RAD STORAGE USED BY JOB
LPSTORE  EQU       %
         BAL,SR4   GOGET            GET PSTORE VALUE IN R2.
         LW,R3    L500              COMPARE SPEC'D VALUE AND
         CW,R2    J:TITLE,R3        MAX SPACE IN J:TITLE
         BLE      LPST1
         LI,SR3    PSTORCD1         -NOT ENUF.
         B        TPABORT           .ERROR EXIT
LPST1    EQU       %
         STW,R2    J:JIT+PRDCRM     STORE PERM RAD SPACE.
*FOR PERMANENT SPACE, CHANGE CORRESPONDING ITEM IN A/M RECORD
         PUSH     SR1               SAVE CUR. CHAR. FOR SCAN
         CAL1,8   GETPAGE           GET BUFFER
         BAL,SR4  RAMR              READ A/M RECORD
         MTW,0    SR3               CHECK FOR A/M READ ERROR
         BNEZ     LPST3             ERROR IF SR3 NOT = 0
         LI,R1    AM:PRDC           STORE RAD SPACE REMAINING
         STW,R2   *SR2,R1
         BAL,SR4  WAMR              WRITE A/M RECORD
         MTW,0    SR3               CHECK FOR A/M WRITE ERROR
         BNEZ     LPST3             ERROR IF SR3 NOT = 0
         CAL1,8   FREEPAGE
         PULL     SR1
         B         NXOPT           GET NEXT OPTION.
*
*MAX NUMBER OF GRANULES OF PERMANENT DISK STORAGE USED BY JOB
LPDISK   EQU       %
         BAL,SR4   GOGET            GET PDISK VALUE IN R2.
         LW,R3    L500              COMPARE SPEC'D VALUE AND
         CW,R2    J:TITLE,R3        MAX SPACE IN J:TITLE.
         BLE      LPST2
         LI,SR3    PSTORCD2         -NOT ENUF.
         B         TPABORT          .ERROR EXIT.
LPST2    EQU       %
         STW,R2    J:JIT+PRDPRM     STORE PERMANENT DISK SPACE
*FOR PERMANENT SPACE, CHANGE CORRESPONKING ITEM IN A/M RECORD
         PUSH     SR1               SAVE CUR. CHAR. FOR SCAN
         CAL1,8   GETPAGE           GET BUFFER
         BAL,SR4  RAMR              READ A/M ADDRESS
         MTW,0    SR3               CHECK FOR A/M READ ERROR
         BNEZ     LPST3             ERROR IF SR3 NOT = 0
         LI,R1    AM:PRDP           STORE DISK SPACE REMAINING
         STW,R2   *SR2,R1
         BAL,SR4  WAMR              WRITE A/M RECORD
         MTW,0    SR3
         BNEZ     LPST3             ERROR IF SR3 NOT = 0
         CAL1,8   FREEPAGE          FREE PAGE
         PULL     SR1
        B         NXOPT           GET NEXT OPTION
LPST3    EQU      %
         CAL1,8   FREEPAGE          FREE PAGE
         PULL     SR1               RESTORE CUR. CHAR. FOR SCAN
         B        TPABORT
*
LIMR300  EQU      %
         LW,R3    YFFFE             STORE MASK FOR LO,PO,DO,UO
         LI,R2    K11               SET SHIFT COUNT = 17
         LI,R1    K8000             MAX VALUE FOR LO,PO,DO,UO
         PUSH     3,R2
         BAL,SR4  GETDECVAL         GET VALUE ASSOCIATED WITH KEYWORD
         BCS,8    LIMR370           CHECK IF OK
         PULL     2,R3
         PULL     R0
          LW,R1    L500               COMPARE SERVICE
          CW,R2    J:TITLE,R1         .LIMITS.
          BG       LMXCD              GRTR THAN SYSTEM MAXS. ERROR.
          S,R2     *R0                POSITION FIELD FOR UPPER 15 BITS.
         STS,R2   *R5,R4            STORE VALUE IN JIT
*
*
NXOPT    EQU      %
         LI,SR2   KRPAREN
         BAL,SR4  CHARSCAN          SCAN FOR RIGHT PAREN
         BCS,8    LRPERR            BRANCH IF NOT
NXOPT1   RES      0
         LI,SR2   KCOMMA
         BAL,SR4  CHARSCAN          CHECK FOR COMMA
         BCR,8    LIMR1             BRANCH IF COMMA TO GET NEXT FIELD
         CI,SR1   KPERIOD           CHECK IF CUR CHAR IS A PERIOD
         BE       LIMR350
         CI,SR1   KEOB              CHECK IF CUR CHAR IS AN EOB=X'26'
         BE       LIMR350
         CI,SR1   KCRET             CHECK IF CUR CHAR IS A CARR. RETURN
         BE       LIMR350
         LI,SR3   TERMERCD          (SR1) = ILLEGAL TERMINATOR CODE
         B        LIMR400
*
GOGET    EQU      %
         LW,R1    X7FFFFFFF         MAX. VALUE
         PUSH     SR4
         BAL,SR4  GETDECVAL
         BCS,8    GOGET1            BRANCH IF ERROR WHEN GET FIELD.
         PULL     SR4
         B        *SR4
GOGET1   PULL     SR4               ADJUST STACK AND ABORT.
*
TPABORT  EQU      %
         PULL     SR4
         B        *SR4              BO BACK TO MAIN PROGM(CCIR)
*
*   CHECK USER SPEC. SPACE (PSTORE AND/OR TSTORE) AGAINST AVAILABLE
*    SPACE AS RECORDED IN JIT
*    IF SPEC.<= VAL. IN JIT, O.K. EXIT ON SR4
*     OTHERWISE EXIT ON SR4+1
*         ENTER WITH R1=ADDR. OF ITEM IN JIT
*                   R2=USER SPEC. VAL.
*
SPACECHK EQU      %
         CW,R2    *R1
         BG       %+2
         B        *SR4              NORMAL EXIT
         AI,SR4   1
         B        *SR4
*
*
LIMR350  EQU      %
* LIMIT CC OK, GO LIST IT AND SCAN FOR OTHER LIMIT OR RES CC
*
         MTW,0    NRESERR           WAS THERE A RESOURCE ERROR?
         BNEZ     LIMR405           YES, TAKE ERROR RETURN TO CCIR
         PULL     SR4               KEEP STACK STRAIGHT
         B        RESOK-1           B INTO CCIR
*
LIMR370  EQU      %
         BUMP     -3,R1
         B        LIMR400
*
*E*      MESSAGE: ILLEGAL KEYWORD
LKWERR   EQU      %
         LI,SR3   KWERCD            (SR3) = ILLEGAL KEYWORD ERR CODE
         B        LIMR400
*
*E*      MESSAGE: EXPECTED BLANK MISSING
LBLNKERR EQU      %
         LI,SR3   BLNKERCD          (SR3)= BLANK ERR CODE
         B        LIMR400
*
*E*      MESSAGE: EXPECTED LEFT PARENTHESIS MISSING
LLPERR   EQU      %
         LI,SR3   LPERCD            (SR3) = LEFT PAREN ERR CODE
         B        LIMR400
*
*E*      MESSAGE: SPECIFIED LIMIT EXCEEDS MAXIMUM
*E*      DESCRIPTION: THE SPECIFIED SERVICE OR RESOURCE LIMIT EXCEEDED
*E*               THE USER'S MAXXIMUM.
LMXCD    LI,SR3   LMXCDCD
         B        LIMR400
*
*E*      MESSAGE: EXPECTED RIGHT PARENTHESIS MISSING
LRPERR   EQU      %
         LI,SR3   RPERCD            (SR3)= RIGHT PAREN ERR CODE
*
LIMR400  EQU      %
         LI,R4    1                 SET CC ERROR LIST FLAG (%)
         BAL,SR4  SCCELF
LIMR405  EQU      %
         PULL     SR4
         B        *SR4              ERROR RETURN TO CCIR
*
LTBL1    EQU      %-1               LIMIT KEYWORD TABLE
         TEXT     'RERU'
         TEXT     'ORDE'
         TEXT     'NORD'
         TEXT     'ACCO'
         TEXT     'MOUN'
NLTBL1   EQU      %-LTBL1-1         TABLE LEGNTH
*
LJTBL1   EQU      %-1               LIMIT JUMP TABLE
         B        NXOPT             RERUN
         B        NXOPT             ORDER
         B        NXOPT             NORDER
         B        NXOPT             ACCOUNT
         B        LMNT              MOUNT
*
LTBL2    EQU      %-1               SERVICE LIMIT KEYWORD TABLE
         TEXT     'TIME'
         TEXT     'LO  '
         TEXT     'PO  '
         TEXT     'DO  '
         TEXT     'UO  '
         TEXT     'TSTO'
         TEXT     'PSTO'
         TEXT     'PDIS'
         TEXT     'TDIS'
NLTBL2   EQU      %-LTBL2-1         TABLE LENGTH
*
LJTBL2   EQU      %-1               SERVICE LIMIT JUMP TABLE
         B        TIMECHK           TIME
         LI,R4    MPPO              LO
         LI,R4    MPO               PO
         LI,R4    MDPO              DO
         LI,R4    MUPO              UO
         B        LTSTORE           TSTORE
         B        LPSTORE           PSTORE
         B        LPDISK            PDISK
         B        LTDISK            TDISK
         SPACE    3
LMNT0    CI,SR1   KEOB              CHK END OF CARD
         BE       LIMR350
         LI,SR1   0                 CLEAR PREV CHAR
         BAL,SR4  CHARSCAN          GET 1ST RIGHT PAREN
         BCS,8    LMNT0             NOT YET
LMNT     LI,SR2   KRPAREN           GET 2ND
         BAL,SR4  CHARSCAN            RIGHT PAREN
         BCS,8    LMNT0             NOT YET
*
*F*      NAME:    SPINCHK
*F*
*F*      PURPOSE:  TO VALIDATE BATCH USER REQUEST FOR
*F*                 SHARED SPINDLE MOUNTS AGAINST HIS
*F*                  :USERS AUTHORIZATION.
*F*      DESCRIPTION:  GET J:ASPIN BITS FROM USER JIT
*F*               EQUATE THEM TO EITHER RESOURCE SP
*F*                OR WHATEVER ELSE THEY ARE CALLED AS
*F*                 DEFAULT EITHER SP DP ETC.
*F*               THEN COUNT MOUNTS AS THEY OCCUR AND
*F*                ABORT USER ASKING FOR MORE THAN ALLOWED
*F*
*F*                 INTERFACES WITH NEW CAL IN RDERLOG
*F*                  MODULE TO GET DEVICE NAME FROM
*F*                   A DCT INDEX VALUE
*F*
*F*               ALSO CHECK WHEN ASKING FOR UNMOUNTED
*F*                SHARED SPINDLES.
*F*
*F*               NOT A CALLABLE SUBROUTINE. AS IT IS
*F*                SPECIFICLY FOR SHARED PACKS.
*F*
*
SPINCHK  PUSH     16,R0             MAINTAIN REGS          26383-F00
         SLS,R5   -1                ADJUST JIT INDEX       26383-F00
         LD,R2    J:ASPIN-J:JIT,R5  GET USER SPIN BITS     31038-F00
         SLS,R5   1                 RESET INDEX            26383-F00
         CD,R2    J:ASPIN2          ANY NEW ONES           26383-F00
         BNE      SPIN010           YES CHECK EM OUT       26383-F00
         MTW,-1   CURSPIN           UNMOUNTED REQUEST      26383-F00
         BGZ      SPIN0X1           NO, ALREADY CHECKED    26383-F00
         LI,R2    0                 ZERO FLAG              26383-F00
         LI,SR4   SPIN0X1           FUDGE LINK             26383-F00
         B        SPIN04A           CHECK DEFAULT          26383-F00
SPIN010  STD,R2   J:ASPIN3          SAVE NEW BITS          26383-F00
         EOR,R2   J:ASPIN2          GET ONLY NEW BITS      26383-F00
         LI,R6    -1                BIAS DCT INDEX         26383-F00
SPIN020  BAL,SR4  SPIN040           SEE IF MATCH           26383-F00
         LW,R2    J:ASPIN3+1        NOW DO SECOND WORD     26383-F00
         EOR,R2   J:ASPIN2+1        ONLY NEW BITS          26383-F00
         LI,R6    31                BIASED DCT INDEX       26383-F00
         BAL,SR4  SPIN040           SEE IF MATCH           26383-F00
         LD,R2    J:ASPIN3          NOW REMEMBER NEW ONES  26383-F00
         STD,R2   J:ASPIN2          FOR LATER MOUNTS       26383-F00
SPIN0X1  PULL     16,R0             USER OK RETURN         26383-F00
         B        NXOPT1            VIOLA                  26383-F00
SPIN04A  LI,R7    SV:RSIZ           HOW MANY RESCOURCES    26383-F00
         LH,SR3   SP:RES            DEFAULT IS SP          26383-F00
         CH,SR3   RECORD+LR:UNMR,R7 MATCH DEFAULT          26383-F00
         BE       SPIN060            YES NOW VALIDATE      26383-F00
         BDR,R7   %-2               CHECK EM ALL           26383-F00
SPIN040  LI,R7    SV:RSIZ           HOW MANY RESCOURCES    26383-F00
         CI,R2    0                 DO WE HAVE ANY         26383-F00
         BEZ      *SR4              NO, OR ALL DONE        26383-F00
         LI,R3    0                 SET FOR SHIFT          26383-F00
         SLD,R2   -1                1BY1 SINCE SIG 5       26383-F00
         MTW,1    R6                DOESN'T HAVE SEARCHING 26383-F00
         CI,R3    0                 SHIFT INSTRUCTION      26383-F00
         BEZ      SPIN040           NO BODY YET            26383-F00
SPIN050  OR,R6    M:DMODY           BUILD FPT WORD 1       26383-F00
         STW,R6   M:DMODX           AND STUFF IT           26383-F00
         CAL1,6   M:DMODX           GET DEVICE NAME        26383-F00
         SLS,SR3  16                ADJUST FOR CH          26383-F00
         LH,SR3   SR3               SIGN EXTENSION         26383-F00
         LI,R7    SV:RSIZ           JUST TO BE SURE        26383-F00
         CH,SR3   RECORD+LR:UNMR,R7  CHECK RESCOURCE FOR   26383-F00
         BE       SPIN060             AUTHORIZATION        26383-F00
         BDR,R7   %-2               FOR THIS TYPE          26383-F00
         B        SPIN04A           TRY DEFAULT TYPE       26383-F00
SPIN060  LB,R4    JB:CUR,R7         GET JIT VALUE          26383-F00
         MTB,0    JB:CUR2,7         FIRST TIME             26383-F00
         BNEZ     %+2               NOPE                   26383-F00
         STB,R4   JB:CUR2,7         ESTABLISH START #      26383-F00
         MTB,1    JB:CUR2,7         ADD 1 MORE             26383-F00
         LB,R4    JB:CUR2,7         NOW ITS TRUE VALUE     26383-F00
         CB,R4    RECORD+LR:UBMR,R7 AGAINST :USERS         26383-F00
         BLE      SPIN040           OK SO FAR              26383-F00
SPIN0X2  PULL     16,R0             NOPE, BYE BYE          26383-F00
         B        LMXCD             AN TELL WHY            26383-F00
         PAGE
*F*      NAME:    MESSR
*F*
*F*      PURPOSE: TO PROCESS THE MESSAGE CONTROL COMMAND
*F*
*F*      DESCRIPTION: MESSR IS CALLED BY CCIR WHENEVER A MESSAGE
*F*               CONTROL COMMAND IS ENCOUNTERED. THE MESSAGE
*F*               STRING IS OUTPUT ON THE OC DEVICE PRECEDED BY
*F*               MESSAGE. THE COMMAND ITSELF IS OUTPUT ON THE LL
*F*               DEVICE.
*F*
*F*      REFERENCE: BATCH PROCESSING REFERENCE MANUAL
*F*
**********************************************************************
*        MESSR    PROCESS MESSAGE CC                                 *
*                 THE CONTENTS OF THE MESSAGE CC IS OUT ON THE       *
*                 OC DEVICE PRECEEDED BY !!MESSAGE                   *
*        ENTER WITH                                                  *
*                 (R5) = JIT POINTER                                 *
*                 (R7) = CC PARAM LIST POINTER                       *
*                 (SR1) = CUR CHAR                                   *
*                                                                    *
**********************************************************************
MESSR    EQU      %
         PUSH     SR4
         BUMP     22,R1             RESERVE TEMP STORAGE FOR MESSAGE
         LW,R2    TSTACK
         AI,R2    KN15              (R2) = ADR OF TEMP STORAGE
*
         LCI      K3                MOVE
         LM,D1    MESSRM                FIRST
         STM,D1   0,R2                     OF MSG TO BFR
         LI,R4    KC-1
         BAL,R0   MESSR20           MOVE 2ND PART FROM CCBUF
         LI,R4    K1
         LI,D4    K1
         BAL,SR4  LIST              LIST ON OC DEVICE
         BUMP     -22,R1            RELEASE TEMP STORAGE
*
MESSR6   EQU      %
         LI,R4    K2
         BAL,SR4  SCCLF             SET CC LIST FLAG FOR LL
         BAL,SR4  CCLIST            LIST DON'T SCAN-THERE MAY BE A ';'
MESSR61  RES      0
         PULL     SR4
         AI,SR4   K1
         B        *SR4              EXIT
*
MESSRM   DATA     X'0B4040D4'
         TEXT    'ESSA'
         TEXT    'GE '
*
*
MESSR20  EQU      %
         LW,R1    CBUF,R7           (R1) = ADR OF CC BUFFER
         LW,R3    CCP,R7            (R3) = CUR CHAR POSITION IN CCBUF
MESSR22  EQU      %
         AI,R4    K1
         LB,D1    *R1,R3            MOVE FROM CCBUF
         STB,D1   *R2,R4                          TO TEMP STORAGE
         AI,R3    K1
         CI,D1    KCRET             CHECK OFR CARRIAGE RETURN
         BE       MESSR24
         CI,R3    80                CHECK FOR END OF CCBUF
         BNE      MESSR22
MESSR24  EQU      %
         STB,R4   *R2               STORE BYTE COUNT IN BUFFER
         B        *R0               EXIT
         PAGE
*F*
*F*      NAME:    TITLR
*F*
*F*      PURPOSE: TO PROCESS THE TITLE CONTROL COMMAND
*F*
*F*      DESCRIPTION: TITLR IS CALLED BY CCIR WHENEVER A TITLE
*F*               CONTROL COMMAND IS ENCOUNTERED. THE TITLE STRING
*F*               IS MOVED TO THE JIT(ATITLE) AND IS OUTPUT ON THE
*F*               LL DEVICE.
*F*
*F*      REFERENCE: BATCH PROCESSING REFERENCE MANUAL
*F*
**********************************************************************
*        TITLR    PROCESS TITLE CC                                   *
*                 IF PREVIOUS TITLE BUFFER, MOVES NEW TITLE TO       *
*                 BUFFER, IF NO PREVIOUS TITLE, GETS NEW BUFFER      *
*                 AND STORES ADR IN JIT                              *
*        ENTER WITH                                                  *
*                 (R5) = JIT POINTER                                 *
*                 (R7) = ADR OF CC PARM LIST                         *
*                 (SR1) = CUR CHAR POSITION                          *
**********************************************************************
TITLR    EQU      %
         PUSH     SR4
         LW,R2    R5
         AI,R2    ATITLE            (R2) = ADR OF TITLE BUF
         LI,R4    0
         LI,R0    MESSR6            SET RETURN
         B        MESSR20           MOVE TITLE FRM CCBUF TO NEW BUF
         PAGE
*F*
*F*      NAME:    POOLR
*F*
*F*      PURPOSE: TO PROCESS THE POOL CONTROL COMMAND
*F*
*F*      DESCRIPTION: POOLR IS CALLED BY CCIR WHENEVER A POOL C
*F*               CONTROL COMMAND IS ENCOUNTERED. THE POOL CONTROL
*F*               COMMAND IS PROCESSED AND OUTPUT ON THE LL DEVICE. THE
*F*               VALUE SPECIFIED FOR FPOOL IS STORED IN THE
*F*               JIT(JB:NPOOL).
*F*
*F*      REFERENCE: BATCH PROCESSING REFERENCE MANUAL
*F
**********************************************************************
*        POOLR    PROCESS POOL CC
*                 PROCESS COMMAND AND CALLS SETBUF TO ALLOCATE       *
*                 SPECIFIED BUFFERS                                  *
*        ENTER WITH                                                  *
*                 (SR1) = CUR  CHAR                                  *
*                 (R7) = ADR OF CC PARM LIST                         *
*                 (R5) =  JIT  ADDR                                  *
*                                                                    *
*                                                                    *
**********************************************************************
POOLR    EQU      %
         PUSH     R6
         PUSH     SR4
         LI,R4    2
         BAL,SR4  SCCLF             SET LIST FLAG FOR LL
*
         LI,SR3   BLNKERCD
*E*      MESSAGE: EXPECTED BLANK MISSING
         CI,SR1   ' '               CHECK IF CUR CHAR = BLANK
         BNE      POOLR22           NO, ERROR
         SD,D1    D1                SET D1,D2 TO 0
         PUSH     2,D1
POOLR2   EQU      %
         LI,SR2   '('
         LI,SR3   LPERCD
*E*      MESSAGE: EXPECTED LEFT PARENTHESIS MISSING
         BAL,SR4  CHARSCAN          CHECK FOR LEFT PAREN
         BCS,8    POOLR20
         LI,R6    0
         LI,SR2   TXTFPL
         LI,SR3   KWERCD
*E*      MESSAGE: ILLEGAL KEYWORD
         BAL,SR4  QUOTSCAN          CHECK FOR KEYWORD  'FPOOL'
         BCR,8    POOLR4
         LI,R6    1
         LI,SR2   TXTIPL
         BAL,SR4  QUOTSCAN          CHECK FOR KEYWORD 'IPOOL'
         BCS,8    POOLR20
POOLR4   EQU      %
         LI,R1    512
         BAL,SR4  GETDECVAL         GET VALUE
         BCS,8    POOLR20
         PULL     2,D1
         STW,R2   D1,R6
         PUSH     2,D1
         LI,SR2   ')'
         LI,SR3   RPERCD            CHECK  FOR   ')'
*E*      MESSAGE: EXPECTED RIGHT PARENTHESIS MISSING
         BAL,SR4  CHARSCAN
         BCS,8    POOLR20
         LI,SR2   ','
         BAL,SR4  CHARSCAN
         BCR,8    POOLR2
*
         LI,SR3   TERMERCD
*E*      MESSAGE: EXPECTED TERMINATOR MISSING
         CI,SR1   '.'
         BE       POOLR6
         CI,SR1   X'26'
         BNE      POOLR20
POOLR6   EQU      %
         BAL,SR4  EOCCSCAN          SKIP TO END OF CC
         PULL     2,D1
         MTW,1    *TSTACK
         AW,D1    D2                SUM THE TWO VALUES
         LI,R6    BA(JB:NFPOOL)
         STB,D1   0,R6              STORE # OF FPOOL IN JIT
         B        POOLR22
*
POOLR20  EQU      %
         PULL     2,D1
POOLR22  EQU      %
         PULL     SR4
         PULL     R6
         B        *SR4              EXIT
         PAGE
*F*
*F*      NAME:    SWITCHR
*F*
*F*      PURPOSE: TO PROCESS THE SWITCH CONTROL COMMAND
*F*
*F*      DESCRIPTION: SWITCHR IS CALLED BY CCIR WHENEVER A SWITCH
*F*               CONTROL COMMAND IS ENCOUNTERED. THE SWITCH CONTROL
*F*               COMMAND IS PROCESSED AND PSEUDO SENSE SWITCHES ARE
*F*               SET OR RESET IN THE JIT AS SPECIFIED. THE COMMAND
*F*               IS OUTPUT ON THE LL DEVICE.
*F*
*F*      REFERENCE: BATCH PROCESSING REFENCE MANUAL
*F*
**********************************************************************
*                                                                    *
*        SWITCHR  - PROCESSESS SWITCH CONTROL COMMAND AND            *
*                                                                    *
*                 STORES VALUES IN SS ENTRY IN JIT                   *
*                                                                    *
*        ENTER WITH                                                  *
*                 (R5) = JIT ADR                                     *
*                 (R7) = CHAR PLIST ADR                              *
*                 (SR1) = CUR CHAR                                   *
*                                                                    *
*                                                                    *
*                                                                    *
**********************************************************************
SWITCHR  EQU      %
         PUSH     1,SR4
         LI,R4    K2                SET CONTROL COMMAND LIST FLAG
         BAL,SR4  SCCLF               FOR LL DEVICE
         LI,SR3   BLNKERCD
*E*      MESSAGE: EXPECTED BLANK MISSING
         CI,SR1   KBLANK            CHECK LAST DELIMITER = BLANK
         BNE      ERREXIT             ERROR IF NOT
SWITCHR1 EQU      %
         LI,SR3   LPERCD
*E*      MESSAGE: EXPECTED LEFT PARENTHESIS MISSING
         LI,SR2   KLPAREN            SEARCH CHAR.
         BAL,SR4  CHARSCAN          GET NEXT ACTIVE CHARACTER
         BCS,8    ERREXIT
*
SWITCH01 BAL,SR4  NAMSCAN           GET ALPHANUMERIC NAME
         LW,R1    PLB,R7
         LI,R2    X'3F'
         LI,SR3   KWERCD
*E*      MESSAGE: ILLEGAL KEYWORD
         CW,R1    XSET              WAS NAME = 'SET'
         BE       SWITCH02           BR. IF YES
         LI,R2    K0
         CW,R1    XRESET            WAS NAME = 'RESE'
         BNE      ERREXIT           NO,ERROR
*
SWITCH02 PUSH     1,R2
         LI,SR2   KCOMMA            GET NEXT ACTIVE CHARACTER
         LI,SR3   COMERCD
*E*      MESSAGE: EXPECTED COMMA MISSING
         BAL,SR4  CHARSCAN           AND CHECK IF = COMMA
         BCS,8    SWTCHERR
*
SWITCH03 LI,SR2   TXALL
         BAL,SR4  QUOTSCAN          WAS CHAR. STRING = 'ALL'
         BCS,8    SWITCH04           BR. IF NO
         LI,R3    X'3F'
         PULL     1,R2
         STS,R2   SS,R5
         B        SWITCH09
SWITCH04 EQU      %
         LI,SR3   DECERCD
*E*      MESSAGE: ILLEGAL DECIMAL NUMBER
         BAL,SR4  DECSCAN            GET INDIVIDUAL SETTINGS
         BCS,8    SWTCHERR
         LW,R1    CSL,R7            NO. OF CHARS. NOT OVER 1
         CI,R1    K1
         BNE      SWTCHERR
         LW,R1    PLB,R7
         PULL     R2
         LB,R1    R1
         AI,R1    -X'F1'
         BLZ      ERREXIT
         CI,R1    6
         BG       ERREXIT
         LI,R3    X'20'
         LCW,R1   R1
         SLS,R3   0,R1
         STS,R2   SS,R5
         PUSH     R2
*
         LI,SR2   KCOMMA             IS COMMA
         BAL,SR4  CHARSCAN
         BCR,8    SWITCH04            BR. IF YES, MORE SWITCH SETTING
         PULL     R2
SWITCH09 LI,SR2   KRPAREN
         LI,SR3   RPERCD
*E*      MESSAGE: EXPECTED RIGHT PARENTHESIS MISSING
         BAL,SR4  CHARSCAN
         BCS,8    ERREXIT
*
         LI,SR2   KCOMMA
         BAL,SR4  CHARSCAN          COMMA NEXT
         BCR,8    SWITCHR1
         LI,SR3   TERMERCD
*E*      MESSAGE: EXPECTED TERMINATOR MISSING
*
SWITCH11 CI,SR1   KPERIOD              IS IT A PERIOD ?
         BE       SWITCH12                       YES
         CI,SR1   KEOB                     NO, EOB    ?
         BE       SWITCH12                       YES
         CI,SR1   KCRET                    NO, NL     ?
         BNE      ERREXIT
SWITCH12 BAL,SR4  EOCCSCAN           END FOUND
         B        MESSR61           NORMAL EXIT
*
SWTCHERR EQU      %
         PULL     R2
ERREXIT  EQU      %
         PULL     1,SR4
         B        *SR4
         END

