         SYSTEM   OPTIONS                                                       
         DO       #TJE                                                          
         DEF      A:TEL2                                                        
         DEF      TELREAD           ENTRY TO READ TEL COMMANDS                  
         DEF      TELCNTRL          ENTRY TO TEL BY CONTROL/BREAK               
         DEF      TEL2EXIT          EXIT FROM THIS OVERLAY                      
         DEF      CNTLEXIT          CONTROL EXIT IF NOT APPLICABLE              
*                                                                               
*                                                                               
*        REF      TELEXEC           TEL1 ENTRY - COMMAND EXECUTION              
*        REF      TELERROR          PROCESS READ/WRITE ERROR                    
         PCC      0                                                             
         PSYS     0                                                             
OLAYFLAG EQU      'TEL2'                                                        
         SYSTEM   CPRMON                                                        
         PSYS     1                                                             
         SYSTEM   OLAYBASE                                                      
         TITLE    '** TEL2 **'                                                  
         ORG      0                                                             
TEL2EXIT RES      0                 EXIT TEL2 FOR COMMAND EXECUTION             
FINISH   B        TELEXEC                                                       
*                                                                               
*                                                                               
ERRLINK  B        TEL2ERRX                                                      
TEL2ERRX RES      0                 EXIT ON ERROR THIS OVERLAY                  
         B        TELERROR                                                      
*                                                                               
*                                                                               
TELCNTRL RES      0                 TEL ENRTY BY CONTROL/BREAK                  
         LI,R0    X'08'             ENTER MASTER MODE                           
         SCS,R0   -8                                                            
         CAL1,5   R0                                                            
         LPSD,0   TEL101            NOW GET OUT OF MASTER MODE PROTECTED        
         BOUND    8                 AND GET CORRECT WRITE KEY FOR               
TEL101   EQU      %                 MESSING AROUND IN THE MONITOR               
         GEN,12,20  X'004',TEL102   BUT STAY MAPPED                             
         DATA     0                                                             
TEL102   EQU      %                 SALLY FORTHE                                
*                                                                               
         LB,R1    TCBPOINT                                                      
         LB,R1    STIJID,R1                                                     
         LW,R1    SJI1,R1           JCBADDRESS                                  
         LW,R2    JCBTJEBB,R1       GET WORKSPACE ADDRESS                       
         BEZ      TCNL1             IF NO WORK SPACE YET, OUT                   
         LW,R2    *R2               CONVERT 'CONTROL WORD', UGH                 
         AND,R2   M17                                                           
         LW,R1    INTELFLG,R2       TEST IF ALREADY UNDER CONTROL               
         BEZ      TCNL1A                                                        
TCNL1    LW,R0    TELTPRTN,R2                                                   
CNTLEXIT B        R0                DO TRAP RETRY CAL                           
TCNL1A   RES      0                                                             
         STW,R2   CNTRLFLG,R2       SET CONTROL ENTRY FLAG                      
         LW,R0    TCNL2                                                         
         STW,R0   LOOKSEE,R2                                                    
         B        TELREAD           AND PROCESS BREAKEE NEEDS                   
TCNL2    B        *R8                                                           
*                                                                               
*                                                                               
TELREAD  RES      0                 ENTRY POINT TO                              
REREAD   RES      0                 READ A TEL COMMAND                          
         STW,R2   INTELFLG,R2       INDICATE PRESENCE                           
         BAL,R8   LOOKSEE,R2        CHECK IN FOR DEBUG SNAP                     
         LI,R7    ENDCLEAR-CLEARBLK  CLEAR WORK CELLS                           
         LI,R15   0                                                             
         LI,R0    CLEARBLK-1                                                    
         AW,R0    R2                                                            
         STW,R15  *R0,R7                                                        
         BDR,R7   %-1                                                           
         LI,R7    11                DEFAULT TYPE IS RUN                         
         STW,R7   TYPECMND,R2                                                   
         LW,R7    ERRLINK                                                       
         STW,R7   ERROR,R2          SET ERROR LINKAGE THIS OVERLAY              
         LI,R7    -1                                                            
         STW,R7   JOBPRITY,R2                                                   
         BAL,R9   CLEARINP          SET INPUT AREA TO ALL BLANKS                
         CAL1,1   READFPT,R2                                                    
         LI,R7    TELINPUT+18                                                   
         AW,R7    R2                WORD ADDR OF END OF CMND BUFFER             
         SLS,R7   2                 FORM LAST BYTE +1                           
*        BIT 8 IS RESET TO TELL SCAN IT IS NOT IN A PAREN FIELD                 
         LI,R0    -72                                                           
         STB,R0   R7                SET BYTE INDEX                              
*        R7 IS NOW PREPARED AS REQUIRED BY SCAN                                 
         PAGE                                                                   
         LI,R11   0                 SCAN FOR POSSIBLE FID FIELD                 
         BAL,R14  SCAN                                                          
         CI,R6    0                                                             
         BLE      S:ERROR           B IF ERROR OR PAREN GROUP                   
         CI,R6    3                                                             
         BE       RUNNER            B IF FID (FILENAME.AA)                      
         CI,R10   0                 TEST FOR NULL ENTRY                         
         BNE      %+4               IF NOT NULL, THEN FORWARD                   
         CI,R6    2                 TEST IMMEDIATE LINE FEED                    
         BNE      S:ERROR           IF NOT, BOGUS INPUT                         
         B        REREAD            OTHERWISE, JUST READ AGAIN                  
         AI,R6    -2                SAVE TERMINATOR, FIELD OR COMMAND           
         STW,R6   ENDFLAG,R2                                                    
         LI,R0    COMMANDS          SEARCH FOR TEL COMMAND                      
         BAL,R5   TEXTWORD                                                      
         B        RUNNER            IF NOT, ASSUME PROCESSOR NAME               
         LB,R5    CMNDINDX,R6       GET SCAN INDEX TYPE                         
         STW,R6   TYPECMND,R2       SAVE FOR AFTER SCAN                         
         B        %+1,R5            SEPARE FOR PROCESSING                       
         B        TELTYPE0          NO PARAMETER FIELD                          
         B        TELTYPE1          HEX VALUE ONLY                              
         B        TELTYPE2          FILENAME.AREA                               
         B        TELTYPE3          TASKNAME ONLY                               
         B        TELTYPE4          SPECIAL FOR TABS                            
         B        TELTYPE5          SPECIAL FOR STDLB                           
         B        TELTYPE6          SPECIAL FOR RUN                             
         B        TELTYPE7          SPECIAL FOR INIT                            
         B        TELTYPE8          SPECIAL FOR SETNAME                         
         B        TELTYPE9          SPECIAL FOR DEBUG                           
         B        TELTYPEA          SPECIAL FOR MESSAGE                         
         B        TELTYPEB          SPECIAL FOR MUST                            
         PAGE                                                                   
TELTYPE0 RES      0                 COMMANDS WITHOUT PARAMETERS                 
         LW,R6    ENDFLAG,R2                                                    
         BNEZ     S:ERROR           NO PARAMETER FIELD ALLOWED                  
         B        FINISH                                                        
*                                                                               
*                                                                               
TELTYPE1 RES      0                 SINGLE HEX FIELD                            
         LW,R6    ENDFLAG,R2        OUT IF TRMINATED                            
         BEZ      S:ERROR                                                       
         BAL,R15  HEXONLY                                                       
         B        FINISH                                                        
*                                                                               
*                                                                               
TELTYPE2 RES      0                 FILE NAME AND AREA                          
         LW,R6    ENDFLAG,R2        OUT IF TERMINATED                           
         BEZ      S:ERROR                                                       
         BAL,R15  GETFID            GET FILE ID                                 
         B        FINISH                                                        
         PAGE                                                                   
TELTYPE3 RES      0                 SCAN FOR TASKNAME                           
         LW,R6    ENDFLAG,R2                                                    
         BEZ      S:ERROR           OUT IF TERMINATED                           
TSKNME1  RES      0                                                             
         BAL,R15  NEXTWORD                                                      
         CI,R10   0                                                             
         BE       S:ERROR           OUT IF NULL                                 
         CI,R6    1                 SHOULD HAVE TERMINATED                      
         BE       S:ERROR                                                       
         LCI      2                                                             
         STM,R8   TASKNAME,R2       SET TASKNAME FOR LATER CAL                  
         B        FINISH                                                        
         PAGE                                                                   
TELTYPE4 RES      0                 SCAN FOR TAB SETTINGS                       
         LI,R1    13                                                            
         LI,R3    0                                                             
         LI,R15   0                                                             
TAB1     RES      0                                                             
         LI,R11   4                 CONVERT TO DECIMAL                          
         BAL,R14  SCAN              GET NEXT TAB POSITION                       
         CI,R6    0                                                             
         BL       S:ERROR           B IF SCAN ERROR                             
         CW,R8    R15                                                           
         BLE      S:ERROR           OUT IF NOT ASCENDING                        
         LI,R14   TABSET                                                        
         AW,R14   R2                                                            
         STB,R8   *R14,R3                                                       
         AI,R3    1                                                             
         STW,R8   R15                                                           
         CI,R6    2                 TEST COMMAND ENDING                         
         BE       FINISH            OUT IF YES                                  
         BDR,R1   TAB1                                                          
         B        S:ERROR           OUT ON TOO MANY TAB SETTNS                  
         PAGE                                                                   
TELTYPE5 RES      0                                                             
         LW,R6    ENDFLAG,R2                                                    
         BEZ      S:ERROR           OUT IF TERMINATED                           
         BAL,R15  GETOPLB           GET OPLB TO REASSIGN                        
         LW,R15   OPLBNAME,R2       GET SCANNED NAME                            
         STW,R15  OPLABEL,R2        SAVE IT                                     
         BAL,R15  GIO               GET I/O MEDIUM FOR REASSIGNMENT             
         B        FINISH                                                        
         PAGE                                                                   
RUNNER   RES      0                 SPECIAL FOR PROCESSOR NAME CMND             
*        RESTART SCAN FROM BEGINNING                                            
         LI,R7    TELINPUT+18                                                   
         AW,R7    R2                WORD ADDR OF END OF CMND BUFFER             
         SLS,R7   2                 FORM LAST BYTE +1                           
*        BIT 8 IS RESET TO TELL SCAN IT IS NOT IN A PAREN FIELD                 
         LI,R0    -72                                                           
         STB,R0   R7                SET BYTE INDEX                              
*        R7 IS NOW PREPARED AS REQUIRED BY SCAN                                 
         B        RUNNER2                                                       
*                                                                               
TELTYPE6 RES      0                 SPECIAL FOR RUN COMMAND                     
         LW,R6    ENDFLAG,R2                                                    
         BEZ      S:ERROR           OUT IF TERMINATED                           
RUNNER2  RES      0                                                             
         BAL,R15  GETFID            GET FILE ID TO RUN                          
TEL61    RES      0                                                             
         LCI      2                                                             
         LM,R14   MYNAME                                                        
         STM,R14  TASKNAME,R2                                                   
         LW,R0    GIOABIT                                                       
         CW,R0    GIOCT,R2                                                      
         BANZ     TEL63             B IF ACCOUNT SPECIFIED                      
         MTW,0    FILEAREA,R2                                                   
         BNEZ     TEL63             B IF AREA NAME SPECIFIED                    
         LI,R5    S:SPAI            SYSTEM PROCESSORS AREA INDEX                
         LH,R0    MDNAME,R5         AREA NAME                                   
         AND,R0   XFFFF             TRIMMED                                     
         STW,R0   FILEAREA,R2       PROCESS                                     
TEL63    RES      0                                                             
         CI,R6    2                                                             
         BNE      DEBUGING          NOW LOOK FOR DEBUG REQUEST                  
         B        FINISH                                                        
*                                                                               
         PAGE                                                                   
TELTYPE7 RES      0                 SPECIAL SCAN FOR INIT                       
         LW,R1    R7                SAVE SCAN POINTER WORD                      
         BAL,R15  NEXTWORD          GET FIRST PARAMETER                         
         LI,R0    INITPFIX          TEST IF PREFIX                              
         BAL,R5   TEXTWORD                                                      
         B        TEL71             PRESUME TASK NAME                           
         STW,R6   PRISEC,R2         SAVE DIFERENITATION                         
         B        TEL75                                                         
TEL71    RES      0                                                             
         LW,R7    R1                GET SAVED SCAN POINTER FOR RESCAN           
TEL75    RES      0                                                             
         BAL,R15  GETFID            GET FILE ID                                 
         LCI      2                                                             
         LM,R8    LDMODULE,R2                                                   
         STM,R8   TASKNAME,R2       SET TASKNAME TO LM NAME SCANNED             
         LI,R8    X'FFFF'                                                       
         STW,R8   INITPRTY,R2       SET DEFAULT PRIORITY                        
         CI,R6    2                                                             
         BGE      FINISH            B IF NO MORE OPTIONS                        
         BAL,R15  NEXTWORD          GET NEXT KEYWORD                            
         LI,R0    ATUNDER           GET ITS TYPE                                
         BAL,R5   TEXTWORD                                                      
         B        S:ERROR           IF NEITHER, AN ERROR                        
         CI,R6    UNDERKW                                                       
         BE       DBUG2             B IF 'UNDER'                                
         LW,R0    PRISEC,R2         GET TASK TYPE                               
         CI,R0    PRIMKW                                                        
         BE       S:ERROR           B IF PRIMARY                                
         BAL,R15  NEXTWORD          GET NEXT KEYWORD                            
         LI,R0    TELPRITY          TEST FOR 'PRIO'                             
         BAL,R5   TEXTWORD                                                      
         B        S:ERROR           NO, THEN ERROR                              
         BAL,R15  HEXONLY           AND GET VALUE                               
DEBUGING BAL,R15  NEXTWORD          TRY FOR DEBUG REQUEST                       
         CI,R6    2                                                             
         BE       S:ERROR           TERMINATING - ERROR                         
DBUG1    RES      0                                                             
         LI,R0    UNDERDB           TEST FOR 'UNDER'                            
         BAL,R5   TEXTWORD                                                      
         B        S:ERROR           NOT CORRECT LANGUAGE                        
DBUG2    BAL,R15  NEXTWORD          MORE VERNACULAR                             
         LI,R0    DEBUGIT           TEST FOR 'DEBUG'                            
         BAL,R5   TEXTWORD                                                      
         B        S:ERROR           WRONG WORD                                  
         LI,R0    -1                                                            
         STW,R0   DBUGFLAG,R2       SET DEBUG REQUESTED                         
         B        FINISH                                                        
         PAGE                                                                   
TELTYPE8 RES      0                 SPECIAL FOR SETNAME                         
         LW,R6    ENDFLAG,R2                                                    
         BEZ      S:ERROR           OUT IF TERMINATED                           
         BAL,R15  NEXTWORD                                                      
         LCI      2                                                             
         STM,R8   TASKNAME,R2       SET TASKNAME                                
         LD,R8    BLANKS            DEFAULT IS CLEAR LDMOD NAME                 
         CI,R6    2                                                             
         BE       %+2               USE DEFAULT                                 
         BAL,R15  NEXTWORD                                                      
         STW,R8   LDMODULE,R2                                                   
         STW,R9   LDMODULE+1,R2                                                 
         CI,R6    2                                                             
         BNE      S:ERROR           SHOULD BE TERMINATOR                        
         B        FINISH                                                        
*                                                                               
*                                                                               
TELTYPE9 RES      0                 SPECIAL FOR DEBUG                           
         LCFI     2                                                             
         LM,R14   MYNAME                                                        
         STM,R14  TASKNAME,R2       INITIALIZE TO TEL                           
         LW,R6    ENDFLAG,R2        TEST  IF TERMINATED                         
         BNEZ     TSKNME1           NO, THEN GET TASK NAME                      
         B        FINISH                                                        
*                                                                               
MYNAME   TEXT     'TEL     '                                                    
         PAGE                                                                   
TELTYPEA RES      0                 SPECIAL FOR MESSAGEIST                      
         STW,R7   MSGPTR,R2         SAVE SCAN POINTER FOR EXEC                  
         B        FINISH                                                        
         PAGE                                                                   
TELTYPEB RES      0                 SPECIAL FOR MUST                            
         LCI      4                                                             
         LM,R8    MUSTID            GET LM FILE ID FOR RADEDIT                  
         STM,R8   GIOCT,R2          STORE AS THOUGH SCANNED                     
         LI,R6    2                 SIMULATE END OF LINE                        
         B        TEL61             CONTINUE AS FOR 'RUN RADEDIT'               
*                                                                               
MUSTID   DATA     X'10000000'       FILE NAME, BUT NOT ACNT                     
         DATA     0                 NO AREA NAME                                
         TEXT     'RADEDIT'                                                     
         PAGE                                                                   
TEXTWORD RES      0                 FIND A KEYWORD IN A LIST                    
         LW,R6    *R0               GET LENGTH OF LIST                          
         PUSH     R9                SAVE R9                                     
         LW,R9    YFFFFFF           GET COMPARE MASK FOR 3 BYTES                
TXWD1    RES      0                                                             
         CS,R8    *R0,R6                                                        
         BE       %+3               B IF MATCHED                                
         BDR,R6   TXWD1             B IF NOT                                    
         AI,R5    -1                CANCEL SKIP RETURN IF NOT FOUND             
         AI,R5    1                 SKIP RETURN                                 
         PULL     R9                RESTORE R9                                  
         B        *R5               RETURN                                      
*                                                                               
*                                                                               
DECONLY  LI,R11   4                 SCAN A DECIMAL VALUE                        
         B        %+2                                                           
HEXONLY  LI,R11   2                 SCAN A HEX VALUE                            
         LI,R4    1                                                             
         BAL,R14  SCAN                                                          
         STW,R8   HEXVALUE,R2       SAVE RESULT                                 
         CI,R10   0                 TEST FOR EMPTY ENTRY                        
         BE       S:ERROR                                                       
         CI,R6    2                 TEST TERMINATION                            
         BE       FINISH            OUT IF SO                                   
         B        STDRETN                                                       
*                                                                               
*                                                                               
NEXTWORD RES      0                 GET NEXT EBCDIC WORD                        
         LI,R11   1                                                             
         BAL,R14  SCAN                                                          
STDRETN  RES      0                 STANDARD RETURN                             
         CI,R6    0                                                             
         BLE      S:ERROR           OUT ONERROR                                 
         B        *R15              RETURN                                      
*                                                                               
*                                                                               
         PAGE                                                                   
         SPACE    3                                                             
GIO      RES      0                 CALL GETIOID FOR ANY I/O ID                 
         LW,R0    GIOBITS           FLAGS FOR ANY I/O MEDIUM                    
GIO10    RES      0                                                             
         LI,R9    GIOCT                                                         
         AW,R9    R2                POINT TO GETIOID CONTROL TABLE              
         STW,R0   *R9               SET FLAGS IN TABLE                          
         BAL,R8   GETIOID           GET I/O MEDIUM ID                           
         B        STDRETN           RETURN TO CALLER                            
*                                                                               
GETOPLB  RES      0                 CALL GETIOID FOR OPLABEL                    
         LW,R0    GIOOBITS          FLAGS FOR OPLABEL ID SCAN                   
         B        GIO10                                                         
*                                                                               
GETFID   RES      0                 CALL GETIOID FOR FILE ID                    
         LW,R0    GIOFBITS          FLAGS FOR FILE ID SCAN                      
         B        GIO10                                                         
*                                                                               
GETDEV   RES      0                 CALL GETIOID FOR DEVICE ID                  
         LW,R0    GIODBITS          FLAGS FOR DEVICE ID SCAN                    
         B        GIO10                                                         
*                                                                               
GIOBITS  DATA     X'70040000'       GETIOID FLAGS FOR ANY I/O MEDIUM            
GIOOBITS EQU      BITABLE+1         GETIOID FLAGS FOR OPLABEL ID                
GIODBITS EQU      BITABLE+2         GETIOID FLAGS FOR DEVICE ID                 
GIOFBITS DATA     X'10040000'       GETIOID FLAGS FOR FILE ID WITH ACNT         
GIOABIT  EQU      BITABLE+13        GETIOID FLAG FOR ACCOUNT NAME               
         PAGE                                                                   
COMMANDS DATA     ENDCMNDS-%-1                                                  
*                 NAME              NUMBER  TYPE                                
         TEXT     'STOP'            1       3                                   
         TEXT     'STAR'            2       3                                   
         TEXT     'GO  '            3       0                                   
         TEXT     'CONT'            4       0                                   
         TEXT     'QUIT'            5       0                                   
         TEXT     'EXTM'            6       3                                   
         TEXT     'EXIT'            7       0                                   
         TEXT     'DEBU'            8       9                                   
         TEXT     'SETN'            9       8                                   
         TEXT     'INIT'            10      7                                   
         TEXT     'RUN '            11      6                                   
         TEXT     'CANC'            12      1                                   
         TEXT     'JOB '            13      1                                   
         TEXT     'BATC'            14      2                                   
         TEXT     'MEDI'            15      2                                   
         TEXT     'MESS'            16      10                                  
         TEXT     'STDL'            17      5                                   
         TEXT     'OFF '            18      0                                   
         TEXT     'TABS'            19      4                                   
         TEXT     'MUST'            20      11                                  
ENDCMNDS RES      0                                                             
*                                                                               
*                                                                               
CMNDINDX DATA,1   0,3,3,0,0,0,3,0,9,8                                           
         DATA,1   7,6,1,1,2,2,10,5,0,4,11                                       
         BOUND    4                                                             
         PAGE                                                                   
INITPFIX DATA     2                                                             
         TEXT     'SECO'                                                        
PRIMKW   EQU      %-INITPFIX                                                    
         TEXT     'PRIM'                                                        
*                                                                               
ATUNDER  DATA     2                                                             
         TEXT     'AT  '                                                        
UNDERKW  EQU      %-ATUNDER                                                     
         TEXT     'UNDE'                                                        
*                                                                               
UNDERDB  DATA     1                                                             
         TEXT     'UNDE'                                                        
*                                                                               
TELPRITY DATA     1                                                             
         TEXT     'PRIO'                                                        
*                                                                               
DEBUGIT  DATA     1                                                             
         TEXT     'DEBU'                                                        
         PAGE                                                                   
S:ERROR  RES      0                 INDICATE SCAN ERROR TO LINE                 
*        RETURN POINTER TO LAST NON-BLANK SCANNED                               
         LW,R1    R7                BUFFER END POINTER                          
         SLS,R1   -2                CHANGE TO WORD ADDRESS                      
         SAS,R7   -24               CHARACTER INDEX                             
         LI,R0    ' '               BLANK                                       
SERR05   RES      0                                                             
         CI,R7    -72                                                           
         BLE      SERR07            B IF AT START OF BUFFER                     
         CB,R0    *R1,R7                                                        
         BNE      SERR07            B IF NON-BLANK                              
         AI,R7    -1                BACK UP THE POINTER                         
         B        SERR05            CONTINUE BACK-SCAN                          
SERR07   RES      0                                                             
         BAL,R9   CLEAROUT          SET INPUT AREA TO BLANKS                    
         LI,R0    '?'                                                           
         AI,R8    19                                                            
         STB,R0   *R8,R7            STORE MARKER CLOSE BY ERROR                 
         LW,R0    SERR1                                                         
         STW,R0   TELOUT,R2         SET ERROR VERBAGE                           
         AI,R8    -18               ADJUST TO TEL ADDRESS                       
         LI,R9    73                                                            
         AW,R9    R7                SET BYTE COUNT                              
         CAL1,1   WRITEFPT,R2                                                   
         B        REREAD                                                        
SERR1    TEXT     'ERR.'                                                        
*                                                                               
*                                                                               
CLEAROUT LI,R8    TELOUT-1                                                      
         B        %+2                                                           
CLEARINP RES      0                 CLEAR INPUT TO ALL BLANKS                   
         LI,R8    TELINPUT-1                                                    
         LI,R1    ENDTELIN-TELINPUT                                             
         AW,R8    R2                                                            
         LW,R0    BLANKS                                                        
         STW,R0   *R8,R1            CLEAR INPUT AREA FOR OUTPUT                 
         BDR,R1   %-1                                                           
         B        *R9                                                           
A:TEL2   RES      0                                                             
         OLAYEND                                                                
         FIN      #TJE                                                          
         END                                                                    
