***********************************************************************
*M*      RUNR     PROCESSES THE RUN CONTROL COMMAND
***********************************************************************
*P*
*P*      NAME:    RUNR
*P*
*P*      PURPOSE: TO PROCESS THE RUN CONTROL COMMAND AND CONSTRUCT THE
*P*               RUN TABLE
*P*
*P*      DESCRIPTION: RUNR IS CALLED BY CCIR WHENEVER A RUN CONTROL
*P*               COMMAND IS ENCOUNTERED. THE CONTROL COMMAND IS
*P*               PROCESSED AND OUTPUT ON THE LL DEVICE. THE
*P*               PARAMETERS ON THE COMMAND ARE USED TO GENERATE A
*P*               RUN TABLE WHICH IS SUBSEQUENTLY USED BY THE MONITOR.
*P*               UPON COMPLETITION OF PROCESSING THE COMMAND, CONTROL
*P*               IS RETURNED TO CCIR.
*P*
*P*      REFERENCE: DATA BASE TECHNICAL MANUAL
*P*                 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
         PAGE
RLMNENTRY     EQU 3
RSTARTENTRY   EQU 10
RBIASENTRY    EQU 1
RXSLENTRY     EQU 0
RUNTBLSZ EQU      12
         PAGE
K0       EQU      X'0'
K1       EQU      X'1'
K2       EQU      X'2'
K3       EQU      X'3'
K4       EQU      X'4'
K8       EQU      X'8'
K10      EQU      X'10'
KF       EQU      X'F'
KBLANK   EQU      ' '
KCOMMA   EQU      ','
KCRET    EQU      X'15'
KEOB     EQU      X'26'
KLPAREN  EQU      '('
KPERIOD  EQU      '.'
KRPAREN  EQU      ')'
         PAGE
         DEF      RUNR              ENTRY POINT TO MODULE FOR PROCESSING
*,*                                 RUN COMMAND
         REF      TREETADR          EQU; OUTPUT-STORE ADDRESS OF RUN TABLE
*,*                                 +1 INTO RUN TABLE
         REF      CHARSCAN          GET NEXT ACTIVE CHARACTER FROM CONTROL
*,*                                 COMMAND
         REF      NAMSCAN           GET KEYWORD FROM CONTROL COMMAND
         REF      CSL               EQU; INPUT-CHECK LENGTH OF CHARACTER
*,*                                 STRING SCANNED
         REF      PLB               EQU; INPUT-BUFFER RETAINING MOST RECENT
*,*                                 CHARACTER SCANNED
         REF      WDTBLSRH          SEARCH RUN KEYWORD TABLE
         REF      TERMERCD          ERROR CODE CONSTANT
         REF      COMERCD           ERROR CODE CONSTANT
         REF      KWERCD            ERROR CODE CONSTANT
         REF      ILLRMNCD          ERROR CODE CONSTANT
         REF      VALERCD           ERROR CODE CONSTANT
         REF      BLNKERCD          ERROR CODE CONSTANT
         REF      EOCCSCAN          SCAN TO END OF CONTROL COMMAND AND
*,*                                 PRINT IT
         REF      RPERCD            ERROR CODE CONSTANT
         REF      CHSTSHFT          SHIFT LMN AND INSERT BYTE COUNT
         REF      GETPASSW          GET PASSWORD FROM COMMAND
         REF      GETAVAL           GET VALUE FROM COMMAND
         REF      RAMR              READ ASSIGN-MERGE RECORD
         REF      ACCN              EQU; INPUT-DEFAULT ACCOUNT FROM JIT
*,*                                 FOR RUN TABLE
         REF      ALOCCT            EQU; OUTPUT-RUN TABLE ADDRESS IN
*,*                                 JIT
         REF      GETACCN           GET ACCOUNT FROM CONTROL COMMAND
         REF      DUPERCD           ERROR CODE CONSTANT
         REF      SCCLF             SET LIST FLAG FOR LL DEVICE
         REF      GETLOC2           GET START ADDRESS OF COMMAND
         REF      RUNFLAG           EQU; OUTPUT-SAVE SEVERITY LEVEL IN JIT
         REF      PPMD              EQU; OUTPUT
*,*                                 BIT 13-RESET PROCESSOR DUMP FLAG IN
*,*                                 JIT
         REF      INDELIMS          INCLUDE HYPHEN/PLUS AS DELIMITERS
         REF      EXDELIMS          EXCLUDE HYPHEN/PLUS AS DELIMITERS
         REF      TSTACK            INPUT/OUTPUT-PRESERVE REGISTERS
         REF      AM:NAME           INPUT; EQU; LAST LMN FOR RUN TABLE
         REF      AM:PASS           INPUT; EQU; LAST LMN PASSWORD FOR
*,*                                 RUN TABLE
         REF      J:LMN             INPUT-LAST LMN CREATED BY LINK
         PAGE
**********************************************************************
*        RUNR     PROCESS RUN CONTROL COMMAND                        *
*        ENTER WITH                                                  *
*                 (R5) = JIT ADR                                     *
*                 (R7) = ADR OF PARAM LIST                           *
*                 (SR1) = CUR CHAR OR ZERO                           *
*                                                                    *
*                                                                    *
*                                                                    *
*                                                                    *
**********************************************************************
RUNR     EQU      %
         PUSH     SR4
         PUSH     R6
         LI,R2    0
         LI,R3    X'40000'
         STS,R2   PPMD,R5           RESET PROCESSOR DUMP FLAG
         LI,R4    K2                SET
         BAL,SR4  SCCLF                 CC LIST FLAGS FOR LL DEV
         CI,SR1   KBLANK
         BNE      RUNR140
         LI,R6    TSTACK+200-RUNTBLSZ
         LI,R2    TSTACK+200-RUNTBLSZ
         LI,R3    X'1FFFF'
         STS,R2   ALOCCT,R5
         LI,R2    8
         STW,R2   RXSLENTRY,R6      STORE XSL DEFAULT IN RUN TABLE
         SLS,R2   8
         LI,R3    X'F00'            STORE XSL DEFAULT VALUE IN JIT
         STS,R2   RUNFLAG,R5
         LI,R2    RUNTBLSZ          (R2) = RUN TABLE SIZE
         LI,R1    0                 INITIALIZE
RUNR1    EQU      %                           TABLE
         STW,R1   *R6,R2                           WITH
         BDR,R2   RUNR1                                ZERO
RUNR2    EQU      %
         LI,SR2   KLPAREN
         BAL,SR4  CHARSCAN          SCAN FOR A LEFT PAREN
         BCS,8    RUNR60
         BAL,SR4  NAMSCAN           GET KEYWORD
         BCS,8    RUNR110           CHECK IF LEGAL KEYWORD
         LW,R0    CSL,R7
         CI,R0    K8                CHECK IF KEYWORD <= 8 CHAR
         BG       RUNR110
*
         LW,R1    PLB,R7            (R1) =  SEARCH WORD
         LI,R2    RUNKWTBL          (R2) = ADR OF RUN KEY WORD TABLE
         LI,R3    NRUNKW            (R3) = NUMBER OF KEYWORDS
         LI,R4    RUNR110           (R4) = SEARCH FAIL RETURN ADR
         BAL,SR4  WDTBLSRH          SEARCH TABLE FOR KEYWORD
         B        RUNJPTBL,R3       GO TO SPECIFIED ROUTINE
*
*        RUN KEYWORD TABLE
*
RUNKWTBL EQU      %
         TEXT     '    '            DUMMY ENTRY
         TEXT     'LMN '
         TEXT     'STAR'
         TEXT     'BIAS'
         TEXT     'XSL '
NRUNKW   EQU      %-RUNKWTBL-1
*
*        RUN JUMP TABLE
*
RUNJPTBL EQU      %
         B        %                 DUMMY ENTRY
         B        RLMN
         B        RSTART
         B        RBIAS
         B        RXSL
*
RUNR50   EQU      %
         LI,SR2   KRPAREN
         BAL,SR4  CHARSCAN
         BCS,8    RUNR160
         LI,SR2   ','
         BAL,SR4  CHARSCAN
         BCR,8    RUNR2
*
RUNR60   EQU      %
         CI,SR1   KEOB
         BE       RUNR70
         CI,SR1   KPERIOD
         BE       RUNR70
         CI,SR1   KCRET
         BE       RUNR70
         LI,SR3   TERMERCD
*E*      MESSAGE: EXPECTED TERMINATOR MISSING
*E*      DESCRIPTION: THE CONTROL COMMAND WAS NOT TERMINATED BY A PERIOD,
*E*               END OF BUFFER(X'26'), OR CARRIAGE RETURN.
         B        RUNR200
*
RUNR70   EQU      %
         LW,R4    R6
         AI,R4    RSTARTENTRY+17
         STW,R4   TREETADR,R6
         LW,R4    RSTARTENTRY,R6
         LB,R4    R4
         AI,R4    4
         SLS,R4   -2
         AI,R4    RSTARTENTRY+1     (R4) = OMDEX TO  REALTIME PARAM
         STB,R4   *R6
         LW,R0    RLMNENTRY,R6
         BNEZ     RUNR72
* INSERT LMN, ACCOUNT, PASSWORD INTO RUN TABLE FROM A/M REC'D. IF
* CREATED BY LOADER. INSERT LMN INTO RUN TABLE FROM J:LMN IF
* CREATED BY LINK.
         PUSH     SR1               WILL BE CHNGED BY GETPGE CAL
         CAL1,8   GPG               GET 1 DYNAMIC PAGE
         LW,R4    SR2               R4=PAGE ADDRESS
         BAL,SR4  RAMR              READ A/M RECORD
         MTW,0    SR3               CHECK FOR A/M READ ERROR
         BNEZ     RUNR200           ERROR IF SR3 NOT = 0
         LCI      K3
         LM,D1    AM:NAME,R4        MOVE LM NAME TO RUN TABLE
         STM,D1   RLMNENTRY,R6
         LCI      K2
         LM,D1    ACCN,R5           MOVE ACCN TO
         STM,D1   RLMNENTRY+3,R6                 RUN TABLE
         LM,D1    AM:PASS,R4        MOVE LM PASSWORD TO RUN TABLE
         STM,D1   RLMNENTRY+5,R6                TO RUN TABLE
         MTW,0    RLMNENTRY,R6      DID A/M RECORD CONTAIN LMN
         BNEZ     RUNR71C           YES
         LCI      K3                IF NOT, PERHAPS LAST LMN CREATED BY
         LM,D1    J:LMN             LINK
         STM,D1   RLMNENTRY,R6
RUNR71C  EQU      %
         CAL1,8   RPG               RELEASE THE PAGE
         PULL     SR1               PULL BACK CURRENT CHRTR
RUNR72   EQU      %
         BAL,SR4  EOCCSCAN          SKIP TO END OF CC
         PULL     R6
         PULL     SR4
         AI,SR4   K4
         B        *SR4
         PAGE
*
RUNR100  EQU      %
*E*      MESSAGE: EXPECTED COMMA MISSING
         LI,SR3   COMERCD
         B        RUNR200
RUNR110  EQU      %
*E*      MESSAGE: ILLEGAL KEYWORD
*E*      DESCRIPTION: THE SPECIFIED KEYWORD WAS NOT RECOGNIZED BY RUNR.
         LI,SR3   KWERCD
         B        RUNR200
*
RUNR120  EQU      %
*E*      MESSAGE: ILLEGAL LOAD MODULE NAME
*E*      DESCRIPTION: THE LOAD MODULE NAME EXCEEDED THE MAXIMUM LENGTH
*E*               OR CONTAINED AN ILLEGAL ALPHANUMERIC CHARACTER.
         LI,SR3   ILLRMNCD
         B        RUNR200
*
RUNR130  EQU      %
*E*      MESSAGE: ILLEGAL VALUE
         LI,SR3   VALERCD
         B        RUNR200
*
RUNR140  EQU      %
*E*      MESSAGE: EXPECTED BLANK MISSING
         LI,SR3   BLNKERCD
         B        RUNR200
*
RUNR160  EQU      %
*E*      MESSAGE: EXPECTED RIGHT PARENTHESIS MISSING
         LI,SR3   RPERCD
         B        RUNR200
*
RUNR170  EQU      %
*E*      MESSAGE: DUPLICATION OF FIELDS
         LI,SR3   DUPERCD
         B        RUNR200
*
RUNR200  EQU      %
         LI,R4    K2
         PULL     R6
         PULL     SR4
         B        *SR4
         PAGE
*        PROCESS  LMN OPTION
RLMN     EQU      %
         LW,R0    RLMNENTRY,R6      CHECK FOR DUPLICATION
         BNEZ     RUNR170
         LI,SR2   KCOMMA
         BAL,SR4  CHARSCAN          CHECK FOR COMMA AFTER LMN KEYWORD
         BCS,8    RUNR100
         BAL,SR4  NAMSCAN           GET LOAD MODULE NAME
         BCS,8    RUNR120           CHECK IF LEGAL ALPHA NUMERIC
         LW,R1    CSL,R7
         CI,R1    K10               CHECK IF NAME <11 CHAR.
         BG       RUNR120
         LW,R0    R7                SHIFT
         AI,R0    PLB                   LMN BY ONE
         LI,R2    K1                             CHAR
         BAL,SR4  CHSTSHFT                           AND INSERT BYTE CNT
*
         LCI      K3                MOVE
         LM,R0    PLB,R7                LMN
         STM,R0   RLMNENTRY,R6               RUN TABLE
         LI,SR2   KCOMMA
         BAL,SR4  CHARSCAN          CHECK FOR A COMMA
         BCS,8    RLMN3
         BAL,SR4  GETACCN           GET ACCOUNT NUMBER
         BCS,8    RUNR200
         LCI      K2
         LM,R0    PLB,R7
RLMN1    EQU      %
         STM,R0   RLMNENTRY+3,R6    STORE ACCOUNT NUMBER
*
         LI,SR2   KCOMMA
         BAL,SR4  CHARSCAN          SCAN FOR COMMA
         BCS,8    RLMN4
         BAL,SR4  GETPASSW          GET PASS WORD
         BCS,8    RUNR130           ILLEGAL PASSWORD
         LCI      K2
         LM,R0    PLB,R7            STORE
RLMN2    EQU      %
         STM,R0   RLMNENTRY+5,R6    STORE PASSWORD
         B        RUNR50
*
RLMN3    EQU      %
         LCI      K2
         LM,R0    ACCN,R5           USE ACCN IN JIT
         B        RLMN1
*
RLMN4    EQU      %
         LI,R0    K0                SET
         LI,R1    K0                    PASSWORD = 0
         LCI      K2
         B        RLMN2
         PAGE
*
*        PROCESS  START OPTION
*
RSTART   EQU      %
         LW,R0    RSTARTENTRY,R6    CHECK FOR DUP.
         BNEZ     RUNR170
         LW,R0    RSTARTENTRY+1,R6  CHECK FOR DUP.
         BNEZ     RUNR170
         LI,SR2   KCOMMA
         BAL,SR4  CHARSCAN          SCAN FOR COMMA
         BCS,8    RUNR100
         BAL,SR4  INDELIMS          MAKE HYPHEN AND PLUS DELIMITERS
         LW,R3    R6
         AI,R3    RSTARTENTRY
         BAL,SR4  GETLOC2
         B        RUNR200
         BAL,SR4  EXDELIMS          EXCLUDE HYPHEN AND PLUS AS DELIMITERS
         STW,R3   TREETADR,R6
         B        RUNR50
         PAGE
*
*        PROCESS  BIAS OPTION
*
RBIAS    EQU      %
         LW,R0    RBIASENTRY,R6     CHECK FOR DUPLICATION
         BNEZ     RUNR170
         BAL,SR4  GETAVAL
         BCS,8    RUNR200
         STW,R2   RBIASENTRY,R6
         B        RUNR50
         PAGE
*
*        PROCESS  XSL  OPTION
*
RXSL     EQU      %
         BAL,SR4  GETAVAL
         BCS,8    RUNR200
         CI,R2    KF
         BG       RUNR130
         STW,R2   RXSLENTRY,R6
         SLS,R2   8                                                     743
         LI,R3    X'F00'                                                743
         STS,R2   RUNFLAG,R5        STORE XSL VALUE IN JIT              743
         B        RUNR50
*  PLIST FOR GETTING 1 PAGE
GPG      GEN,32   X'08000001'
*   PLIST FOR RELEASING 1 PAGE
RPG      GEN,32   X'09000001'
         END

