************************************************************************
*M*      CCIR     CCI EXECUTIVE ROUTINE
***********************************************************************
*P*
*P*      NAME:    CCIR
*P*
*P*      PURPOSE: TO READ THE BATCH CONTROL COMMANDS AND PERFORM THE
*P*               SPECIFIED FUNCTION OR CALL THE APPROPRIATE PROCESSOR
*P*               TO PERFORM IT. CCIR IS THE MAIN DRIVING ROUTINE
*P*               FOR CCI.
*P*
*P*      DESCRIPTION: THE USER COMMUNICATES WITH CP-V IN BATCH MODE
*P*               THROUGH CONTROL COMMANDS THAT ENTER THE SYSTEM VIA
*P*               THE C DEVICE, NORMALLY A CARD READER. THE
*P*               CONTROL COMMANDS SPECIFY FUNCTIONS SUCH AS LOADING,
*P*               COMPILING, OR EXECUTING A PROGRAM. CCI READS THE
*P*               CONTROL COMMANDS AND EITHER PERFORMS THE FUNCTION
*P*               OR CALLS THE APPROPRIATE PROCESSOR TO PERFORM IT.
*P*               CCI ALSO PERFORMS JOB INITIATION FUNCTIONS AS WELL AS
*P*               OUTPUTTING ERROR MESSAGES WHEN IT DETECTS AN ERROR IN
*P*               PROCESSING OF CONTROL COMMANDS.
*P*
*P*               CCI INTERFACES WITH THE MONITOR VIA CALS, TABLES, AND
*P*               FILES USING THE ASSISTANCE OF THE MONITOR.
*P*               CCI USES THE CALS FOR PERFORMING IT'S I/O FUNCTIONS,
*P*               FOR GETTING DYNAMIC DATA PAGES FOR WORKING STORAGE,
*P*               AND FOR RETURNING CONTROL TO THE MONITOR. THE
*P*               INFORMATION FROM THE VARIOUS CONTROL COMMANDS IS
*P*               PASSED TO THE OTHER PARTS OF THE SYSTEM DIRECTLY
*P*               THROUGH A TABLE, OR INDIRECTLY THROUGH THE TABLE
*P*               WRITTEN TO DISK WHERE IT CAN BE RETRIEVED LATER BY
*P*               SOME SYSTEM PROCESSOR OR BY THE MONITOR ITSELF.
*P*
*P*               CCI IS LOADED AND GIVEN CONTROL BY THE MONITOR WHEN
*P*               THE OPERATOR KEYS IN SS. WHEN CCI GETS CONTROL IT
*P*               READS THE CONTROL COMMAND DEVICE UNTIL A JOB OR FIN
*P*               COMMAND IS READ, IGNORING ANY OTHER COMMANDS
*P*               ENCOUNTERED.
*P*
*P*               CCI IS ALSO LOADED AND GIVEN CONTROL WHEN ANY BATCH
*P*               PROGRAM (USER OR PROCESSOR) GIVES UP CONTROL OR IS
*P*               TERMINATED BY THE MONITOR. IF THE PREVIOUS PROGRAM'S
*P*               TERMINATION WAS NORMAL, CCI READS THE CONTROL COMMAND
*P*               DEVICE UNTIL A CONTROL COMMAND IS FOUND, IGNORING ANY
*P*               DATA RECORDS. IF THE PREVIOUS PROGRAM'S TERMINATION
*P*               WAS ABNORMAL, CCI ABORTS THE CURRENT JOB BY READING
*P*               THE CONTROL DEVICE AND IGNORING ALL OF THE DATA
*P*               RECORDS AND CONTROL COMMANDS UNTIL IT ENCOUNTERS A
*P*               JOB OR FIN CONTROL COMMAND.
*P*
*P*               CCI RELINQUISHES CONTROL TO THE MONITOR WHEN A
*P*               PROCESSOR OR USER PROGRAM IS TO BE LOADED OR WHEN IT
*P*               ENCOUNTERS A JOB OR FIN CONTROL COMMAND.
*P*
*P*      REFERENCE: BATCH PROCESSING REFERENCE MANUAL
*P*                 DATA BASE TECHNICAL MANUAL
       CSECT       1
         SYSTEM   SIG7FDP
         SYSTEM   BPM
DEBUG    EQU      0
         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 ARGU4ENT 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
         DEF      EXITM             NORMAL CCI EXIT
         DEF      CCREAD            READS THE C DEVICE UNTIL A CONTROL
*,*                                 COMMAND IS READ AND GETS THE FIRST
*,*                                 FIELD OF THE COMMAND.
         DEF      CREAD             READS ONE RECORD FROM THE C DEVICE
         DEF      CCI50             RETURN POINT FROM CONTROL COMMAND
*,*                                 PROCESS ROUTINES
         DEF      CCI120            ERROR RETURN POINT IF CONTINUATION
*,*                                 RECORD NOT OBTAINABLE
         DEF      COUNTID           COUNT OF DEBUG CONTROL COMMANDS
         DEF      CCIPCH            CCI PATCH AREA
         DEF      RESOK             NORMAL RETURN FROM LIMR
         REF      TSTACK            PRESERVATION OF REGISTERS
         REF      WDTBLSRH          DETERMINES THE PRESENCE OF A JOB,
*,*                                 FIN OR DEBUG CONTROL COMMAND
         REF      SCCELF            INDICATES A FIELD ERROR OCCURRED ON
*,*                                 THE PRESENT CONTROL COMMAND
         REF      SCCLF             SET LOGICAL DEVICE FLAG IN JIT FOR
*,*                                 LISTING CONTROL COMMANDS
         REF      EOCCSCAN          SCAN TO END OF CONTROL COMMAND AND
*,*                                 OUTPUT ON LISTING DEVICE
         REF      ERRLIST           LIST ERROR MESSAGES UPON RETURNING
*,*                                 FROM CONTROL COMMAND ROUTINES
         REF      LIST              LIST 'DATA INFORMATION MISSING'
*,*                                 ON LL DEVICE
         REF      MRT               OUTPUT-STOPS CLOCKING OF THE JOB
         REF      ONOFF             FPT USED FOR PRINTING 'OFF' MESSAGE
*,*                                 ON OPERATOR'S CONSOLE
         REF      RAMR              INPUT; GET COMMAND FILE NAME
         REF      WAMR              OUTPUT; OUTPUT UPDATED ASSIGN-MERGE
*,*                                 RECORD
         REF      AM:CREC           OUTPUT; INCREMENTED COMMAND FILE
*,*                                 RECORD POINTER
         REF      CCLTFLGS          OUTPUT
*,*                                 BIT 14-SET TO INDICATE RUN COMMAND
*,*                                 READ
*,*                                 BIT 15-SET TO INDICATE LOAD COMMAND
*,*                                 READ
         REF      ALOCCT            INPUT-TO OBTAIN ADDRESS OF LOCCT
*,*                                 OUTPUT-SIZE OF LOCCT
         REF      CCBEF             OUTPUT
*,*                                 BIT 8-SET/RESET TO INDICATE IF
*,*                                 CONTROL COMMAND BUFFER IS FULL/EMPTY
*,*                                 BIT 9-SET/RESET TO INDICATE IF
*,*                                 CONTROL COMMAND IS/ISN'T ASSUMED
*,*                                 TO BE A PROCESSOR
         REF      CHSTSHFT          SHIFT PROCESSOR NAME AND INSERT BYTE
*,*                                 COUNT
         REF      READBI            MOVE BINARY TO *IDB FILE
         REF      TOPPAGE           DO TOP OF FORM ON LL AND LO DEVICES
         REF      SERRLF            SET ERROR LISTING FLAGS FOR LOGICAL
*,*                                 DEVICES
         REF      LIMR              PROCESS LIMIT CONTROL COMMAND
         REF      MESSR             PROCESS MESSAGE CONTROL COMMAND
         REF      TITLR             PROCESS TITLE CONTROL COMMAND
         REF      J:CCBUF           CONTROL COMMAND BUFFER USED BY CCI
         REF      CCLIST            LIST CONTROL COMMAND
         REF      Y08               CONSTANT
         REF      SYSID             INPUT-SYSTEM ID STORED IN JIT
         REF      Y01               CONSTANT
         REF      Y008              CONSTANT
         REF      X1FFFF            CONSTANT
         REF      Y06               CONSTANT
         REF      Y05               CONSTANT
         REF      Y8                CONSTANT
         REF      J:STAR            OUTPUT
*,*                                 BIT 0-SET TO PERMIT OPENING OF
*,*                                 EXECUTE ONLY FILES
         REF      XF                CONSTANT
         REF      XFF               CONSTANT
         REF      PLB               INPUT-BUFFER CONTAINING CONTROL
*,*                                 COMMAND READ
         REF      CSL               INPUT-USED WHEN CHARACTER STRING
*,*                                 LENGTH NEEDED
         REF      CBUF              OUTPUT-INITIALIZED TO ADDRESS OF
*,*                                 J:CCBUF FOR USE BY SCAN ROUTINES
         REF      CCRSZ             OUTPUT-INITIALIZED TO NUMBER OF
*,*                                 BYTES IN CONTROL COMMAND FOR SCAN
*,*                                 ROUTINES
         REF      DCBCLS            CLOSE CCI'S OUTPUT DCBS
         REF      X4                CONSTANT
         REF      TREETADR          OUTPUT-DISPLACEMENT OF TREE TABLE
*,*                                 IN LOCCT
*,*                                 INPUT-USED TO SET THE DEFAULT
*,*                                       SEGMENT NAME IN THE TREE TABLE
         REF      TTESIZE           CONSTANT-TREE TABLE ENTRY SIZE
         REF      LMNAME            INPUT-USED TO FORM SEGMENT NAME
         REF      ROMTADR           OUTPUT-DISPLACEMENT OF ROM TABLE IN
*,*                                 LOCCT
*,*                                 INPUT-USED TO CALCULATE
*,*                                 DISPLACEMENT OF ROM TABLE IN LOCCT
         REF      KEYHEAD           INPUT-KEY TO READ LOAD MODULE HEAD
*,*                                 RECORD
         REF      TREER             PROCESS TREE CONTROL COMMAND
         REF      SEGSRCH           SEARCH TREE TABLE FOR SEGMENT NAME
         REF      INCLR             PROCESS INCL CONTROL COMMAND
         REF      OPNSTARF          OPEN STAR FILE
         REF      M:X1              OPENS STAR FILE 'D'
         REF      M:C               READS C DEVICE
         REF      M:LO              DOES TOP OF FORM ON LO DEVICE
         REF      M:LL              DOES TOP OF FORM ON LL DEVICE
         REF      F:CF              READ COMMAND FILE
         REF      Y004              CONSTANT
         REF      J:TELFLGS         INPUT
*,*                                 BIT 18-DETERMINE IF FIRST TIME
*,*                                 THROUGH CCI
*,*                                 BIT 17-DETERMINE IF LDEV PROCESSOR
*,*                                 WAS CALLED
*,*                                 BIT 16-DETERMINE IF WORK STATION WAS
*,*                                 VALID
*,*                                 BIT 13-DETERMINE IF SHOW PROCESSOR
*,*                                 WAS CALLED ON LIMIT ABORT
*,*                                 OUTPUT
*,*                                 BIT 13-INDICATE SHOW PROCESSOR
*,*                                 CALLED ON LIMIT ABORT
*,*                                 BIT 16-INDICATE WORK STATION INVALID
*,*                                 BIT 0 -ERROR MESSAGE IN CCBUF TO
*,*                                 PRINT ON RETURN FROM TEL
         REF      J:TITLE           OUTPUT
*,*                                 BYTE 0-INDICATE TITLE COMMAND HASN'T
*,*                                 BEEN PROCESSED
         REF      J:RNST            INPUT
*,*                                 BITS 0-7-DETERMINE WHETHER JOB
*,*                                 SHOULD BE ABORTED OR JOB STEP IS TO
*,*                                 BE ERRORED/ABORTED
*,*                                 OUTPUT
*,*                                 BIT 1-INDICATE M:XXX CAL EXECUTED
*,*                                 BYTE 0-CLEAR RUN STATUS BEFORE
*,*                                 EXITING CCIR
*,*                                 BIT 8-INDICATE BUFFER FULL
         REF      J:BUP             OBTAIN PROGRAM LOWER LIMIT
         REF      J:EXTENT          OUTPUT
*,*                                 BIT 7-PRESERVE STEP CONDITION CODES
         REF      J:ASSIGN          INPUT
*,*                                 BIT 4-DETERMINE IF JOB IS TO BE
*,*                                 FLUSHED
*,*                                 OUTPUT
*,*                                 BIT 4-INDICATE JOB IS TO BE FLUSHED
*,*                                 ON LIMIT EXCEEDED OR LDEV ERROR
         REF      ACCN              OUTPUT
*,*                                 ENSURE NON-ZERO ACCOUNT AT LOGON
         REF      J:JIT             SELF-EXPLANATORY
         REF      PTREER            PROCESS PTREE CONTROL COMMAND
         REF      RUNERCD           ERROR CODE CONSTANT
         REF      LDEXSTCD          ERROR CODE CONSTANT
         REF      CCORDCD           ERROR CODE CONSTANT
         REF      KWERCD            ERROR CODE CONSTANT
         REF      COMERCD           ERROR CODE CONSTANT
         REF      VALERCD           ERROR CODE CONSTANT
         REF      MODFYR            PROCESS MODIFY CONTROL COMMAND
         REF      PMDR              PROCESS PMD,PMDE,PMDI CONTROL
*,*                                 COMMANDS
         REF      SNAPR             PROCESS SNAP,SNAPC CONTROL COMMANDS
         REF      IFR               PROCESS IF,AND,COUNT CONTROL COMMANDS
         REF      POOLR             PROCESS POOL CONTROL COMMAND
         REF      SWITCHR           PROCESS SWITCH CONTROL COMMAND
         REF      ASSGR             PROCESS ASSIGN CONTROL COMMAND
         REF      LOADR             PROCESS LOAD/LOCCT/OLAY/OVERLAY
*,*                                 CONTROL COMMANDS
         REF      RUNR              PROCESS RUN CONTROL COMMAND
         REF      TELESCPE          PACK THE LOCCT,TREE,ROM TABLES INTO
*,*                                 ONE TABLE
         REF      DEFXREFR
         REF      CCLFLAGS          OUTPUT
*,*                                 BIT 23-PREVENT OR ALLOW LISTING OF
*,*                                 CONTROL COMMANDS
         REF      BLNKERCD          ERROR CODE CONSTANT
         REF      X1000             MASK
         REF      XFFFF             MASK
         REF      LDSYSID           OUTPUT
*,*                                 RIGHT HALF-PROVIDE SYSTEM ID FOR
*,*                                 LOCCT
         REF      CCPL              INPUT-CRPT TABLE MOVED TO STACK FOR
*,*                                 USE BY SCANNING ROUTINES
         REF      CCP               OUTPUT-INITIALIZE CURRENT CHARACTER
*,*                                 POSITION IN CRPT
         REF      CHSTSCAN          GET NEXT CHARACTER STRING
         REF      RLMNENTRY         CONSTANT
         REF      MJCFLG            OUTPUT
*,*                                 BIT 19-FLAG RESET WHEN CONTROL
*,*                                 COMMAND ENCOUNTERED
*,*                                 BIT 19-FLAG SET WHEN DATA BEING
*,*                                 SKIPPED
         REF      NAMSCAN           GET COMPARE OPERATOR ON STEP CONTROL
*,*                                 COMMAND
         REF      GETHEXVAL         GET HEXADECIMAL VALUE FROM STEP
*,*                                 COMMAND
         REF      CPE               OUTPUT
*,*                                 BIT 14-SET TO INDICATE CONTROL
*,*                                 COMMAND READ
         REF      Y002              CONSTANT
         REF      JASSIGN           OUTPUT
*,*                                 BIT 4-SET TO INDICATE JOB IS TO BE
*,*                                 FLUSHED
         REF,1    JB:STEPCC         INPUT
*,*                                 BIT 3-SET BY LDEV PROCESSOR TO
*,*                                 INFORM CCI OF INVALID WORK STATION
         REF      JOBR              PROCESS JOB CONTROL COMMAND
         REF      XEQR              PROCESS XEQ CONTROL COMMAND
         REF      BLANK             USED TO BLANK OUT PASSWORD BEFORE
*,*                                 EXITING TO SHOW
         REF,1    JB:FRS            OUTPUT
*,*                                 BITS 0-7-RESET FINAL RUN STATUS AT
*,*                                 END OF JOB STEP
         REF      CLOSLOG           CLOSE FPT USED AFTER READING :USERS
*,*                                 RECORD FOR SHOW
         REF      KEYBUFF           INPUT-KEY BUFFER ADDRESS FOR READING
*,*                                 :USERS RECORD FOR SHOW
         REF      J:UNAME           INPUT-USER'S NAME TO FORM KEY TO READ
*,*                                 :USERS RECORD FOR SHOW
         REF      CONCAT            CREATE KEY TO READ :USERS RECORD
         REF      J:ACCN            INPUT-ACCOUNT TO FORM KEY TO READ
*,*                                 :USERS RECORD FOR SHOW
         REF      LOGSZ             CONSTANT-:USERS RECORD SIZE
         REF      OPNF              OPEN FILE SPECIFIED ON RUN COMMAND
         REF      JB:PRIV           OUTPUT-SET PRIVILEGE TO READ :USERS
*,*                                 RECORD FOR SHOW
         REF      NRESERR           INPUT-USED TO DETERMINE IF RESOURCE
*,*                                 WAS EXCEEDED IN JOBR
         REF      OPLOG             OPEN FPT USED FOR READING :USERS
*,*                                 RECORD
         REF      M:EO              USED TO READ :USERS RECORD
         REF      INDELIMS          INCLUDE HYPHEN/PLUS AS DELIMITERS
         REF      EXDELIMS          EXCLUDE HYPHEN/PLUS AS DELIMITERS
         REF      Y4                CONSTANT
         REF      LDBUSYCD          ERROR CODE CONSTANT
         REF      INVHDCD           ERROR CODE CONSTANT
         REF      INVTRCD           ERROR CODE CONSTANT
         REF      NOPGERR           ERROR CODE CONSTANT
         REF      RDEXCD            ERROR CODE CONSTANT
         REF      FTRMDM            OUTPUT; INFORMATION MESSAGE
         REF      RDERCFM           ERROR MESAGE
         REF      ILLCFCD           OUTPUT; ERROR CODE CONSTANT
         REF      OPNXS             OPEN EXECUTE FILE AND SKIP TO
*,*                                 SPECIFIED RECORD
         REF      WRCFM             OUTPUT; WRITE COMMAND FILE
*,*                                 INFORMATION MESSAGE
         REF      KCCELMK3          CONSTANT
         REF      PPMD              OUTPUT
*,*                                 BIT 13-SET TO INDICATE PROCESSOR
*,*                                 PMD CONTROL COMMAND READ
         REF      S:SYMDB           BATCH DEVICE AND FEATURE BITS
         REF      S:SYMDO           ONLINE DEVICE AND FEATURE BITS
         REF      SH:SYMT           DEVICE AND FEATURE NAME TABLE
         REF      SV:FTYM           DEVICE AND FEATURE TABLE LENGTH
         REF      SB:RBMX           BATCH RESOURCE LIMIT TABLE
         REF      SB:RODF           ONLINE RESOURCE LIMIT TABLE
         REF      SH:RNM            RESOURCE NAME TABLE
         REF      SV:RSIZ           RESOURCE TABLE LENGTH
         REF      SL:BMX            BATCH SERVICE LIMIT TABLE
         REF      SL:ODF            ONLINE SERVICE LIMIT TABLE
         REF      SL:NAME           SERVICE NAME TABLE
         REF      SV:LIM            SERVICE TABLE LENGTH
         REF      X1FE00            MASK FOR PAGE ADDRESS
         REF      J:ABUF            SAVE BEFORE GOING TO TEL
         REF      J:ABC             ZERO BEFORE GOING TO TEL
         REF      P:NAME            LOOK UP TELS START ADDRESS
         REF      P:SA              LOOK UP TELS START ADDRESS
         REF      PPROCS            LOOK UP TELS START ADDRESS
         PAGE
K0       EQU      0
K1       EQU      1
K2       EQU      2
K5       EQU      5
K100     EQU      X'100'
K200     EQU      X'200'
K201     EQU      X'201'
K40000   EQU      X'40000'
KCOMMA   EQU      ','
KBLANK   EQU      ' '
KPERIOD  EQU      '.'
KBANG    EQU      '!'
LR:PW    EQU      6
DBUGF    EQU      CPE
         SPACE    3
         DEF      JCC               START OF PURE PROCEDURE AND IS
*,*                                 USED FOR PATCHING
JCC      RES      0
KEYTREE  TEXTC    'TREE'
OFF      TEXTC     'OFF'           DATA FOR OC MESSAGE
OFFABRT  TEXTC    'OFF  ABORTED'
TXTRES   TEXT     'RES '
CCFIN    TEXT     '!FIN'
BLNKFIN  TEXT     ' FIN'
TXTEODP  TEXT     'EOD.'
         BOUND    8
TXTEL    TEXTC    'TEL'
         DATA     '    '
DMMSK    EQU      X1000
DMFLAG   EQU      MJCFLG
RUNTBLSIZ EQU     40
         PAGE
*  PROCESS RETURN FROM RESOURCE CHECKING (JOBR)
*    LIMIT AND RES CC CAN BE IN ANY ORDER AFTER JOB CC
* IF RES. CHECK OK, GO SCAN FOR RES & LIMIT CC (JOB WILL BE ABORTED
*        IF ERROR IN LIMIT CC)
* IF RES. CHECK VIOLATED, ALL RES & LIMIT CC WILL BE LISTED BEFORE
*    THE APPRO.ERR MSG. (NO CHECKING DONE FOR LIMIT CC)
*
*
CCI29    PUSH     SR3
         BAL,SR4  EOCCSCAN          SKIP TO END OF CARD
         PULL     SR3               ZERO IF NORMAL,ELSE RES VIOLTN
CCI30    LI,R4    X'12'             *
         BAL,SR4  SCCLF             *SET FLGS  FOR RES OUTPUT TO DO&LL
         AI,SR3   0                 TEST RES ERROR
         BEZ      RESOK
         LW,R1    =X'08000000'      L/BIT 4
         STS,R1   J:ASSIGN          S/FLUSH BIT IN J:ASSIGN
         B        RESVIO
*
         BAL,SR4  EOCCSCAN
RESVIO   EQU      %
         LW,SR2   SR3               SAVE ERROR CODE
         BAL,SR4  CCREAD
         LW,SR3   SR2               RESTORE ERROR CODE
         LW,R2    PLB,R7            IS IT A LIMIT CC
         LW,R3    PLB+1,R7
         CD,R2    TXTLIMIT
         BNE      RESVIO5
         MTW,0    NRESERR           WAS THIS DUE TO A RESOURCE SPEC'D
         BEZ      RESVIO-1          ON LIMIT CC EXCEEDING MAX.
         BAL,SR4  LIMR              YES, SCAN LIMIT CC TO FLAG RESOURCE
         LI,R3    KCCELMK3          CHECK IF CC ERROR LIST FLAG SET
         CS,R3    CCLTFLGS,R5
         BNE      RESVIO-1          IF NOT, GET NEXT CC
         BAL,SR4  EOCCSCAN          SET, SO ABORT
         B        CCI94
RESVIO5  EQU      %
         CW,R1    TXTRES
         BE       RESVIO-1
         B        CCI94             NOW, GO ABORT
*
         BAL,SR4  EOCCSCAN
RESOK    EQU      %
         BAL,SR4  CCREAD
         CW,R1    TXTRES
         BE       RESOK-1           SKIP RES CC
         LW,R2    PLB,R7            IS IT A LIMIT CC
         LW,R3    PLB+1,R7
         CD,R2    TXTLIMIT
         BNE      CCI2              NOT RES OR LIMIT
         BAL,SR4  LIMR              IF ERR FND,RTRN ON SR4
*                                   ELSE RTRN TO RESOK-1
         PAGE
*
*        RETURN  POINTS FROM CONTROL COMMAND PROCESS ROUTINES
*
*
*
CCI50    EQU      %
         B        CCI90             ERROR RETURN
         B        CCI               LIMR,STDLBR,MESSR,TITLR,ASSGR RETURN
         B        CCIFIN            GO EXIT ON FIN CC
         B        CCI200            LOADR  RETURN                RETURN
         B        CCI230            RUNR RETURN
         B        CCI30             JOBR RETURN
         PAGE
STEPR    AI,SR1   -KBLANK           CHK DELIMITER
         BEZ      STEPR1            OK
         AI,SR1   KBLANK-KCOMMA     TRY AGAIN
         BEZ      STEPR1            OPTIONAL COMMA IS OK
         AI,SR1   KCOMMA            RESTORE DELIMITER
*E*      MESSAGE: EXPECTED BLANK MISSING
*E*      DESCRIPTION:  A BLANK DIDN'T FOLLOW STEP ON THE COMMAND.
         LI,SR3   BLNKERCD          ERROR, EXPECTED BLANK MISSING
         B        CCI90
STEPR1   BAL,SR4  NAMSCAN           GET COMPARE OPERATOR
         LI,R2    2                 MUST BE 2 CHARS
         CW,R2    CSL,R7            CHK IT
         BCR,11   STEPR6
*E*      MESSAGE: ILLEGAL KEYWORD
*E*      DESCRIPTION: ILLEGAL COMPARE OPERATOR SPECIFIED.
         LI,SR3   KWERCD            ERROR, ILLEGAL KEYWORD
         B        CCI90
STEPR6   EQU      %
         LI,R4    2                 *LIST STEP CMD ON LP ONLY
         BAL,SR4  SCCLF
         LW,R2    PLB,R7            GET
         LH,R1    R2                 COMPARE OP
         PUSH     3,R1              OPEN UP STACK
         BAL,SR4  HEXSCANP          GET V1
         CI,D3    15                1HEX DIGIT CHK
         BCS,10   CCI120M           NOT HEX OR TOO BIG
         STW,D3   *TSTACK           SAVE V1
         LI,SR4   STEPR2            SET RETURN
         CI,SR1   KCOMMA            CHK DELIMITER
         BE       HEXSCANP          GET V2
         PULL     3,D2              GET OP,NO V2,V1
STEPR8   LI,R1    6                 SCAN
         CH,D2    STEPRT,1           OP
         BE       STEPR10             TABLE
         BDR,R1   %-2
*E*      MESSAGE: ILLEGAL KEYWORD
*E*      DESCRIPTION: ILLEGAL COMPARE OPERATOR SPECIFIED.
         LI,SR3   KWERCD            ERROR, ILLEGAL KEYWORD
         B        CCI90
STEPR10  EQU      %
         LI,3     BA(JB:STEPCC)
         CB,D4    0,3               CHK JIT CC
         EXU      STEPRT1,R1        COND BRANCH
         CI,D3    X'FFFF0'          CHK FOR V2 SPEC'D
         BANZ     %+4               NOPE
         LW,R1    =X'01000000'      L/BIT 7
         STS,R1   J:EXTENT          SET FLAG SO STEP WON'T WIPE OUT STEPCC
         STB,D3   0,3               SET NEW JIT CC
         BAL,SR4  EOCCSCAN
         B        CCI
         SPACE    3
HEXSCANP AI,SR1   -KCOMMA           CHK DELIMITER
         BEZ      GETHEXVAL         OK
         AI,SR1   KCOMMA            RESTORE DELIMITER
         PULL     3,R1              BALANCE STACK
*E*      MESSAGE: EXPECTED COMMA MISSING
*E*      DESCRIPTION: COMMA DIDN'T FOLLOW OPERATOR ON COMMAND.
         LI,SR3   COMERCD           ERROR, EXPECTED COMMA MISSING
         B        CCI90
CCI120M  PULL     3,R1              BALANCE STACK
*E*      MESSAGE: ILLEGAL VALUE
*E*      DESCRIPTION: ILLEGAL VALUE SPECIFIED FOR V1 OR V2 ON COMMAND
         LI,SR3   VALERCD           ERROR, ILLEGAL VALUE
         B        CCI90
         SPACE    3
STEPR2   CI,D3    15                1 HEX DIGIT CHK
         BCS,10   CCI120M           NOT HEX OR TOO BIG
         PULL     D4                GET V1
         PULL     R1                BALANCE STACK
         PULL     D2                GET OP
         B        STEPR8
         SPACE    3
STEPR3   LI,R1    2                 SET JIT CC
         CB,R1    0,3                TO 2
         BLE      %+2                 OR HIGHER
         STB,R1   0,3
         BAL,SR4  EOCCSCAN          FINISH UP STEP CARD
         LI,R6    0                 SET R6=JOB NOT ABORTED
         B        CCISKIP           SKIP THIS STEP
         SPACE    3
STEPRT   DATA,2   0                 OP TABLE
         DATA,2   'GT','LT','EQ','GE','LE','NE'
         SPACE    3
         BOUND    4
STEPRT1  EQU      %-1
         BGE      STEPR3
         BLE      STEPR3
         BNE      STEPR3
         BG       STEPR3
         BL       STEPR3
         BE       STEPR3
         PAGE
*E*      MESSAGE: ILLEGAL CONTROL COMMAND OR CONTROL COMMAND SEQUENCE
*E*      DESCRIPTION: AN INCLUDE CONTROL COMMAND WAS USED IN AN ATTEMPT
*E*                   TO MODIFY A NON-OVERLAID PROGRAM.
CCI120   LI,SR3   ILLCC
*
*        PROCESS  ERROR RETURN
*
CCI90    EQU      %
         LI,R4    X'12'             DO & LL
         BAL,SR4  SERRLF            SET ERR LIST FLAGS
         LI,R4    K0
         CI,SR3   K100
         BL       CCI92
         CI,SR3   X'200'                                                732
         BL       CCI94A
         CI,SR3   X'210'            CHECK IF RES. VIOLATION
         BL       CCI94
         CI,SR3   X'212'            RESOURCE ERR CODE=X'211'
         BGE      CCI94
*RESOURCE VIOLATION DETECTED, GO SCAN FOR RES. CC
* BEFORE PRINTING ERR. MSG.
         B        CCI29
CCI94A   EQU      %
         LI,R4    K1
CCI92    EQU      %
         BAL,SR4  SCCELF            SET CONTROL COMMAND ERR LISTING FLAG
         PUSH     SR3               PRESERVE ERROR CODE
         BAL,SR4  EOCCSCAN          SCAN TO END OF CC
         PULL     SR3               RESTORE ERROR CODE
CCI94    EQU      %                                                     732
         BAL,SR4  ERRLIST           LIST ERROR MESS ON SPECIFIED DEVICES
         LW,R5    Y4
         STS,R5   J:RNST
 BAL,SR4 DCBCLS
         LI,R2    0                 RESET COMMAND FILE MODE BIT
         LW,R3    Y08
         STS,R2   J:JIT
         CAL1,9   X'10603'          M:XXX AFTER ERROR
         PAGE
LAIDOVER EQU      %
         LD,D1    TXTCOLY           LOAD OLAY LATER
         STD,D1   LDTHIS1           SAVE  PROCESSOR  NAME
         B        LOADR
LOADRLOD EQU       %
         LD,D1    TXTCLDR           GET  'LOADER'
         B        LAIDOVER+1
LOCCTPROC EQU   %
         LD,D1    TXTCLOCT
         B        LAIDOVER+1
         PAGE
*
CCI35    LI,R3    X'40000'
         STS,R3   PPMD,R5           SET PROC PMD BIT
         BAL,SR4  EOCCSCAN
*  FALL INTO CCI
*
*  CONTROL COMMAND INTERPRETER
*
CCI      LI,R5    J:JIT
         BAL,SR4  CCREAD            GET 1ST RECORD OF CC
CCI2     LI,SR4   CCI50             SET RETURN
         LI,R3    NCC               # OF CC'S
         CW,R1    CCTBL,R3          SRCH TABLE
         BE       CCBTBL,R3         HIT
         BDR,R3   %-2               TRY AGAIN
*
*  IF DEGUG, LIMIT, OR DATA CONTROL COMMANDS FOUND HERE,
*  THEY'RE OUT OF ORDER.
*
         LCI      2
         LM,R2    PLB,R7
         CD,R2    TXTLIMIT          CHECK IF A LIMIT CC
         BE       CCI10             ERROR
         CD,R2    TXTDATA           CHECK IF A DATA CC
         BE       CCI10             ERROR
         LI,R2    CCTBL3-1          CHECK IF A DEBUG CC
         LI,R3    NDEBUG2+1
         LI,R4    PROCC
         BAL,SR4  WDTBLSRH
CCI10    EQU      %
*E*      MESSAGE: CONTROL COMMAND OUT OF ORDER
*E*      DESCRIPTION: MESSAGE IS OUTPUT FOR THE FOLLOWING CONDITIONS:
*E*                   1. LIMIT CONTROL COMMAND DOES NOT IMMEDIATELY
*E*                      FOLLOW THE JOB CONTROL COMMAND
*E*                   2. DEBUG CONTROL COMMAND DOES NOT IMMEDIATELY
*E*                      FOLLOW THE LOAD OR RUN CONTROL COMMAND
*E*                   3. DATA CONTROL COMMAND OUT OF ORDER
         LI,SR3   CCORDCD           CONTROL COMMAND OUT OF ORDER
         B        CCI90             PRINT ERROR MESSAGE AND ABORT
*  FALL INTO PROCC IF NOT FOUND
*
*
*        CONTROL COMMAND NOT RECOGNIZED
*
*        ASSUME  PROCESSOR CONTROL COMMAND
*
PROCC    EQU      %
         LI,R4    2
         BAL,SR4  SCCLF
         BAL,SR4  CCLIST            LIST COMMAND
         LI,R1    ' '               BLANK
         STB,R1   J:CCBUF           FIRST CHARACTER.
         LW,R1    CSL,R7
         BNEZ     PROCC1            CHECK IF CHAR. STRING LENGTH = 0
         LI,R2    1
         LB,D2    J:CCBUF,R2        ITS A COMMENT IF 1ST CHAR. IS A
         CI,D2    KPERIOD           PERIOD
         BE       CCI
         B        CCI120            ERROR, PROBABLY A BLANK FOLLOWING !
PROCC1   EQU      %
         LW,D2    Y004              SET PCCF FLAG IN JIT
         STS,D2   CCBEF,R5
         ANLZ,R0  PROCC2            GET BUFFER ADDRESS
         LI,R2    1
         BAL,SR4  CHSTSHFT          SHIFT NAME AND INSERT BYTE COUNT
         LCI      3
PROCC2   EQU      %
         LM,R6    PLB,R7            LOAD (R6-R7-SR1) WITH PROCESSOR NAME
         CD,R6    TXTCFTRN          IS IT 'FORTRAN'
         BNE      PROCC3            NO, SKIP
         LD,R6    TXTCFORT          USE 'FORT'
         B        EXITM
PROCC3   EQU      %
         CD,R6    TXTCANSF          IS IT 'ANSF'
         BNE      EXITM             NO, SKIP
         LD,R6    ANSFORT           USE 'ANSFORT'
EXITM    RES      0                 EXIT
         LCI      2                 GET ':SYS'
         LM,D2    SYSACCT#                     ACCOUNT #.
         LI,0     0                 EXIT     EXIT     EXIT
CLS%DCB%EXIT PUSH  R1
         BAL,SR4  DCBCLS
         PULL     R1
         LI,SR2   0                 INDICATE TO STEP - NOT CF PROCESSING
         CAL1,9   1
         PAGE
SETR     LI,R4    2                 LIST ON LL DEVICE
         LI,R5    J:JIT
         BAL,SR4  SCCLF             SET LIST FLAGS
         BAL,SR4  CCLIST
         LW,R1    J:ABUF            SAVE JIT DATA
         LW,R2    J:TELFLGS
         PUSH     2,R1
         LI,R1    X'2001'           SET UP TELFLGS FOR TEL
         STW,R1   J:TELFLGS
         LI,R1    0
         STB,R1   J:ABC             ZERO ABORT CODE FOR TEL
         PUSH     R7
         CAL1,4   ASSTEL
         BCS,8    NOTEL             DIDN'T GET TEL ASSOCIATED
         LW,R7    TELSTART          HAVE WE LOOKED UP TEL'S START?
         BNEZ     GOTOTEL           YES
         LI,R2    P:NAME            LOW ADDRESS
         LI,R3    P:NAME+PPROCS+PPROCS+2  HIGHEST ADDRESS
         BAL,SR4  CVM
         B        NOTEL0            CANT DO CVM
         LI,R2    P:NAME
         SW,R2    R5                R5=REAL PAGE ADDRESS
         AW,R2    R6                R6=VIRTUAL PAGE ADDRESS
         LI,R5    PPROCS
         LD,R6    TXTEL
         CD,R6    *R2,R5
         BE       %+3               FOUND TEL IN P:NAME
         BDR,R5   %-2
         B        NOTELCVM          COULDN'T FIND TEL...
         LW,R1    R5                SAVE TELS INDEX
         AI,SR2   -X'200'           RELEASE CVM PAGES
         CAL1,8   FREVPGS
         BDR,SR3  %-2               SR3=# OF CVM PAGES
         LI,R2    P:SA              LOWEST ADDRESS
         LI,R3    P:SA+PPROCS+1     HIGHEST ADDRESS
         BAL,SR4  CVM
         B        NOTEL0
         LI,R2    P:SA
         SW,R2    R5                R5=REAL PAGE ADDRESS
         AW,R2    R6                R6=VIRTUAL PAGE ADDRESS
         LW,R7    *R2,R1            R1=SAVED INDEX
         AND,R7   X1FFFF            MASK START ADDRESS
         STW,R7   TELSTART
         AI,SR2   -X'200'           RELEASE CVM PAGES
         CAL1,8   FREVPGS
         BDR,SR3  %-2
GOTOTEL  BAL,SR4  *TELSTART
         CAL1,4   DISSTEL           GET RID OF TEL
         PULL     R7
         LI,R5    J:JIT
         PULL     2,R1
         LW,R3    J:TELFLGS         SAVE TELFLGS
         STW,R1   J:ABUF            RESTORE CCI JIT DATA
         STW,R2   J:TELFLGS
         LC       R3                IS ERROR BIT (BBIT0) SET??
         BCS,8    SETERR
         B        CCI
SETERR   LI,R4    X'12'             LL AND DO
         BAL,SR4  SCCLF             ERROR MESSAGE FROM TEL IS IN CCBUF
         BAL,SR4  CCLIST
         B        CCI
NOTELCVM AI,SR2   -X'200'           RELEASE CVM PAGES
         CAL1,8   FREVPGS
         BDR,SR3  %-2
NOTEL0   CAL1,4   DISSTEL
NOTEL    PULL     R7
         PULL     2,R1
         STW,R1   J:ABUF
         STW,R2   J:TELFLGS
         LI,SR3   NOTELMES
         B        CCI90
NOTELMES TEXTC    'CANT GET TEL TO PROCESS SET COMMANDS'
ASSTEL   DATA     X'04000000'
         GEN,8,24 3,'TEL'
         DATA     '    '
DISSTEL  DATA     X'05000000'
         GEN,8,24 3,'TEL'
         DATA     '    '
         PAGE
*
*        PERFORM FUNCTIONS AFTER RECOGNIZING SHOW CC OR AFTER LIMIT ABRT.
*                 1. PUT :USERS RECORD IN COMMON PAGE AND EXIT TO
*                      SHOW PROCESSOR. IF PREVIOUS JOB WAS ABORTED DUE
*                      TO EXCEEDING ITS LIMITS, SHOW BIT SET.
*
*
SHOWR    EQU      %
         LI,SR4   K40000            SET BIT TO INDICATE SHOW WAS CALLED
         STS,SR4  J:TELFLGS         DUE TO PREV. JOB EXCEEDING LIMIT.
         LD,R6    TXTCSHOW          GET 'SHOW'
SHOWR5   EQU      %
         PUSH     3,R5              BUILD KEY FOR READING :USERS REC.
         LI,R4    0                 CLEAR COUNTER FOR KEY
         LI,R3    KEYBUFF           KEY BUFFER ADDRESS
         LI,R7    8                 LENGTH LIMIT FOR ACCOUNT
         LI,R2    J:ACCN            ACCOUNT ADDRESS
         BAL,SR1  CONCAT            PUT ACCOUNT INTO KEY
         AI,R4    1
         LI,R6    X'40'             INSERT SPACE BETWEEN ACCNT. AND NAME
         STB,R6   *R3,R4
         LI,R7    12
         LI,R2    J:UNAME           LENGTH LIMIT FOR NAME
         BAL,SR1  CONCAT            PUT NAME INTO KEY
         STB,R4   *R3
*
         LB,R4    JB:PRIV           PRESERVE USERS PRIVILEGE
         LI,R1    X'C0'             SET PRIV. TO READ :USERS
         STB,R1   JB:PRIV
         M:GCP    1                 GET COMMON PAGE FOR BUFFER
         LI,R1    1                 SET MODE=IN
         LI,R6    ERRRTN            LOAD ERROR RETURN ADDR. FOR OPEN
         LI,R7    ABNRTN            LOAD ABN. RETURN ADDR. FOR OPEN
         CAL1,1   SETEABN           SET ERR/ABN ADDRESS
SHOWR10  EQU      %
         CAL1,1   OPLOG
         CAL1,1   READLOG           READ :USERS RECORD
         CAL1,1   CLOSLOG           CLOSE
*
         LI,R5    LR:PW             BLANK OUT PASSWORD
         LW,D2    BLANK
         STW,D2   *SR2,R5
         AI,R5    1
         STW,D2   *SR2,R5
         LW,R1    SR2               GET COMMON PAGE ADDRESS
         SLS,R1   2                 MAKE BYTE ADDRESS
         LI,R7    3                 THREE ENTRIES IN ADRTAB0
         LD,R2    ADRTAB0,R7        THREE NAME TABLES IN CCI DATA
         AW,R3    R1                ADD COMMON PAGE BYTE ADDRESS
         MBS,R2   0
         BDR,R7   %-3
         LI,R2    S:SYMDB           LOWEST ADDRESS
         LI,R3    S:SYMDO           HIGHEST ADDRESS
         BAL,SR4  CVM               MAP ON TO LOW CORE
         B        CVMDONE           COULDNT DO CVM
         LI,SR1   ADRTAB1           TABLE OF TABLE MOVE (MBS) INFO
         LI,R7    2                 TWO ENTRIES IN ADRTAB1
         BAL,SR4  MOVTBLS           MOVE SYMDO - SYMDB TO COMMON PAGE
         LI,R2    SB:RBMX           LOWEST ADDRESS
         LI,R3    SL:ODF+SV:LIM     HIGHEST ADDRESS
         BAL,SR4  CVM               MAP ON TO LOW CORE
         B        CVMDONE           COULDNT DO CVM
         LI,SR1   ADRTAB2           TABLE TWO OF MBS INFO
         LI,R7    4                 FOUR ENTRIES IN ADRTAB2
         BAL,SR4  MOVTBLS           MOVE TABLES TO COMMON PAGE
         LI,R2    1                 SET FLAG SAYING DFLTS IN PAGE
CVMDONE  SLS,R1   -2                CONVERT TO WORD ADDRESS
         STW,R2   500,R1            SET FLAG
         B        SHOWR15
************************************************************************
*        CVM - MAP ON TO DEFAULT TABLES IN LOW CORE
*           ENTER : R2 - LOWEST ADDRESS AND
*                   R3 - HIGHEST ADDRESS OF REQUESTED TABLES
*           EXIT :  R5 - WORD ADDRESS OF LOWEST REAL PAGE
*                   R6 - WORD ADDRESS OF LOWEST VIRTUAL PAGE
*                   SR3 - NUMBER OF PAGES
*                   SR2 - WORD ADDRESS OF HIGHEST VIR. PAGE +X'200'
***********************************************************************
CVM      AND,R2   X1FE00            GET THE ADDRESSES OF THE PAGES
         AND,R3   X1FE00            CONTAINING HIGH AND LOW ADDRESSES
         SW,R3    R2                CALCULATE THE
         SLS,R3   -9                NUMBER OF PAGES
         AI,R3    1                 TO MAP ON TO
         CAL1,8   GETPGS            SEE WHAT PAGES WE CAN GET
         BCS,8    NOCVM             CANT GET ENOUGH - NO DFLTS IN PAGE
         CAL1,8   FREEPGS           RELEASE PAGES - USE THEM FOR MAP
         LW,R6    SR2               SET UP R6 - VIRTUAL PAGE BASE
         LW,R5    R2                R5 - REAL PAGE BASE
         LW,SR3   R3                R10 - NUMBER OF PAGES
         CAL1,8   CVMCAL            DO THE MAP
         BCS,8    NOCVM             NO GO - NO DFLTS IN COMMON PAGE
         AI,R2    X'200'            INCREMENT PAGES
         AI,SR2   X'200'            UTIL WE GOT
         BDR,R3   %-4               WHAT WE NEED
         AI,SR4   1                 INCREMENT RETURN
         B        *SR4              RETURN
NOCVM    LI,R2    0                 SET FLAG - NO DEFAULTS IN COM. PG.
         B        *SR4              GET OUT
GETPGS   GEN,8,24 X'88',R3          R3 HAS #PAGES
FREEPGS  GEN,8,24 X'89',R3          DITTO
CVMCAL   GEN,8,24 X'87',R2
         DATA     X'80000009'
**********************************************************************
*        MOVTBLS - MOVE DEFAULT TABLES TO COMMON PAGE - RELEASE CVM PAGES
*           ENTER : SR1 - ADDRESS OF MBS INFO. DOUBLEWORD TABLE
*                   R7 - NUMBER OF TABLE ENTRIES
*                   R5 - ADDRESS OF LOWEST REAL PAGE
*                   R6 - ADDESS OF LOWEST VIRTUAL PAGE
*                   SR2 - ADDRESS OF HIGHEST VIRTUAL PAGE + X'200'
**********************************************************************
MOVTBLS  LD,R2    *SR1,R7           GET ADDRESS - BYTE COUNT - DISP.
         SW,R2    R5                SUBTRACT ADDRESS OF LOW REAL PAGE
         AW,R2    R6                ADD ADDRESS OF LOW VIRTUAL PAGE
         AW,R3    R1                ADD COM. PG. BYTE ADR. TO DISP.
         SLS,R2   2                 CONVERT TO BYTE ADDRESS
         MBS,R2   0                 MOVE THE TABLE
         BDR,R7   MOVTBLS           MOVE THE NEXT ONE
         AI,SR2   -X'200'           GET ADD OF HIGHEST PAGE
         CAL1,8   FREVPGS           AND RELEASE IT
         BDR,SR3  %-2               AND ANY LOWER ONES
         B        *SR4              RETURN
FREVPGS  DATA     X'85000009'
*
*ADRTAB0 - THREE OF THE NECESSARY TABLES ARE IN CCI DATA - WE
*USE SH:SYMT, SH:RNM, AND SL:NAME FOR ASSIGN CHECKS AND DONT NEED
*TO DO CVM CALS TO SEE THEM
         BOUND    8
ADRTAB0  EQU      %-2
         DATA     BA(SH:SYMT)
         GEN,8,24 SV:FTYM+1+SV:FTYM+1,412*4
         DATA     BA(SH:RNM)
         GEN,8,24 (SV:RSIZ+1+SV:RSIZ+1),428*4
         DATA     BA(SL:NAME)
         GEN,8,24 SV:LIM+SV:LIM+SV:LIM+SV:LIM+4,480*4
*
*ADRTAB1 AND ADRTAB2 - THESE ARE DOUBLEWORD TABLES CONTAINING THE
*INFORMATION NEEDED TO MOVE THE DEFAULT TABLES TO THE COMMON PAGE
*THE FORMAT IS:
*          WORD 0 - ADDRESS OF THE TABLE IN LOW CORE
*          WORD 1 - BYTE 0 - TABLE LENGTH IN BYTES
*                 - BYTE 3 - BYTE DISPLACEMENT OF TABLE IN COMMON PAGE
*
* NOTE: THESE TABLES SPLIT THE NEEDED TABLES INTO TWO GROUPS BASED ON
* THEIR ADDRESSES IN LOW CORE. THE CURRENT ASSUMPTION IS THAT S:SYMDO
* AND S:SYMDB ARE NOT LOCATED NEAR THE OTHER TABLES WHICH ARE ALL
* RELATIVELY CLOSE IN ADDRESS. A SECOND ASSUMPTION IS THAT S:SYMDO
* HAS A HIGHER ADDRESS THAN S:SYMDB AND THAT OF THE OTHER GROUP
* SH:SYMT HAS THE LOWEST AND SL:ODF THE HIGHEST ADDRESS.
ADRTAB1  EQU      %-2
         DATA     S:SYMDB
         GEN,8,24 4,410*4
         DATA     S:SYMDO
         GEN,8,24 4,411*4
ADRTAB2  EQU      %-2
         DATA     SB:RBMX
         GEN,8,24 (SV:RSIZ+1),420*4
         DATA     SB:RODF
         GEN,8,24 (SV:RSIZ+1),424*4
         DATA     SL:BMX
         GEN,8,24 SV:LIM+SV:LIM+SV:LIM+SV:LIM+4,440*4
         DATA     SL:ODF
         GEN,8,24 SV:LIM+SV:LIM+SV:LIM+SV:LIM+4,460*4
SHOWR15  PULL     3,R5
         STB,R4   JB:PRIV           RESTORE USERS PRIVILEGE
         LI,SR4   K40000
         CW,SR4   J:TELFLGS         WAS PREV JOB ABRTD FOR LIM EXCD
         BANZ     EXITM             YES, EXIT TO SHOW PROCESSOR
         B        PROCC             NO, PRINT SHOW CC AND EXIT TO SHOW.
*
*
ABNRTN   EQU      %
         SLS,SR3  -17
         CI,SR3   X'A01'            WAS FILE BEING UPDATED
         BNE      ERRRTN            NO
         M:WAIT   1                 YES, WAIT 1 SEC. AND TRY AGAIN
         B        SHOWR10
ERRRTN   EQU      %
         STB,R4   JB:PRIV           RESTORE USERS PRIVILEGE
         LW,SR3   M:EO              CHECK IF M:EO IS OPEN
         CW,SR3   Y002
         BAZ      ERRRTN5           NO
         CAL1,1   CLOSLOG           YES, CLOSE IT
ERRRTN5  EQU      %
*E*      MESSAGE: UNABLE TO READ :USERS FILE
         LI,SR3   UNREUERM          UNABLE TO READ :USERS FILE
         PULL     3,R5              RESTORE JIT AND CCPARAM ADDR.
         B        CCI90             PUT OUT MSGE. AND ABORT
         PAGE
*
*        PERFORM FUNCTIONS AFTER PROCESSING LOAD CC:
*
*                 1. READ BI DEVICE IF OPTION SPECIFIED
*
*                 2. PROCESS TREE CC IF ONE, ELSE BUILD A ONE
*
*                    ENTRY TREE TABLE  WITH SEGMENT NAME = LOAD
*
*                    MODULE NAME
*
*
*
CCI200   EQU      %
         LW,R4    ALOCCT,R5
         LI,R1    X'800'
         AND,R1   0,R4              IF BI OPTION ON LOAD CC
         BEZ      CCI200A
         LW,R1    Y004              IF MAPONLY DON'T NEED *IDB
         AND,R1   0,R4
         BNEZ     CCI200A
         BAL,SR4  READBI            MOVE BI INFO. TO DISC FILE *IDB
         B        CCI90             ERROR RETURN
CCI200A  EQU      %
         BAL,SR4  CCREAD
         LW,R2    PLB,R7
         CLM,R2   TXTREE
         BE       CCI201
         BCS,12   CCI200B           NOT PTREE
         LI,SR4   CCI201A-1         SET RETURN
         B        PTREER            PROCESS PTREE CONT COM
CCI200B  EQU      %                                                     732
         LW,R1    Y008              SET CC
         STS,R1   CCBEF,R5                BUFFER FULL FLAG
         LW,R3    ALOCCT,R5
         LW,R1    TREETADR,R3
         LI,R2    TTESIZE
         STW,R2   0,R1
         LCI      3                    SEGMENT
         LM,D2    LMNAME,R3                        NAME
         AW,D2    Y01
         LB,R2    D2
         LI,R3    0
         STB,R3   D2,R2             SET LAST BYTE OF SEG. NAME = 0
         LCI      3
         STM,D2   1,R1                            = LOAD MODULE NAME
         STW,R3   4,R1
         STW,R3   5,R1
         B        CCI202
CCI201   EQU      %
         BAL,SR4  TREER
         B        CCI90
CCI201A  EQU      %                                                     732
         LI,R1    K200
         LW,R2    ALOCCT,R5
         STS,R1   0,R2              SET OLAY FLAG
CCI202   EQU      %
         LI,D1    K1                SET FLAG TO INDICATE LOAD
         PAGE
*
*        PERFORM  FUNCTIONS AFTER LOAD AND RUN CC
*
*                 1. PROCESS ANY DEBUGS
*
*                 2. WRITE  OUT LOAD TABLE IF LOAD CC
*
*
*
CCI203   EQU      %
         PUSH     D1                SAVE FLAG
         SLS,D1   16
         LI,D2    X'30000'
         STS,D1   CCLTFLGS,R5
         LI,R2    0                                                     732
         LI,R3    X'20000'                                              732
         STS,R2   DBUGF,R5          CLEAR PMD FLAG IN JIT               732
         LI,R4    2
         BAL,SR4  SCCLF             SET CC LIST FLAGS
*
CCI204   EQU      %
         BAL,SR4  CCREAD            READ CONTROL COMMAND
         PULL     D1
         LI,R2    CCTBL3
         LI,R3    NDEBUG1
         CI,D1    K1                CHECK IF LOAD OR RUN STUATION
         BANZ     CCI205
         LI,R3    NDEBUG2           RUN
CCI205   EQU      %
         LI,R4    CCI214
         BAL,SR4  WDTBLSRH          SEARCH DEBUG TABLE
         OR,D1    X4
         PUSH     D1
         CI,D1    K1                CHECK IF LOAD
         BANZ     CCI206
         CW,R1    TXTSNAP
         BNE      CCI206
         LW,R2    PLB+1,R7
         CW,R2    TXTC              CHECK IF SNAPC COMMAND
         BE       CCI206
         AI,R3    -1
CCI206   EQU      %
         LW,R4    ALOCCT,R5
         LW,R1    TREETADR,R4       (R1) = ADR OF TREE TABLE
         LW,R2    0,R1              (R2) = NO. OF WORDS IN TREE TABLE
         LW,D4    R1
         AW,D4    R2
         AI,R1    1                 (R1) = ADR OF 1ST ENTRY IN TREE
         CI,R2    12                CHECK IF ONLY ONE ENTRY IN TREE
         BLE      CCI207            IF MORE THAN ONE ENTRY
         CI,SR1   ' '               CHECK IF NO SEG NAME                732
         BNE      %+3
         OR,R1    Y8                FLAG IN TSTACK , DOING ALL
         B        CCI207A1
         PUSH     R3                                 THEN OVERLAY
         BAL,SR4  SEGSRCH           GET SEGMENT NAME AND SEARCH TREE
         BCS,8    CCI226
         PULL     R3
CCI207   EQU      %
         CI,SR1   ' '               CHECK FOR BLANK
         BNE      CCI224
CCI207A1 RES      0
         AI,D4    K2                (D4) = ADR OF 1ST WORD OF BUFFER
         LI,R2    K0
         STW,R2   *D4               SET 1ST WORD OF BUFFER = 0
         STB,R3   *D4               STORE COMMAND ID IN 1ST WORD
         LI,SR4   CCI208            (SR4) = RETURN ADR
         PUSH     SR4
         PUSH     R1
         STW,D4   D3                (D3) = ADR OF 1ST WORD OF BUFFER
         AI,D4    1
         PUSH     2,D3
         LW,R0    M:X1                                                  732
         CW,R0    Y002              CHECK IF M:X1 OPEN TO DEBUG FILE    732
         BANZ     CCI207A           YES                                 732
         PUSH     11,R3             NO, PERFORM OPEN                    732
*                                                                       732
*        OPEN DEBUG FILE IN OUT MODE                                    732
*                                                                       732
         LI,R2    2                 SET FUNC. OUT                       732
         LI,R3    2                 SET ORG = KEYED
         LI,R4    'D'
         SD,D3    D3                ERR & ABN =0
         BAL,SR4  OPNSTARF          OPEN SYSID FILE
         PULL     11,R3                                                 732
CCI207A  EQU      %                                                     732
         BAL,SR4  INDELIMS          INCLUDE HYPHEN/PLUS AS DELIMITERS
         B        CCBTBL3,R3        PROCCES DEBUG CC
*
CCI208   EQU      %
         B        CCI211            NORMAL RETURN
         BAL,SR4  EXDELIMS          EXCLUDE HYPHEN/PLUS AS DELIMITERS
         PULL     D1                ERROR RETURN
         B        CCI90
CCI211   EQU      %
         BAL,SR4  EXDELIMS          EXCLUDE HYPHEN/PLUS AS DELIMITERS
         B        CCI204            NORMAL RETURN
*
CCI214   EQU      %
         CI,D1    K1                CHECK IF LOAD OR OVERLAY
         BAZ      CCI216
         CW,R1    TXTINCL           CHECK IF INCL CC
         BNE      CCI216            BRANCH IF NOT
         LW,R2    ALOCCT,R5
         LI,R1    K200
         LS,R1    0,R2              CHECK IF OVERLAY
         BEZ      CCI120
         PUSH     D1
         BAL,SR4  INCLR             PROC INCL CC
         B        CCI204            NORMAL RETURN
         PULL     D1
         B        CCI90
         PAGE
*
*
*        PROCESSING OF DEBUG CONTROL  COMMANDS COMPLETE,
*
*                 CLOSE  AND  SAVE   FILE
*
CCI216   EQU      %
         CW,R1    TXTDATA           CHECK IF DATA CC
         BE       CCI218
         LW,R1    Y008              IF NOT DATA CC, SET
         STS,R1   CCBEF,R5                         CC BUF FULL FLAG
CCI218   EQU      %
         LW,R0    M:X1                                                  732
         CW,R0    Y002              CHECK IF M:X1 OPEN TO DEBUG FILE    732
         BAZ      CCI218A           NO                                  732
         CAL1,1   CLSFILE           CLOSE AND SAVE FILE
         LI,R3    X'10000'                                              732
         STS,R3   DBUGF,R5          SET DEBUG FLAG                      732
         B        CCI219                                                732
CCI218A  EQU      %                                                     732
         LI,R3    X'10000'                                              732
         CW,R3    DBUGF,R5          CHECK IF OLD DEBUG FILE PRESENT     732
         BAZ      CCI219            NO                                  732
         LI,R2    0                                                     732
         STS,R2   DBUGF,R5          YES, RESET DEBUG FLAG               732
         PUSH     D1
         LI,R2    1
         LI,R3    2                 SET ORG = KEYED
         LI,R4    'D'
         SD,D3    D3                ERR & ABN = 0
         BAL,SR4  OPNSTARF          OPEN SYSID FILE
         LW,R6    M:X1              CHECK IF M:X1 OPEN
         CW,R6    Y002
         BAZ      CCI217A
         CAL1,1   CLSRFILE
CCI217A  EQU      %
         PULL     D1
CCI219   EQU      %
*
         LW,R6    ALOCCT,R5
         AND,R6   X1FFFF            (R6) = ADR OF LOCCT
         CI,D1    2                 CHECK IF !RUN WAS PROCESSED
         BAZ      CCI221
         LI,D2    0
         CI,D1    4
         BAZ      CCI220
         LI,D2    1
CCI220   EQU      %
         STW,D2   TREETADR,R6       SET DEBUG FLAG IN RUN TABLE
         LI,R3    RUNTBLSIZ
         LW,2     ALOCCT,R5
         BAL,11   MOVEIT
         LW,6     2
 B CLS%DCB%EXIT
CCI221   EQU      %
*
         LW,R1    SYSID,R5
         AND,R1   XFFFF             (R1) = SYSTEM ID OF CUR JOB
         STS,R1   LDSYSID,R6        STORE SYSID IN LOCCT
*
*        PACK UP  LOAD TABLE, TREE TABLE, AND ROM TABLE
*
         BAL,SR4  TELESCPE
         LW,SR3   D2                CHECK IF ERROR IN TELESCPE
         BNEZ     CCI90
         LW,R2    R6                (R2)= ADR OF LOCCT                  732
         LW,R3    R0                (R3)= END ADR OF LOCCT+1            732
         LW,D1    JASSIGN,R5        (D1)=ASSGN FLGS;WAS ASMF
         LI,D2    X'200'                                                732
         STS,D1   0,R6              STORE ASSIGN PRESENT FLAG IN LOCCT  732
         SW,R3    R2                (R3) = WORD SIZE OF LOCCT
         LW,D1    R3
         LI,D2    X'1FFFF'
         STS,D1   ALOCCT,R5         STORE LOCCT SIZE IN JIT
         LCW,D2   R2
         AWM,D2   ROMTADR,R2        CHANGE ROMT ADR TO A DISPLACEMENT
         AWM,D2   TREETADR,R2       CHANGE TREE ADR TO A DISPLACEMENT
         BAL,11   MOVEIT
*
*
         LW,R4    0,R2              (R4) = 1ST WORD OF LOCCT
         CI,R4    8                 CHECK IF LOAD MODULE NAME IS PERM
         BANZ     CCI222            YES
         PUSH     R2                NO, WRITE OUT LM NAME IN SYSIDT
         LI,SR4   CCI225            SET RETURN
         LI,R4    'T'               SET NAME = T
         LI,R2    4                 SET FUNCTION = INOUT
CCI223   EQU      %
         LI,R3    2                 SET ORG. = KEYED
         SD,D3    D3                ERR & ABN = 0
         B        OPNSTARF          OPEN SYSID FILE
CCI225   EQU      %
         PULL     R2                (R2) = ADR OF LOCCT
         AI,R2    LMNAME            (R2) = ADR OF LM NAME IN LOCCT
         CAL1,1   WRTLMN            WRITE LM NAME AS KEY IN SYSIDT FILE
         CAL1,1   CLSFILE           CLOSE AND SAVE SYSIDT FILE
CCI222   EQU      %
         LD,R6    LDTHIS1           GET NAME OF PROC TO BE LOADED.
         B        EXITM             EX
         SPACE    3
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
MOVEIT   RES      0
         LW,R1    R3                SIZE OF LOCCT
         AI,R3    512               ROUND UP BY 1 WORD AND 1 PAGE
         SLS,R3   -9                COMPUTE NR OF PAGES
         DO       DEBUG
         OR,R3    Y08               DYNAMIC PAGES FOR DEBUG
         ELSE
         OR,R3   =X'0C000000'
         FIN
         CAL1,8   3                 COM PAGES
         BCS,8    %                 ERROR
         LW,R3    9                 TO
         AI,R1    1                 FIRST WORD OF TABLE
         STW,R1   0,R3              SHALL BE IT'S SIZE.
         AI,R3    1                 BUMP STORE POINTER
         BDR,R1   LOCCTMV           TO TABLE MOVE
LOCCTMV1 AI,R3    1
         AI,R2    1
LOCCTMV  LW,D1    0,R2              FROM
         STW,D1   0,R3              TO
         BDR,R1   LOCCTMV1          NR
*
         LW,D1   =X'090000FF'
         DO       DEBUG
         NOP
         ELSE
         CAL1,8   D1                FREE DYN
         FIN
         LW,R2    9
         AI,R2    1                 TO COMPENSATE FOR XTRA WORD.
         B        *SR4
         PAGE
*
*
*        WRITE LOAD MODULE NAME PLIST
*
WRTLMN   EQU      %
         GEN,8,24 X'11',M:X1
         DATA     X'F8000070'
         DATA     0
         DATA     0
         DATA     %
         DATA     0
         GEN,8,24 X'80',R2
*
*        CLOSE   FILE  PLIST
*
CLSFILE  EQU      %
         GEN,8,24 X'15',M:X1
         DATA     X'80000000'
         DATA     2
CLSRFILE EQU      %
         GEN,8,24 X'15',M:X1
         DATA     X'80000000'
         DATA     1
*
CCI224   EQU      %
*E*      MESSAGE: EXPECTED BLANK MISSING
*E*      DESCRIPTION: OVERLAY SEGMENT NAME WAS SPECIFIED ON A DEBUG
*E*                   CONTROL COMMAND FOR A NON-OVERLAID PROGRAM
         LI,SR3   BLNKERCD
         B        CCI228
CCI226   EQU      %
         PULL     R1
CCI228   EQU      %
         PULL     R1
         B        CCI90
         PAGE
*
*        PERFORM  FUNCTIONS AFTER RUN CC
*
*                 1. VERIFY LEGAL LOAD MODULE NAME
*
*                 2. READ IN TREE FROM LOAD MODULE AFTER RUN TABLE
*
*
*
CCI230   EQU      %
         LI,R3    2                 SET ORG TO KEYED
         LW,R4    ALOCCT,R5         (R4) = ADR OF FILENAME= LOAD MODULE
         AND,R4   X1FFFF                                          NAME
         PUSH     R4
         AI,R4    RLMNENTRY
         LB,D1    *4                GET TEXTC COUNT
         CI,D1    12                MAXIMUM POSSIBLE SIZE
         BGE      CCI241            INVALID FILENAME
         LW,D1    3,R4              CHK IF ACCN
         BEZ      CCI230A           NO                                  732
         ANLZ,D1  %-2               SET D1=ADR OF AC#
CCI230A  EQU      %                                                     732
         LW,D2    5,R4              CHK IF PSWD
         BEZ      CCI230B                                               732
         ANLZ,D2  %-2               SET D2=ADR OF PSWD
CCI230B  EQU      %                                                     732
         LW,SR4   Y8                ALLOW OPEN OF EXECUTE ONLY FILE
         STS,SR4  J:STAR
         LI,D3    CCI236            ERR ADR FOR DCB
         BAL,SR4  OPNF              OPEN LM
         CI,SR3   0                 CHECK IF FILE OPENED
         BNE      CCI240            NO
         LW,R2    M:X1+5            -YES. CHECK
         LI,R3    X'FF'             .IF THE FILE IS
         CS,R2    =X'22'            ..A KEYED FILE
         BNE      CCI237            -NO.
         PULL     R2                (R2) = ADR OF RUN TABLE
         AI,R2    RUNTBLSIZ         END ADR OF RUN TABLE +1
         LI,R3    24                                                    732
         LI,R4    KEYHEAD           (R4) = ADR OF KEY FOR READ
         BAL,R1   READCAL           READ 1ST 6 WDS OF HEAD RECORD.
         LW,R3    *R2               PERFORM VALIDITY CHECK ON HEAD RECORD
         BGEZ     CCI244            ERROR IF BIT 0 NOT SET
         AND,R3   XFF
         CI,R3    X'30'             ERROR IF NOT 48 BYTES
         BNE      CCI244
         LW,R3    -RUNTBLSIZ+1,R2                                       732
         BNEZ     CCI233
         INT,R3   2,R2
         SLS,R3   1                                                     732
         STW,R3   -RUNTBLSIZ+1,R2                                       732
CCI233   RES      0
         INT,R3   5,R2              (R3) = TREE SIZE IN WORDS           732
         AI,R3     RUNTBLSIZ-1+511    COMPUTE # OF
         SLS,R3    -9                 .PAGES NEEDED.
         OR,R3    Y08               GET
         CAL1,8   R3                     PAGES.
         INT,R3   5,R2              (R3) = TREE SIZE IN WORDS
          PUSH      R2             SAVE RUN TABLE POINTER
         LW,R2    SR2               PICKUP START ADDRESS OF PAGES
         SLS,R3   2                 (R3) = TREE SIZE IN BYTES           732
         LI,R4    KEYTREE           (R4) = ADR OF KEY FOR READING TREE
         BAL,R1   READCAL           READ LOAD MODULE TREE TABLE.
         SW,R3    M:X1+13           PERFORM VALIDITY CHECK ON TREE RECORD
         BNEZ     CCI246            ERROR IF RECD. NOT SIZE SPECD. IN HEAD
         CAL1,1   CLSFILE           CLOSE FILE
          PULL      R3             GET RUN TABLE POINTER
          STW,R2    TREETADR-RUNTBLSIZ,R3    >TORE ADR OF TREE IN
*                                          RUN TABLE
         LW,D1    R2
         AW,D1    0,R2              (D1) = END ADR OF TREE TABLE +1
         AI,R2    1                 (R2) = ADR OF 1ST ENTRY
         LI,R3    0
CCI234   EQU      %
         MTB,1    *R2               INCREMENT SEG. NAME BYTE COUNT
         LB,R4    *R2
         STB,R3   *R2,R4            SET LAST BYTE OF NEW SEG. NAME =0
         AI,R2    TTESIZE
         CW,R2    D1                CHECK IF TO END OF TREE TABLE
         BL       CCI234            NO
         LI,D1    2                 SET !RUN CC FLAG
         B        CCI203            PROCESS DEBUGS AFTER RUN
*
*        PROCESS  ERRORS IN READING RUN LOAD MODULE
*
CCI236   EQU      %
         SLS,SR3  -17
         CI,SR3   X'0700'**-1       LOST DATA
         BE       CCI233
CCI237   EQU      %
         CAL1,1   CLSFILE           CLOSE AND SAVE FILE
CCI238   EQU      %
*E*      MESSAGE: ILLEGAL OR INSUFFICIENT INFORMATION ON RUN CC
*E*      DESCRIPTION: MESSAGE OUTPUT FOR THE FOLLOWING CONDITIONS:
*E*                   1. LOAD MODULE SPECIFIED IS NOT A KEYED FILE
*E*                   2. LOAD MODULE SPECIFIED HAS AN INVALID HEAD OR
*E*                      TREE RECORD
         LI,SR3   RUNERCD           SET RUN CC ERROR CODE IN SR3
         B        CCI90             PRINT ERROR MESSAGE AND ABORT
CCI240   EQU      %
         CI,SR3   3
         BNE      CCI242
*E*      MESSAGE: LOAD MODULE DOES NOT EXIST
CCI241   EQU      %
         LI,SR3   LDEXSTCD
         B        CCI90             PRINT ERROR MESSAGE AND ABORT
CCI242   EQU      %
         CI,SR3   14
         BNE      CCI238
*E*      MESSAGE: LOAD MODULE IS BUSY
         LI,SR3   LDBUSYCD
         B        CCI90             PRINT ERROR MESSAGE AND ABORT
CCI244   EQU      %
         CAL1,1   CLSFILE           CLOSE AND SAVE FILE
*E*      MESSAGE: LOAD MODULE HAS INVALID HEAD RECORD
         LI,SR3   INVHDCD
         B        CCI90             PRINT ERROR MESSAGE AND ABORT
CCI246   EQU      %
         CAL1,1   CLSFILE           CLOSE AND SAVE FILE
*E*      MESSAGE: LOAD MODULE HAS INVALID TREE RECORD
         LI,SR3   INVTRCD
         B        CCI90             PRINT ERROR MESSAGE AND ABORT
*
*        READ RECORD, CHECK IF CORRECT KEYED RECORD WAS READ
*
READCAL  EQU      %
         CAL1,1   READLM            READ RECORD DEFINED BY
*                                   .REGISTERS R2, R3, R4
         LB,SR3   SR3               CHECK IF
         CI,SR3   X'43'             .CORRECT KEY
         BE       CCI237            ..RECORD WAS READ. -NO.
         B        *R1               -YES. EXIT.
*
*        READ  RUN  LOAD MODULE HEAD AND TREE PLIST
*
READLM   EQU      %
         GEN,8,24 X'10',M:X1
         DATA     X'F8000010'
         DATA     CCI236
         DATA     CCI236
         GEN,8,24 X'80',R2
         GEN,8,24 X'80',R3
         GEN,8,24 X'80',R4
         PAGE
*
*        DEBUG  CONTROL COMMAND TABLES
*
CCTBL3   EQU      %
TXTINCL  TEXT     'INCL'
TXTDEFX  TEXT     'DEFX'
TXTMODI  TEXT     'MODI'
NDEBUG1  EQU      %-CCTBL3-1
         TEXT     'PMD '
         TEXT     'PMDE'         EXTENDED PMD
         TEXT     'PMDI'
TXTSNAP  TEXT     'SNAP'
         TEXT     'SNAP'
         TEXT     'IF  '
         TEXT     'AND '
         TEXT     'OR  '
         TEXT     'COUN'
COUNTID  EQU      %-CCTBL3-1
NDEBUG2  EQU      %-CCTBL3-1
*
CCBTBL3  EQU      %
         B        %                 DUMMY ENTRY
         B        DEFXREFR
         B        MODFYR
         B        PMDR
         B        PMDR
         B        PMDR
         B        SNAPR
         B        SNAPR
         B        IFR
         B        IFR
         B        IFR
         B        IFR
TXTC     TEXT     'C   '
         PAGE
*D*********************************************************************
*D*      NAME:    CCINIT
*D*
*D*      REGISTERS: ALL VOLATILE
*D*
*D*      CALL:    BY THE MONITOR
*D*
*D*      INTERFACE:
*D*               CHSTSCAN - GET NEXT CHARACTER STRING
*D*               LIMR - PROCESS LIMIT CONTROL COMMAND
*D*               TITLR - PROCESS TITLE CONTROL COMMAND
*D*               MESSR - PROCESS MESSAGE CONTROL COMMAND
*D*               ASSGR - PROCESS ASSIGN CONTROL COMMAND
*D*               POOLR - PROCESS POOL CONTROL COMMAND
*D*               SWITCHR - PROCESS SWITCH CONTROL COMMAND
*D*               SERRLF - SET ERROR LISTING FLAGS
*D*               SCCLF - SET CONTROL COMMAND LISTING FLAGS
*D*               SCCELF - SET CONTROL COMMAND ERROR LISTING FLAGS
*D*               CCLFCK - CONTROL COMMAND LISTING FLAG CHECK
*D*               CCLIST - CONTROL COMMAND LIST
*D*               ERRLIST - LIST ERROR MESSAGE
*D*               LIST - LIST SPECIFIED OUTPUT
*D*               OPNSTARF - OPEN STAR FILE
*D*               READBI - READ BI DEVICE
*D*               RUNR - PROCESS RUN CONTROL COMMAND
*D*               WDTBLSRH - SEARCH SPECIFIED WORD TABLE
*D*               TOPPAGE - POSITION DEVICE TO TOP OF PAGE
*D*               EOCCSCAN - SCAN TO END OF CONTROL COMMAND
*D*               DCBCLS - CLOSE CCI'S OUTPUT DCBS
*D*               CHSTSHFT - SHIFT CHARACTER STRING
*D*               TELESCPE - PACK THE LOCCT,TREE,ROM TABLES INTO ONE
*D*                          TABLE
*D*               TREER - PROCESS TREE CONTROL COMMAND
*D*               PTREER - PROCESS PTREE CONTROL COMMAND
*D*               INCLR - PROCESS INCLUDE CONTROL COMMAND
*D*               MODFYR - PROCESS MODIFY CONTROL COMAND
*D*               PMDR - PROCESS PMD,PMDE,PMDI CONTROL COMMANDS
*D*               SNAPR - PROCESS SNAP OR SNAPC CONTROL COMMAND
*D*               IFR - PROCESS IF,AND,OR,COUNT CONTROL COMMANDS
*D*               SEGSRH - SEARCH TREE TABLE FOR SEGMENT NAME
*D*               JOBR - PROCESS JOB CONTROL COMMAND
*D*               LOADR - PROCESS LOAD,OVERLAY,LOCCT CONTROL COMMANDS
*D*               NAMSCAN - GET NAME FROM COMMAND
*D*               GETHEXVAL - GET HEXADECIMAL FIELD
*D*               CONCAT - CREATE KEY
*D*               INHYPHEN - INCLUDE HYPHEN AS A DELIMITER
*D*               EXHYPHEN - EXCLUDE HYPHEN AS A DELIMITER
*D*               HEXBCD - CONVERT HEXADECIMAL TO EBCDIC
*D*               OPNFM3 - OPEN FILE SPECIFIED ON RUN COMMAND
*D*
*D*      ENVIRONMENT: MAPPED,SLAVE
*D*
*D*      DATA:    CCTBL - CONTROL COMMAND TABLE
*D*               CCBTBL - CONTROL COMMAND BRANCH TABLE
*D*               CCTBL3 - DEBUG CONTROL COMMAND TABLE
*D*               CCBTBL3 - DEBUG CONTROL COMMAND BRANCH TABLE
*D*               CRPT - CHARACTER ROUTINE PARAMETER TABLE
*D*
*D*      INPUT:   ACCBUF - DISPLACEMENT IN JIT FOR CC BUFFER
*D*               CCPL - CONTROL COMMAND PARAMETER LIST(SAME AS CRPT)
*D*               CJOB - JIT ADDRESS
*D*               CSL - DISPLACEMENT IN CRPT FOR CHARACTER STRING
*D*                     LENGTH
*D*               J:BUP - LOCATION CONTAINING PROGRAM LOWER LIMITS
*D*               KEYHEAD - LOCATION OF KEY FOR LOAD MODULE HEAD RECORD
*D*               LISTCNT - NUMBER OF OUTPUT LIST DCBS
*D*               LMNAME - DISPLACEMENT IN LOCCT FOR LOAD MODULE NAME
*D*               M:EO - ADDRESS OF M:EO DCB
*D*               M:C - ADDRESS OF M:C DCB
*D*               M:LO - ADDRESS OF M:LO DCB
*D*               M:X1 - ADDRESS OF M:X1 DCB
*D*               M:LL - ADDRESS OF M:LL DCB
*D*               PLB - DISPLACEMENT IN CRPT FOR BUFFER CONTAINING
*D*                     FIRST FIELD OF COMMAND
*D*               ALOCCT - DISPLACEMENT IN JIT FOR ADDRESS OF LOCCT
*D*                        ADDRESS
*D*               TTESIZE - SIZE OF TREE TABLE
*D*               J:TELFLGS - INTERNAL FLAGS USED BY CCI
*D*               J:RNST - RUN STATUS AFTER INITIAL ENTRY TO CCI
*D*               JB:STEPCC - STEP CONDITION CODES
*D*
*D*      OUTPUT:  ACCN - DISPLACEMENT IN JIT FOR ACCOUNT NUMBER
*D*               ALOCCT - DISPLACEMENT IN JIT CONTAINING LOCCT SIZE
*D*               CBUF - DISPLACEMENT IN CRPT FOR BUFFER ADDRESS
*D*               CCBEF - DISPLACEMENT IN JIT FOR CERTAIN BIT FLAGS
*D*                       BIT 8 IS SET/RESET TO INDICATE IF CONTROL
*D*                       COMMAND BUFFER IS FULL/EMPTY
*D*                       BIT 9 IS SET/RESET IF CONTROL COMMAND IS
*D*                       ASSUMED TO BE A PROCESSOR
*D*               CCLFLAGS - DISPLACEMENT IN JIT FOR LIST FLAGS
*D*               CCLTFLGS - DISPLACEMENT IN JIT FOR LOAD/RUN FLAGS
*D*               CCP - DISPLACEMENT IN CRPT FOR CURRENT CHARACTER
*D*                     POSITION
*D*               CCRSZ - DISPLACEMENT IN CRPT FOR BYTE COUNT
*D*               J:CCBUF - LOCATION OF CONTROL COMMAND BUFFER
*D*               J:TITLE - SET = 0 TO INDICATE TITLE HASN'T BEEN
*D*                         PROCESSED
*D*               J:RNST - FLAGS IN HALFWORD 0 ARE RESET ON INITIAL
*D*                        ENTRY TO CCIR
*D*               J:TELFLGS - INTERNAL FLAGS SET BY CCI
*D*               LDSYSID - DISPLACEMENT IN LOCCT SET TO SYSTEM ID OF
*D*                         CURRENT JOB
*D*               MJCFLG - DISPLACEMENT IN JIT FOR MESSAGE FLAGS
*D*               MRT - DISPLACEMENT IN JIT FOR MAX. RUN TIME
*D*               ROMTADR - DISPLACEMENT IN LOCCT FOR ROM TABLE ADDRESS
*D*               TREETADR - DISPLACEMENT IN LOCCT FOR TREE TABLE
*D*                          ADDRESS
*D*               TSTACK - TEMP STACK USED FOR SAVING REGISTERS,
*D*                         PROGRAM LOWER LIMIT, AND CONTROL COMMAND
*D*                         PARAMETER LIST
*D*               J:EXTENT - FLAG IN JIT INDICATING TO STEP NOT TO
*D*                          RESET STEP CONDITION CODES
*D*               J:ASSIGN - FLAG IN JIT TO INDICATE JOB IS TO
*D*                          FLUSHED
*D*               CPE - DISPLACEMENT IN JIT TO INDICATE PRESENCE OF
*D*                     DEBUG CONTROL COMMAND
*D*               :USERS RECORD IN COMMON STORAGE FOR USE BY SHOW
*D*               PROCESSOR
*D*
*D*      DESCRIPTION: MODULE CCIR IS ENTERED FROM THE MONITOR AT
*D*               LOCATION CCINIT. CCINIT IS THE CONTROL ROUTINE THAT
*D*               CALLS
*D*               ALL OTHER MAJOR ROUTINES IN CCI, READS THE CONTROL
*D*               COMMANDS, AND INTERPRETS THE COMMAND FIELD. IF THE
*D*               COMMAND IS A PROCESSOR COMMAND, IT CALLS THE
*D*               MONITOR VIA
*D*               AN M:EXIT CALL WITH THE PROCESSOR NAME IN TEXTC
*D*               IN REGISTERS 6, 7, AND 8. IF IT IS NOT A PROCESSOR
*D*               COMMAND, IT CALLS THE APPROPRIATE CCI ROUTINE(S) TO
*D*               PROCESS THE COMMAND. IF IT READS A JOB OR FIN CONTROL
*D*               COMMAND, IT CALLS THE JOB TERMINATION ROUTINES.
*D*
*D*               WHEN CCI READS A CONTROL COMMAND, IT GETS THE COMMAND
*D*               FIELD AND CHECKS THE FIRST FOUR CHARACTERS OF THE
*D*               FIELD TO DETERMINE IF IT IS A LEGAL CCI CONTROL
*D*               COMMAND. IF IT IS NOT, CCI ASSUMES IT TO BE A
*D*               PROCESSOR CONTROL COMMAND, BLANKS OUT THE !
*D*               CHARACTER IN THE CONTROL COMMAND BUFFER, AND MARKS
*D*               THE BUFFER AS FULL AND CONTAINING  A PROCESSOR
*D                COMMAND BY SETTING THE PCCF FLAG IN THE JIT. IT
*D*               THEN GIVES CONTROL TO THE MONITOR TO LOAD THE
*D*               PROCESSOR.
*D*
*D*               IF THE COMMAND IS A LEGAL CONTROL COMMAND, CCIR
*D*               CALLS THE APPROPRIATE ROUTINE TO PROCESS THE
*D*               COMMAND. THE ROUTINE THAT PROCESSES A PARTICULAR
*D*               CONTROL COMMAND KNOWS THE CORRECT FORMAT AND SYNTAX
*D*               AND WHICH KEYWORDS AND VALUES ARE LEGAL.
*D*               PROCESSING OF MOST COMMANDS RESULTS IN A TABLE BEING
*D*               BUILT CONTAINING THE INFORMATION FROM THE COMMAND.
*D*               THE TABLE IS THEN WRITTEN TO DISK FOR LATER USE
*D*               BY SOME OTHER PART OF THE SYSTEM. FOR THE LIMIT
*D*               COMMAND, THE VALUES ARE STORED DIRECTLY INTO THE JIT.
*D*
*D*               WHEN A LOAD OR OVERLAY COMMAND IS PROCESSED, A TREE OR
*D*               PTREE COMMAND AND ANY MODIFY COMMANDS FOLLOWING THE
*D*               LOAD OR OVERLAY COMMAND ARE PROCESSED BEFORE THE
*D*               OVERLAY LOADER IS LOADED. IF A TREE OR PTREE COMMAND
*D*               DOES'NT FOLLOW A LOAD OR OVERLAY COMMAND, A DEFAULT
*D*               TREE TABLE WITH ONE ENTRY IS BUILT WITH THE
*D*               SEGMENT NAME EQUAL TO THE LOAD MODULE NAME.
*D:
*D*               WHEN A RUN COMMAND IS PROCESSED, ALL MODIFY, PMD,
*D*               PMDI, PMDE, IF, AND, OR, COUNT, SNAP, AND SNAPC
*D*               COMMANDS FOLLOWING THE RUN COMMAND ARE PROCESSED
*D*               BEFORE EXITING TO EXECUTE THE SPECIFIED PROGRAM.
*D*
*D*               THE FIRST TIME THROUGH CCIR, JOBR IS CALLED EITHER TO
*D*               LOG USERS ON OR TO CALL THE LDEV PROCESSOR WHEN A
*D*               WORK STATION NAME EXISTS ON THE JOB CONTROL COMMAND OR
*D*               WHEN A REMOTE BATCH ID EXISTS IN THE JIT. ON
*D*               SUBSEQUENT RETURNS TO CCIR FROM THE MONITOR, J:RNST
*D*               AND J:TELFLGS BITS ARE CHECKED TO DETERMINE THE TYPE
*D*               OF ACTION: ABORT THE JOB STEP, ABORT THE JOB, OR
*D*               PROCEED TO READ THE NEXT CONTROL COMMAND. IF THE LDEV
*D*               PROCESSOR WAS CALLED, TYPE OF COMPLETITION IS
*D*               DETERMINED AND THE JOB IS EITHER FLUSHED, IF AN ERROR
*D*               OCCURRED, OR BRANCH MADE TO JOBR TO LOG THE USER ON
*D*               IF SUCCESSFUL. WHEN A JOB IS ABORTED DUE TO
*D*               EXCEEDING IT'S LIMITS, THE SHOW PROCESSOR IS
*D*               CALLED BEFORE FLUSHING THE JOB.
*D*
**********************************************************************
*
*
*
*   SIGNIFICANCE OF BITS IF SET IN J:RNST,BYTE 0
*
*        BIT 0    M:ERR CAL WAS MADE,JOB STEP TO BE ERRORED
*        BIT 1    M:XXX CAL WAS MADE,JOB STEP TO BE ABORTED
*        BIT 2    'E' KEYIN WAS MADE,JOB STEP TO BE ERRORED
*        BIT 3    'X' KEYIN WAS MADE,ABORT JOB AND FLUSH THIS JOB STREAM
*        BIT 4    'DELETE' KEYIN WAS MADE,ABORT JOB AND FLUSH JOB STREAM
*        BIT 5    A LIMIT HAS BEEN EXCEEDED,JOB STEP TO BE ABORTED
*        BIT 6    I/O ERROR,JOB STEP TO BE ABORTED
*        BIT 7    ILLEGAL TRAP,JOB STEP TO BE ABORTED
*
*
*
************************************************************************
*
CCINIT   EQU      %
         LW,1       J:BUP
         SLS,1     9
         STW,R1   TSTACK+2          SAVE BKGRDUL IN TEMP STACK
         BUMP     18,R1             RES SPACE FOR CHAR ROUT. PLIST
         PUSH 8,R4                                                     732
         LI,R5    J:JIT             GET JIT ADDRESS
         LW,R7    TSTACK
         AI,R7    -24                                                  732
         LCI      4                 MOVE
         LM,D1    CCPL                  PLIST
         STM,D1   0,R7                       TO
         LM,D1    CCPL+4                       TEMP STACK
         STM,D1   4,R7
         DO       DEBUG
         NOP
         ELSE
         CAL1,1   OPNCDCB
         FIN
         LH,R2    J:RNST
         LI,D1    0
         LW,D2   =X'FF7E0000'
         STS,D1   J:RNST
* TESTING FOR INITIAL ENTRY ON J:TELFLGS
*                  BIT 18: =0 FOR 1ST TIME THRU CCI;
*                          =1 FOR SUBSEQUENT
*                  BIT 17: =0 FOR LDEV NOT CALLED;
*                          =1 FOR LDEV CALLED.
*                  BIT 16: =0, WSN OK;
*                          =1, WSN NOT OK.
*                  BIT 15: =0, LOAD CC NOT READ.
*                          =1, LOAD CC READ.
*                  BIT 14: =0, RUN CC NOT READ.
*                          =1, RUN CC READ.
*                  BIT 13: =0, SHOW NOT CALLED ON LIMIT ABORT.
*                          =1, SHOW CALLED WHEN JOB ABORTED DUE TO LIMIT
*                              BEING EXCEEDED.
*
         LI,D1    X'2000'           SET INITIAL ENTRY FLAG
         OR,D1    J:TELFLGS         PRESERVE PREVIOUSLY SET FLAGS
         XW,D1    J:TELFLGS         DETERMINE IF INITIAL ENTRY
         BNEZ     CCINIT10          IT ISN'T
         MTW,1    J:JIT+ACCN        ENSURE NON ZERO ACCOUNT#
         BUMP     -8,R1                                                 732
         LI,R3    0                 ENSURE BYTE 0 IS 0 TO INDICATE A
         STB,R3   J:TITLE           TITLE HASN'T BEEN PROCESSED
         LI,R3    K100              SET NO CC LIST FLAGS IN JIT
         STS,R3   CCLFLAGS,R5
CCINIT2  EQU      %
         BAL,SR4  CCREAD            GET CONTROL COMMAND FROM C DEVICE
         LI,SR4    CCI50
         CW,R1    TXTJOB
         BE       JOBR              PROCESS JOB COMMAND
         CW,R1    TXTFIN
         BE       CCIFIN            WRAPUP
*
         LI,R3    K100
         STS,R3   CCLFLAGS,R5       SET NO CC LIST FLAG IN JIT
         BAL,SR4  EOCCSCAN          SKIP TO END OF CONTROL COMMAND
         LI,R2    K0
         LI,R3    K100
         STS,R2   CCLFLAGS,R5       RESET NO CC LIST FLAG IN JIT
         B        CCINIT2
*
CCINIT10 EQU      %
         STW,R2   R6                SAVE J:RNST TO DETER. TYPE OF OFF MSG.
         LI,D2    K40000            PRESERVE BIT 13 TO DETERMINE TYPE OF
         STS,D1   J:TELFLGS         OFF MSGE. TO BE PRINTED.
         BUMP     -8,R1
         LI,D2    X'4000'           WAS LDEV
         CW,D2    D1                .PROCESSOR
         BAZ      CCINIT12          ..CALLED. -NO.
* LDEV EXITS WITH JB:STEPCC SET AS FOLLOWS.
* IF=0(NORMAL), IF=1(ERROR)
         LI,R1    JB:STEPCC         -YES. TEST IF
         LB,D2    0,R1              .LDEV SET.
         BEZ      W250              ERROR, NO
         LW,R1    =X'08000000'      -YES. SET BIT
         STS,R1   J:ASSIGN          .TO FLUSH JOB.
         LI,R1    X'8000'           SET WSN ERROR
         STS,R1   J:TELFLGS         .FLAG ON.
W250     EQU      %
         LI,SR4   CCI50             SET RETURN FROM JOBR
         B        JOBR              PROCESS JOB COMMAND, LOG USER ON
CCINIT12 EQU      %                                                    732
         CI,D1    K40000            WAS SHOW CALLED AFT. LIMIT ABORT
         BANZ     FLUSH             FLUSH AS ON OTHER ABORTS
         LW,R3    =X'08000000'      L/BIT 4 (FLUSH BIT)
         CW,R3    J:ASSIGN          C/BIT4 W/J:ASSIGN
         BANZ     FLUSH             BANZ; FLUSH, IGNORE STEP COMMANDS
         CI,R2    X'5F00'           BRANCH IF ENTRY
         BAZ      CCINIT20                       FROM M:ERR OR M:EXIT
         CI,R2    X'1000'           IS THIS AN OPERATOR ABORT?
         BANZ     FLUSH             BANZ; FLUSH, IGNORING STEP COMMANDS
         CI,R2    X'0400'           HAS A LIMIT BEEN EXCEEDED?
         BANZ     SHOWR             CALL SHOW PROCESSOR
CCISKIP  EQU      %                 NO, M:XXX, SKIP TO JOB OR FIN CC
         BAL,SR4  CCREAD
         LI,R3    3
         LI,R4    CCISKIP
         BAL,SR4  WDTBLSRH          CHECK IF JOB OR FIN CC
         CW,R1    TXTFIN            IF FIN, EXIT AT ENDJOB5 TO PRINT
         BE       ENDJOB5           'OFF ABORT'
         BDR,R3   CCBTBL,R3
         B        CCINIT23          PROCESS STEP COMMAND
*
*
*
CCINIT20 EQU      %
         LW,R6    R2
         BAL,SR4  CCREAD            READ NEXT  CC
         CW,R1    TXTJOB            CHECK IF  JOB  CC
         BE       CCI2              YES
         CW,R1    TXTFIN            CHECK IF  FIN  CC
         BE       CCI2              YES
         LI,SR4   0                 CLR FINAL RST
         LI,R1    JB:FRS
         STB,SR4  0,R1
CCINIT23 RES      0
         LI,R4    8                 SET LO OUTPUT BIT
         LW,R1    M:LO              DO TOP OF FORM ON M:LO
         AND,R1   XF                IF SET TO DEVICE.
         CI,R1    3
         BE       CCINIT25
         LW,R1    M:LL              OTHERWISE, DO TOP OF FORM ON M:LL
         AND,R1   XF                IF SET TO DEVICE.
         CI,R1    3
         BNE      CCINIT26
         LI,R4    K2                SET LL OUTPUT BIT
CCINIT25 EQU      %
         BAL,SR4  TOPPAGE
CCINIT26 EQU      %
         LW,R1    PLB,R7            (R1) = 1ST 4 WORD OF COMMAND
         LI,R2    CCTBL             (R2) = ADR OF COMMAND TABLE
         B        CCI2
FLUSH    EQU      %
         LW,R3    Y08               ARE WE IN CFE MODE?
         CW,R3    J:JIT
         BAZ      FLUSH5            NO
         LI,R2    0                 YES, ABORT CFE MODE SO ALL COMMANDS
         STS,R2   J:JIT             ARE READ FROM C DEVICE
         LW,R3    Y008              RESET CCBUF FULL FLAG
         STS,R2   CCBEF,R5          SO COMMAND FILE CC ISN'T READ
FLUSH5   EQU      %
         BAL,SR4  CCREAD            READ NEXT COMMAND
         CW,R1    TXTFIN            TEST FOR
         BE       ENDJOB5           .FIN CARD. -YES.
         B        FLUSH             NO, READ AGAIN
         PAGE
*
*
ILLCC    TEXTC    '   ILLEGAL CONTROL COMMAND OR CONTROL COMMAND SEQ.'
UNREUERM TEXTC    '   UNABLE TO READ :USERS FILE'
         CSECT    0
         BOUND    8
LDTHIS1  RES      2                 PROCESSOR NAME BUFFER
*****    PATCH AREA                 *****
CCIPCH   RES      200               CCI PATCH AREA
TELSTART DATA     0
         USECT    CCI
         PAGE
********  BEGIN DBLWD TABLE  *******
         BOUND    8
TXTLIMIT TEXT     'LIMIT'
TXTDATA  TEXT     'DATA    '
TXTREE   TEXT     'TREE'
TXPTREE  TEXT     'PTRE'                                                732
TXTCLOCT TEXTC    'LOCCT'
TXTCLDR  TEXTC    'LOADER'
TXTCOLY  TEXTC    'OLAY'
TXTCLGON TEXTC    'LOGON'
SYSACCT# TEXT     ':SYS    '
TXTCFTRN TEXTC    'FORTRAN'
TXTCFORT TEXTC    'FORT'
TXTCANSF TEXTC    'ANSF'
ANSFORT  TEXTC    'ANSFORT'
TXTCSHOW TEXTC    'SHOW'
*****    END DOUBLEWORD TABLE       *****
*
*        CONTROL COMMAND  TABLE
*
CCTBL    EQU      %-1
         TEXT     'STEP'
TXTJOB   TEXT     'JOB '
TXTFIN   TEXT     'FIN '
         TEXT     'MESS'
         TEXT     'TITL'
         TEXT     'POOL'
           TEXT       'SWIT'
         TEXT     'ASSI'
         TEXT     'LOAD'
         TEXT     'OVER'
         TEXT     'OLAY'
         TEXT     'LOCC'
         TEXT     'RUN '
TXTEOD   TEXT     'EOD '
         TEXT     'SHOW'
         TEXT     'XEQ '
         TEXT     'SET '
NCC      EQU      %-CCTBL-1
*
*        CONTROL COMMAND  JUMP TABLE
*
CCBTBL   EQU      %-1
         B        STEPR
         B        CCI120
         B        FINCC
         B        MESSR
         B        TITLR
         B        POOLR
           B          SWITCHR
         B        ASSGR
         B        LOADRLOD
         B        LOADRLOD
         B        LOADRLOD          TEMP FIX UNTIL OLAY IS INCLUDED IN SYS
         B        LOCCTPROC
         B        RUNR
         B        CCIEOD
         B        SHOWR5
         B        XEQR
         B        SETR              !SET IN BATCH
*
*        ILLEGAL XEQ CONTROL COMMANDS
*
ILLCCTBL EQU      %-1
         TEXT     'JOB '
         TEXT     'BCD '
         TEXT     'BIN '
NILLCC   EQU      %-ILLCCTBL-1
         PAGE
CCIFIN   RES      0
         LI,R6    0                 SETUP TO ENTER WAIT STATE
         B        CLS%DCB%EXIT
*                                                                       732
ENDJOB   EQU      %
         LI,R6    0                 SET R6=JOB NOT ABORTED
ENDJOB5  EQU      %
         LI,R4    2                 TOP OF PAGE
         BAL,SR4  TOPPAGE                         ON LL.
         LI,D1    OFF               TYPE 'OFF'
*O*      MESSAGE: ID  OFF
*O*      ACTION:  NONE. INFORMATION ONLY.
*O*      MEANING: A BATCH USER LOGGED OFF.
         CI,R6    X'5700'           WAS JOB ABORTED
         BANZ     ENDJOB7           YES
         LW,R6    J:TELFLGS         WAS THERE A WSN OR LIMIT EXCD. ERROR?
         CI,R6    X'48000'
         BAZ      ENDJOB9           NO
ENDJOB7  EQU      %
         LI,D1    OFFABRT
*O*      MESSAGE: ID  OFF ABORTED
*O*      ACTION:  NONE. INFORMATION ONLY.
*O*      MEANING: A BATCH USER ABORTED.
ENDJOB9  EQU      %
         LI,R1    0                 STOP CLOCKING THIS JOB
         STW,R1   MRT,R5
*
         STB,R1   J:RNST            CLEAR RUN STATUS BEFORE LOGOFF
*
         CAL1,2   ONOFF                         ON  OC.
         LD,R6    TXTCLGON          GO TO LOGON
         B        EXITM                            FOR ACCOUNTING.
         PAGE
SETCLS   RES      0
*        15=CLOSE PLIST
*        11=EXIT ADDRESS
*    USES REG. 0 AND 7
         LW,0     *15               GET DCB
         LW,7     *0                GET FIRST WD
         CW,7     Y002              IS IT OPEN
         BAZ      *11               NO
         CAL1,1   SETIT
         CAL1,1   *15               CLOSE FILE
IGNOR    B        *11
         SPACE    2
SETIT    GEN,1,7,24   1,6,0
         GEN,2,30          3,0
         DATA     IGNOR
         DATA     IGNOR
         PAGE
**********************************************************************
*        CCREAD   CONTROL COMMAND READ- GETS NEXT CONTROL COMMAND    *
*                 FROM THE C DEVICE  AND INITIALIZES THE CC PARAMETER*
*                 LIST                                               *
*        ENTER WITH                                                  *
*                 (R5) = JIT  POINTER                                *
*        EXIT WITH                                                   *
*                 (R7) = CC PARAMETER LIST                           *
*                 (SR1) = CUR CHAR                                   *
*                 (PARM LIST BUFFER) = 1ST FIELD OF  CC              *
*                 (CCBUF)  = 1ST RECORD OF CC                        *
*                 (R1) = 1ST 4 CHAR OF 1ST FIELD OF CC               *
*        IF DATA   RECORD IS READ, MESSAGE IS OUTPUT                 *
**********************************************************************
CCREAD   EQU      %
         PUSH     SR4
CCREAD1  EQU      %
         BAL,SR4  CREAD
         LB,SR3   SR3               (SR3) = READ STATUS CODE
         BNEZ     CCREAD6           CONTROL COMMAND IF NOT ZERO
         LW,R3    DMMSK
         CW,R3    DMFLAG,R5         CHECK IF DATA INFO. MESS. LISTED
         BANZ     CCREAD1           BRANCH IF YES AND GET NEXT REC.
         STS,R3   DMFLAG,R5         SET FLAG
*E*      MESSAGE: DATA INFORMATION IGNORED
*E*      DESCRIPTION: DATA WAS SKIPPED DURING THE SEARCH FOR A
*E*                   CONTROL COMMAND (! IN COLUMN 1)
         LI,R2    DIMESS
         LI,R4    K2
         LI,D4    K1
         BAL,SR4  LIST              LIST DATA INFO. MESS. ON LL DEV
         B        CCREAD1           GET NEXT RECORD.
*
CCREAD6  EQU      %
         LI,R2    K0
         LW,R3    DMMSK
         STS,R2   DMFLAG,R5         RESET DATA INFO. FLAG IN JIT
*
         LI,SR1   K0                (SR1) = CUR CHAR = 0
         LI,R1    K1
         STW,R1   CCP,R7            SET CUR CHAR POS. = 1
         LI,R2    J:CCBUF
         STW,R2   CBUF,R7           RESET FLAGS AND SET  CC BUF ADDR
         LI,R3    80                CC BYTE CNT SET TO 80
         STW,R3   CCRSZ,R7
         BAL,SR4  CHSTSCAN          GET 1ST FIELD ON CC
         LW,R1    PLB,R7            (R1) = 1ST 4 CHAR. OF FIELD
         LCI      2
         LM,D1    J:CCBUF           CHECK FOR ! FIN. IGNORING OF BLANK
         SLD,D1   8                 NOT PERMITTED FOR FIN COMMAND.
         CW,D1    BLNKFIN
         BNE      CCREAD9
         SLS,R1   -8                REINSERT BLANK WHICH SCAN DELETED
         OR,R1    Y4
CCREAD9  EQU      %
         LI,R2    CCTBL             (R2) = ADR OF COMMAND TABLE
         PULL     SR4
         B        *SR4              EXIT WITH CC IN CC BUFFER
DIMESS   TEXTC    '   DATA INFORMATION-IGNORED'
         PAGE
**********************************************************************
*        CREAD    READ C DEVICE                                      *
*        ENTER WITH                                                  *
*                 (R5) = JIT POINTER                                 *
*        EXIT WITH                                                   *
*                 (SR3) = DATA RECORD OR CC RECORD INDICATOR         *
**********************************************************************
CREAD    EQU      %
         PUSH     4,R6
         LCI      2
         LM,R2    J:CCBUF
         CW,R2    CCFIN             CHECK FOR FIN
         BNE      CREAD0C
         SLD,R2   8                 FIN MUST BE FOLLOWED BY AT LEAST
         CW,R2    TXTFIN            ONE BLANK TO BE A LEGAL FIN COMMAND
         BE       CREAD0F           IGNORE CCBEF
CREAD0C  EQU      %
         LW,R3    Y008
         AND,R3   CCBEF,R5          CHECK IF CC BUF IS FULL
         BEZ      CREAD1
         LI,R2    K0
         STS,R2   CCBEF,R5          RESET CC BUF FULL FLAG
CREAD0F  EQU      %
         LW,SR3   Y06
         B        CREAD3
*
CREAD1   EQU      %
         PUSH     SR4
         LW,R2    Y08               ARE WE IN CFE MODE?
         CW,R2    J:JIT
         BAZ      CREAD2            NO, HENCE READING FROM C DEVICE
         LW,R2    Y002              YES, HENCE READING FROM FILE
         CW,R2    F:CF
         BAZ      %+2               CLOSE F:CF IF OPEN
         CAL1,1   CLSCFDCB
         CAL1,8   GETPAGE           GET PAGE FOR A/M RECORD
         BCS,8    CREAD100          ERROR, CAN'T GET ONE
         STW,SR2  R6
         BAL,SR4  RAMR              GET FILE NAME/ACCOUNT FROM A/M REC'D
         MTW,0    SR3
         BNEZ     CREAD150          ERROR
         LI,D3    OPNER             SET ERROR ADDRESS
         LI,D4    OPNER             SET ABN ADDRESS
         BAL,SR4  OPNXS             OPEN EXECUTE FILE AND SKIP TO
         MTW,0    SR3               SPECIFIED RECORD
         BNEZ     CREAD105          ERROR OR EOF
         LI,R2    -29               BLANK OUT BUFFER
         LW,R3    BLANK
         STW,R3   J:CCBUF+29,R2
         BIR,R2   %-1
         CAL1,1   READCFDCB         READ COMMAND FILE
         CAL1,1   CLSCFDCB          CLOSE DCB
*
         LI,SR3   0                 INITIALIZE ERR/ABN TO 0
         LB,R2    J:CCBUF           CHECK FOR BANG IN COL. 1
         CI,R2    KBANG
         BNE      CREAD4            DATA. SO OUTPUT MSGE 'DATA INFO. IGND'
*
         LCI      2                 CHECK IF ILLEGAL XEQ COMMAND
         LM,R2    J:CCBUF
         SLD,R2   8
         LI,R4    NILLCC
         CW,R2    ILLCCTBL,R4
         BE       CREAD120          ILLEGAL, ABORT
         BDR,R4   %-2
*
         CW,R2    TXTEOD            IS IT AN EOD
         BE       CREAD1C
         CW,R2    TXTEODP           IS IT AN EOD.
         BNE      CREAD1E
CREAD1C  EQU      %
         MTW,1    AM:CREC,R6        INCREMENT POINTER TO NEXT RECORD
         BAL,SR4  WAMR
         LI,R4    2                 SET CC LIST FLAGS
         BAL,SR4  SCCLF
         LI,R4    J:CCBUF           SET CC BUF ADDRESS
         STW,R4   CBUF,R7
         BAL,SR4  CCLIST            PRINT THE EOD
         B        CREAD110          GET NEXT COMMAND FROM C DEVICE
CREAD1E  EQU      %
         LW,SR3   Y06               SET CONTROL COMMAND ERROR CODE
         B        RDCERAB
CREAD2   EQU      %
         LI,SR3   0
         DO       DEBUG
         LI,R2    -29
         LW,SR3   BLANK             BLANK OUT BUFFER
         STW,SR3  J:CCBUF+29,R2
         BIR,R2   %-1
         LW,SR3   Y06
         LI,R2    J:CCBUF
         ELSE
         LI,R2    TSTACK+60
         FIN
         CAL1,1   READCDCB
CREAD4   EQU      %
          LI,R3     80
CREAD411  RES       0
          LB,R4    J:CCBUF,R3      CHECK FOR TAB CHARACTERS
          CI,R4     X'05'          IF FOUND - CHANGE TO BLANK
         BNE      CREAD422
         LI,R4    X'40'             BLNK OUT TAB CHAR
         STB,R4   J:CCBUF,R3
CREAD422  RES       0
          BDR,R3    CREAD411
         LW,R2    Y08               ARE WE IN CFE MODE?
         CW,R2    J:JIT
         BAZ      CREAD425          NO
         MTW,1    AM:CREC,R6        INCREMENT POINTER TO NEXT RECD.
         STW,R6   SR2
         PUSH     SR3               SAVE ERR/ABN CODE
         BAL,SR4  WAMR              WRITE A/M RECORD
         MTW,0    SR3
         BNEZ     CREAD125          ERROR
         CAL1,8   FREEPAGE          FREE PAGE USED FOR A/M BUFFER
         PULL     SR3
         CI,SR3   ILLCFCD           WAS THIS AN ILLEGAL COMMAND FILE CC
         BNE      CREAD425          NOPE
         PUSH     SR3               YES, SAVE ERROR CODE
         BAL,SR4  CCLIST            PRINT THE ILLEGAL COMMAND
         PULL     SR3               RESTORE ERROR CODE
         B        CREAD150          PRINT ERROR MESSAGE AND ABORT
CREAD425 EQU      %
         LI,R2    J:CCBUF
         PULL     SR4
CREAD3   EQU      %
         PULL     4,R6
         B        *SR4
         PAGE
*
*        PROCESS  READ C ERROR AND  ABNORMAL   RETURNS
*
RDCERAB  EQU      %
         LB,R3    SR3
         CI,R3    5                 CHECK IF EOD
         BNE      RDCER1
         LW,R1    CCP,R7
         AND,R1   =X'08000000'
         BEZ      CREAD4
RDCER1   RES      0
         CI,R3    6                 CHECK IF CC OR EOF ON COMMAND FILE
         BE       CKFIN             *CHECK FOR FIN(AFTER CONTN.,ETC)
*
OPNER    EQU      %
         LI,R2    J:CCBUF
         LW,R1    CCFIN
         STW,R1   0,R2              STORE !FIN IMAGE IN CC BUF
*
         AI,R2    -1
         LI,R3    4
         STB,R3   *R2               STORE BYTE COUNT IN BUF
         LI,R4    3
         BAL,SR4  SERRLF            SET ERR LIST FLAGS FOR OC AND LL DEV
*E*      MESSAGE: ERROR READING C DEVICE
         LI,SR3   RDCERRM
         BAL,SR4  ERRLIST           OUT READ C ERROR MESSAGE
*
         B        ENDJOB7           LOG USER OFF
*
CKFIN    EQU      %
         LCI      2
         LM,R0    J:CCBUF           SEE IF A FIN
         CW,R0    CCFIN             MUST BE FOLLOWED BY AT LEAST ONE
         BNE      CREAD4            BLANK TO BE A LEGAL FIN COMMAND
         SLD,R0   8
         CW,R0    TXTFIN
         BNE      CREAD4
         LW,R1    Y08               ARE WE IN CFE MODE?
         CW,R1    J:JIT
         BANZ     CKFIN3            YES
         LW,R1    Y008              SET CCBEF TO FULL
         STS,R1   J:RNST
         LI,R1    K100              NO, PREVENT FIN LISTING
         STS,R1   J:JIT+CCLTFLGS
         LI,R3    4                 FORCE BYTE COUNT TO 4
         B        CREAD411
CKFIN3   EQU      %
         MTW,1    AM:CREC,R6        INCREMENT POINTER TO NEXT RECORD
         BAL,SR4  WAMR
         LI,R4    2                 SET CC LIST FLAGS
         BAL,SR4  SCCLF
         LI,R4    J:CCBUF           SET CC BUF ADDRESS
         STW,R4   CBUF,R7
         BAL,SR4  CCLIST            PRINT THE FIN
         MTW,-1   AM:CREC,R6        DECREMENT FOR TERMINATING MESSAGE
         LI,D2    FTRMDM            OUTPUT MSGE 'XX TERMINATED AT ...'
         BAL,SR4  WRCFM
         LI,R2    0                 RESET CFE MODE BIT
         LW,R3    Y08
         STS,R2   J:JIT
         PULL     SR4               WHEN FIN COMMAND ENCOUNTERED IN CFE
         B        CREAD1            MODE, GET ANOTHER CMND. FROM C DEVICE
RDFERAB  EQU      %
         LB,R3    SR3               WAS AN EOF ENCOUNTERED
         CI,R3    6
         BE       CREAD110          YES, OUTPUT MSGE 'XX TERMINATED AT
         LI,SR3   RDERCFM           READ ERROR ON COMMAND FILE
         B        CREAD150
         PAGE
CREAD100 EQU      %
*E*      MESSAGE: CAN'T GET DYNAMIC PAGES
         LI,SR3   NOPGERR
         B        CREAD150
CREAD105 EQU      %
         CI,SR3   RDEXCD            DID RECORD EXIST?
         BNE      CREAD150          YES, ERROR
CREAD110 EQU      %
         MTW,-1   AM:CREC,R6        DECREMENT POINTER TO REFLECT PROPER
*                                   REC'D
         LI,D2    FTRMDM            NO, ASSUME EOF ON COMMAND FILE
         BAL,SR4  WRCFM             OUTPUT MSGE 'XXX TERMINATED AT ...'
*
         LW,D2    Y002              CLOSE DCB IF OPEN
         CW,D2    F:CF
         BAZ      %+2
         CAL1,1   CLSCFDCB
*
         LI,R2    0                 RESET CFE MODE BIT
         LW,R3    Y08
         STS,R2   J:JIT
         PULL     SR4               WHEN EOF ENCOUNTERED IN CFE MODE,
         B        CREAD1            GET ANOTHER CMND. FROM C DEVICE
CREAD120 EQU      %
*E*      MESSAGE: ILLEGAL CONTROL COMMAND FOR COMMAND FILE
         LI,SR3   ILLCFCD           ILLEGAL CONTROL COMMAND FOR CMDFILE
         B        CREAD4
CREAD125 EQU      %
         PULL     R0                BALANCE THE STACK
CREAD150 EQU      %
         PULL     SR4
         PULL     4,R6
         B        CCI90             PRINT ERROR MSGE AND ABORT
         PAGE
CCIEOD   EQU      %
         LW,R1    Y08               EOD ALREADY PRINTED IF IN CFE MODE
         CW,R1    J:JIT
         BANZ     FINCC5
         BAL,SR4  EOCCSCAN          PRINT, NOT IN CFE MODE
         B        CCI               GET NEXT COMMAND FROM C DEVICE
FINCC    EQU      %
         B        ENDJOB
FINCC5   EQU      %
         LI,R2    0                 RESET CFE MODE BIT
         LW,R3    Y08
         STS,R2   J:JIT
         B        CCI
         PAGE
SETEABN  EQU      %
         GEN,8,24 6,M:EO
         GEN,2,30 3,0
         DATA     ERRRTN            ERROR RETURN
         DATA     ABNRTN            ABNORMAL RETURN
*
READLOG  EQU      %
         GEN,8,24 X'10',M:EO
         DATA     X'F8000010'
         DATA     ERRRTN            ERROR RETURN
         DATA     ABNRTN            ABNORMAL RETURN
         GEN,1,31 1,SR2             BUFFER ADDRESS
         DATA     LOGSZ             RECORD SIZE
         DATA     KEYBUFF           KEY ADDRESS
*
*        OPEN  C DCB  PLIST
*
OPNCDCB  EQU      %
         GEN,8,24 X'14',M:C
         DATA     X'C0000000'
         DATA     OPNER
         DATA     OPNER
*
CLSCFDCB EQU      %
         GEN,8,24 X'15',F:CF
         DATA     X'80000000'
         DATA     2                 SAVE
*
GETPAGE  DATA     X'08000001'
FREEPAGE DATA     X'09000001'
*
*        READ C  DCB  PLIST
*
READCDCB EQU      %
         GEN,8,24 X'10',M:C
         DATA     X'F4000010'
         DATA     RDCERAB
         DATA     RDCERAB
         GEN,8,24 X'80',R2
         DATA     120
         DATA     0
*
*        READ COMMAND FILE DCB PLIST
*
READCFDCB EQU     %
         GEN,8,24 X'10',F:CF
         DATA     X'F4000010'
         DATA     RDFERAB
         DATA     RDFERAB
         DATA     J:CCBUF
         DATA     80
         DATA     0
*
*
RDCERRM  TEXTC    '!!ERROR READING  C DEVICE'
         END      CCINIT

