         PCC      0                                                             
         SYSTEM   SIG5P                                                         
         SYSTEM   OPTIONS                                                       
         DO       #SYMB                                                         
*   ENTRY POINTS                                                                
         DEF      JOB1                                                          
         DEF      JOBSCAN,JSCAN                                                 
*   EXIT POINTS                                                                 
         DEF      JTRAPX,JOBERR3                                                
         DEF      JOBSCX,JOBSCXE                                                
         DEF      JOBEX,JOBNX                                                   
*                                                                               
OLAYFLAG EQU      'JOB1'                                                        
         SYSTEM   CPRMON                                                        
         TITLE    '** JOB1 **'                                                  
         TITLE    '** JOB1 - M:JOB TSPACE DESCRIPTION **'                       
*                                                                               
*   THE M:JOB CALL USES 64 WORDS OF TSPACE IN THE BATCH MODE                    
*    (I.E. WHEN P4=1).                                                          
*   USE OF THE TSPACE IS AS FOLLOWS:                                            
*                                                                               
* WORD 0          UNUSED                                                        
* WORD 1-11       DCB FOR BATCH FILE ASSIGN, READ AND JOB FILE WRITE            
* WORD 12-20      SPACE FOR BUILDING JOB ACCT, NAME, PRI, ID MSG                
* WORD 21-50      BUFFER FOR READING JOB CARD FROM USERS BATCH                  
* WORD 51-53      AREA/FILENAME BLOCK                                           
* WORD 54-55      ACCOUNT NAME BLOCK                                            
*                 FILE AND WRITING EXU RECORD TO JOB FILE                       
* WORD 56-63      UNUSED                                                        
*                                                                               
TSDCB    EQU      1                                                             
TSMESS   EQU      12                MESSAGE BIAS                                
TSBUF    EQU      21                BUFFER BIAS                                 
TSAREA   EQU      51                AREA BLOCK ADDRESS                          
TSFILE   EQU      52                FILENAME BLOCK BIAS                         
TSACCNT  EQU      54                ACCOUNT NAME BLOCK                          
TSTYPE   EQU      4*(TSDCB+1)+2                                                 
         TITLE    '** JOB1 - PROCESS BATCH REQUEST **'                          
*                                                                               
*   ROUTINE PROCESSES THE JOB CALL                                              
*                                                                               
*   AT ENTRY:  R1   FPT CODE                                                    
*              R3   FPT ADDRESS                                                 
*              R4   TASK ID                                                     
*                                                                               
JOB1     RES      0                                                             
         LW,R0    0,R3              GET FPT WORD 0                              
         CW,R0    Y008              IS P0= 1                                    
         BAZ      JTRAPX            NO, ERROR                                   
         LI,R15   K4                                                            
         BAL,R5   GETPII            GET BATCH FILE PARAMETER                    
         B        JOB100            NOT PRESENT                                 
*                                                                               
*   PROCESS BATCH MODE OF JOB CALL                                              
*                                                                               
         LI,R7    64                                                            
         BAL,R8   GETTEMP           GET 64 WORDS OF TSPACE                      
         B        JOBERR3           ERROR, CANT'T GET TSPACE                    
         LW,R0    STISPCE,R4        LINK TSPACE TO CALLER                       
         STW,R0   0,R7                                                          
         STW,R7   STISPCE,R4                                                    
         ENABLE                                                                 
         AND,R7   M17               MASK OFF SIZE                               
*                                                                               
* CREATE A DCB FOR BATCHED FILE                                                 
*                                                                               
         LCI      5                                                             
         LM,R8    JOBDCB                                                        
         STM,R8   TSDCB,R7          PART OF DCB                                 
*                                                                               
         LW,R6    R7                                                            
         AI,R6    TSDCB             FORM DCB ADDRESS IN R6                      
*                                                                               
         LCI      3                                                             
         LM,R8    JOBASN            ASSIGN FPT                                  
*                                                                               
         LW,R11   R14               AREA/FILE PTR                               
*                                                                               
         LI,R15   KE                                                            
         BAL,R5   GETPSII           GET ADDR OF ACCOUNT PTR                     
         AI,R9    -BIT13            RESET B14 BIT                               
         LW,R12   R14               MOVE ACCOUNT PTR INTO R12                   
*                                                                               
         CAL1,1   R8                DO ASSIGN CAL                               
         PAGE                                                                   
*                                                                               
*   READ THE 1ST RECORD OF BATCH FILE                                           
*                                                                               
         LW,R14   R7                                                            
         AI,R14   TSMESS-1                                                      
         LW,R0    BLANKS                                                        
         LI,R1    TSAREA-TSMESS                                                 
         STW,R0   *R14,R1           BLANK BUFFER AREA                           
         BDR,R1   %-1                                                           
*                                                                               
         AI,R14   TSBUF-TSMESS+1                                                
         LI,R15   K1FFFF                                                        
         STS,R14  TSDCB+2,R7        STORE BUFFER ADDRESS IN DCB                 
*                                                                               
         LCI      4                                                             
         LM,R11   JOBREAD           MOVE READ FPT TO R11-R14                    
         CAL1,1   R11               READ THE 1ST RECORD                         
*                                                                               
* GET ASSIGNMENT VALUES                                                         
*                                                                               
         LCI      5                                                             
         LM,R8    JOBGASN           GET GET ASSIGN FPT                          
         AW,R11   R7                POINT TO AREA/NAME BLOCK                    
         AW,R12   R7                POINT TO ACCOUNT BLOCK                      
         CAL1,1   R8                GET ASSIGNMENT                              
*                                                                               
*   CLOSE THE BATCH FILE                                                        
*                                                                               
         LCI      2                                                             
         LM,R8    JOBCLOSE          PICK UP CLOSE FPT AND                       
         CAL1,1   R8                CLOSE USERS FILE                            
*                                                                               
*   GET THE RECORD WHICH MUST BE A JOB CARD AND SUPPLY                          
*    DEFAULTS FOR MISSING PARAMETERS.                                           
*                                                                               
         LW,R0    TSBUF,R7          GET 1ST FOUR CHARACTERS                     
         LB,R14   R0                GET 1ST BYTE                                
         CI,R14   '!'               IS IT A BANG                                
         BNE      JOBERR4           NO, ERROR                                   
         LW,R10   TSBUF,R7          GET 1ST WORD FROM BUFFER                    
         LW,R11   TSBUF+1,R7        GET NEXT WORD FROM BUFFER                   
         SCD,R10  8                                                             
         CW,R10   XJOB              IS IT A PROPER JOB CARD                     
         BNE      JOBERR4           NO, ERROR                                   
         LW,R1    R7                YES                                         
         AI,R1    TSBUF             R1= WA OF INPUT BUFFER                      
         LW,R2    R7                                                            
         AI,R2    TSMESS            R2= WA OF MESSAGE BUFFER                    
         BAL,R5   JOBSCAN           VALIDATE JOB CARD AND FORMAT OC MSG         
         B        JOBERR4           ERROR IN JOB CARD                           
         PAGE                                                                   
*                                                                               
*   REGISTERS ARE AS FOLLOWS                                                    
*        R3   FPT ADDR                                                          
*        R7   TSPACE POINTER                                                    
*        R14  PRIORITY IN BINARY                                                
*                                                                               
JOB50    RES      0                 GET A NUMBER FOR THIS JOB                   
         DISABLE                                                                
         LH,R5    SYMB              R5= # TO USE FOR THIS JOB                   
         MTH,1    SYMB              INCREMENT FOR NEXT JOB                      
         ENABLE                                                                 
         LW,R13   R5                CONVERT JOB # TO EBCDIC                     
         BAL,R8   SMHEXBCD                                                      
         LW,R0    1,R3              FPT WORD 1                                  
         CW,R0    Y1                IS THIS A BATCH CALL                        
         BAZ      JOB60             NO, BRANCH                                  
         LW,R15   R7                R15= TSPACE POINTER                         
         AI,R15   TSMESS            R15= WA OF OUTPUT MESSAGE BUFFER            
*   MOVE JOB # INTO MESSAGE BUFFER                                              
         LI,R0    ','                                                           
         STB,R0   R13               STORE COMMA BEFORE JOB#                     
         LI,R10   4                 NUMBER OF BYTES TO MOVE                     
         LI,R1    0                 'FROM' BYTE INDEX                           
         LB,R2    *R15              R2= 'TO' BYTE INDEX                         
JOB55    RES      0                                                             
         LB,R9    R13,R1            GET NEXT BYTE TO MOVE                       
         STB,R9   *R15,R2           STORE IT IN OUTPUT BUFFER                   
         AI,R1    1                 BUMP POINTERS                               
         AI,R2    1                                                             
         BDR,R10  JOB55                                                         
         STB,R2   *R15              SAVE NEW BYTE COUNT IN BUFFER               
         PAGE                                                                   
*                                                                               
*   NOW ALLOT THE JOB FILE                                                      
*   REGISTERS ARE:                                                              
*        R3       FPT ADDRESS                                                   
*        R13      JOB NUMBER IN EBCDIC (BITS 8-31)                              
*        R14      JOB PRIORITY IN BINARY                                        
*        R7       TSPACE POINTER                                                
*        R5       JOB NUMBER (BINARY)                                           
*                                                                               
JOB60    RES      0                                                             
         LW,R10   R13                                                           
         LW,R11   M24                                                           
         LD,R12   BFJJJ000          GET SKELETON JOB FILE NAME                  
         LW,R0    1,R3              GET FPT WORD 1                              
         CW,R0    Y1                IS THIS A BATCH CALL                        
         BANZ     JOB65             YES, BRANCH                                 
         LI,R15   KCR                                                           
         CI,R0    F4                DEFINING 'IS' AREA FILE                     
         BANZ     %+2               YES, FILE STARTS WITH CR                    
         LI,R15   KLP               NO, FILE STARTS WITH LP                     
         STH,R15  R12               STORE CR OR LP INTO FILE NAME               
JOB65    RES      0                                                             
         SCD,R12  8                 POSITION R12 FOR STORING                    
         STS,R10  R12               STORE JOB NUMBER IN FILE NAME               
         SCD,R12  -8                                                            
         PUSH     3,R5              SAVE R5-R7                                  
         PUSH     R14                                                           
         LI,R6    0                 FLAG                                        
         LI,R15   K3                                                            
         BAL,R5   GETPII            GET SYMBIONT FILE NAME PARAMETER            
         B        JOB66             NAME NOT WANTED                             
         LW,R6    R14               ADDRESS TO STORE AREA, FILE NAME            
         PAGE                                                                   
*                                                                               
* R3     FPT ADDR                                                               
* R12/13 FILE NAME                                                              
* R6     ADDR TO RETURN AREA/FILENAME                                           
*                                                                               
JOB66    RES      0                                                             
         LI,R15   KIS                                                           
         LI,R11   S:ISFSIZ          FILE SIZE FOR FILES IN IS AREA              
         LW,R0    1,R3              FPT WORD 1                                  
         CW,R0    Y1                IS THIS A BATCH CALL                        
         BANZ     JOB67             YES, AREA IS IS                             
         CI,R0    F4                NO, DEFINING IS AREA FILE                   
         BANZ     JOB67             YES, AREA IS IS                             
         LI,R15   KOS               NO, AREA IS OS                              
         LI,R11   S:OSFSIZ          FILE SIZE FOR OS AREA                       
*                                                                               
* R15    AREA NAME                                                              
* R11    FILE SIZE                                                              
*                                                                               
JOB67    RES      0                                                             
         CI,R6    0                 B IF FILE NAME NOT WANTED                   
         BE       JOB70             NO NAME RETURN REQUESTED                    
         STW,R15  0,R6              STORE AREA NAME                             
         LCI      2                                                             
         STM,R12  1,R6              STORE FILE NAME                             
*                                                                               
* FORM THE ALLOT FPT AND ALLOT THE SYMBIONT FILE                                
*                                                                               
* R11    FILE SIZE                                                              
* R12/13 FILE NAME                                                              
* R15    AREA NAME                                                              
*                                                                               
JOB70    RES      0                                                             
         PULL     R14                                                           
         LCI      4                                                             
         LM,R5    JOBALLOT          LOAD ALLOT FPT INTO R5-R8                   
*                                                                               
         LCI      2                                                             
         LM,R9    R12               MOVE FILE NAME                              
*                                                                               
         STS,R15  R5                PUT AREA IN ALLOT FPT                       
*                                                                               
         CAL1,7   R5                ALLOT THE SYMBIONT JOB FILE                 
         PULL     3,R5                                                          
         PAGE                                                                   
*                                                                               
*   SET PRIORITY IN THE DIRECTORY ENTRY                                         
*   REGISTERS ARE:                                                              
*        R3       FPT ADDRESS                                                   
*        R5       JOB#                                                          
*        R7       TSPACE POINTER (BATCH CALL ONLY)                              
*        R12      SYMBIONT FILE NAME WORD 1                                     
*        R13      SYMBIONT FILE NAME WORD 2                                     
*        R14      JOB PRIORITY                                                  
*        R15      AREA NAME (EBCDIC, BITS 16-31)                                
         PUSH     R5                SAVE JOB #                                  
         LW,R8    R15               R8= AREA NAME                               
         BAL,R5   FMMASTX           GET AREA'S INDEX IN R6                      
         BAL,R0   SYMCRSH           CRASH                                       
         PULL     R5                                                            
         LW,R10   R14               PRIORITY                                    
         BAL,R8   SETPRI            SET PRIORITY IN DIRECTORY ENTRY             
         B        JOBERR7           ERROR                                       
         LW,R0    1,R3              FPT WORD 1                                  
         CW,R0    Y1                IS THIS A BATCH CALL                        
         BAZ      JOB80             NO, BRANCH                                  
         PAGE                                                                   
*                                                                               
*   CONSTRUCT A RECORD THAT IDENTIFIES THE FILE THAT WAS BATCHED                
*    AND WRITE IT TO THE NEW SYMBIONT JOB FILE.  THIS RECORD WILL               
*    BE READ BY THE INPUT COOPERATIVE AND HAS THE FORMAT:                       
*    !EXU FID                                                                   
*                                                                               
*   REGISTERS ARE:                                                              
*        R3       FPT ADDRESS                                                   
*        R5       JOB NUMBER                                                    
*        R6       AREA INDEX                                                    
*        R7       TSPACE POINTER                                                
*        R12,13   SYMBIONT JOB FILE NAME                                        
*                                                                               
         PUSH     R5                SAVE R5                                     
*                                                                               
         LCI      2                                                             
         LM,R8    JOBREC                                                        
         STM,R8   TSBUF,R7          BANG EXU                                    
*                                                                               
         LCI      2                                                             
         LM,R8    TSFILE,R7         PICK UP FILE NAME                           
*                                                                               
         LI,R5    8                                                             
JOB72    CB,R9    BLANKS                                                        
         BNE      %+2                                                           
         SCD,R8   -8                                                            
         BDR,R5   JOB72             RIGHT JUSTIFY FILE NAME                     
*                                                                               
         LCI      2                                                             
         STM,R8   TSBUF+2,R7        FILE NAME                                   
         LW,R8    TSAREA,R7                                                     
         SLS,R8   8                                                             
         OR,R8    JOBDOTS                                                       
         STW,R8   TSBUF+4,R7        DOT AREA DOT                                
*                                                                               
         LCI      2                                                             
         DO       #DFACNT                                                       
         LM,R8    TSACCNT,R7                                                    
         ELSE     #DFACNT=0                                                     
         LM,R8    BLANKS                                                        
         FIN      #DFACNT=0                                                     
         STM,R8   TSBUF+5,R7        ACCOUNT #                                   
         PAGE                                                                   
*                                                                               
* ASSIGN DCB TO INPUT SYMBIONT FILE                                             
*                                                                               
* R15    AREA NAME                                                              
* R12/13 FILE NAME                                                              
* R7     TEMP SPACE PTR                                                         
*                                                                               
         PULL     R5                                                            
         LI,R0    JOBERR6           ERROR HANDLER FOR FILE WRITE                
         STW,R0   TSDCB+4,R7                                                    
         LI,R8    RECSZ             R8= BYTE SIZE OF BUFFER                     
         SLS,R8   1                                                             
         STH,R8   R0                                                            
         STW,R0   TSDCB+3,R7        STORE RSZ,ERR ADDR IN DCB                   
*                                                                               
         LI,R6    TSDCB                                                         
         AW,R6    R7                FORM DCB ADDRESS IN R6                      
*                                                                               
         LD,R14   R12               MOVE FILE NAME                              
         LI,R13   'IS'              AND ADD IN AREA NAME                        
         LI,R11   R13               AND SET PTR TO AREA/NAME BLOCK              
*                                                                               
         LCI      3                                                             
         LM,R8    JOBASN            GET ASSIGN FPT                              
*                                                                               
         AI,R9    -P14              DONT SPECIFY ACCOUNT                        
*                                                                               
         CAL1,1   R8                ASSIGN DCB TO SYMBIONT FILE                 
*                                                                               
*   LOAD WRITE FPT INTO R11-R14                                                 
*                                                                               
         LCI      4                                                             
         LM,R11   JOBWRIT                                                       
*                                                                               
* WRITE THE EXU COMMAND OUT TO THE IS FILE                                      
*                                                                               
         CAL1,1   R11               WRITE !EXU RECORD TO JOB FILE               
*                                                                               
* CLOSE THE JOB FILE                                                            
*                                                                               
         LI,R0    X'95'             CHANGE FPT CODE TO CLOSE                    
         STB,R0   R11               STORE IN FPT                                
         CAL1,1   R11               CLOSE THE JOB FILE                          
         PAGE                                                                   
*                                                                               
*   REGISTERS ARE:                                                              
*        R3       FPT ADDR                                                      
*        R5       JOB NUMBER                                                    
*        R7       TSPACE POINTER                                                
*   NOW TYPE MESSAGE INDICATING BATCH FILE ACCEPTED.  MESSAGE HAS THE           
*   FORMAT    !!JOB ACCOUNT,USERID,PRIO,JOBID   !EXU FID                        
*                                                                               
         LW,R0    R7                                                            
         AI,R0    TSBUF+7           END OF FID OLD BUFFER                       
         LW,R1    R7                                                            
         AI,R1    TSBUF+5           END OF FID NEW BUFFER                       
         LI,R2    -5                                                            
         LW,R15   *R0,R2            MOVE OLD BUFFER                             
         STW,R15  *R1,R2            TO NEW BUFFER                               
         BIR,R2   %-2                                                           
         LW,R2    R7                                                            
         AI,R2    TSMESS            R2 = MESSAGE ADDRESS                        
         LI,R15   4*(TSBUF+5-TSMESS)  BYTE COUNT                                
         STB,R15  *R2               FOR TEXTC FORMAT MESSAGE                    
         PUSH     5,R3              SAVE R3-R7                                  
         BAL,R5   JOBMSG            SUBR TO OUTPUT MESSAGE                      
         PULL     5,R3                                                          
*                                                                               
* GET JOB NUMBER PARAMETER                                                      
*                                                                               
JOB80    RES      0                                                             
         LW,R12   R5                R12= JOB NUMBER                             
         LI,R15   K5                                                            
         BAL,R5   GETPI             GET ADDRESS TO STORE JOB NUMBER             
         B        %+2               NOT PRESENT                                 
         STW,R12  *R14              STORE IT                                    
*   CLEANUP TSPACE                                                              
         LW,R0    1,R3              FPT WORD 1                                  
         CW,R0    Y1                IS THIS A BATCH CALL                        
         BAZ      %+2               NO                                          
         BAL,R8   JOBRELT           YES, DECHAIN AND RELEASE TSPACE             
         LW,R7    R12               R7= JOB NUMBER                              
         B        JOB220                                                        
         TITLE    '** JOB1 - DEFINE SYMBIONT FILE **'                           
*                                                                               
*                                                                               
*                                                                               
JOB100   RES      0                                                             
         LW,R8    1,R3              GET FPT WORD 1                              
         CI,R8    F1+F2             IS CALL ALLOT OR DELETE                     
         BAZ      JOB200            NO, THIS IS A STATUS CALL                   
         CI,R8    F1                DEFINING A NEW JOB FILE                     
         BAZ      JOB300            NO, PROCESS DELETE MODE OF CALL             
*                                                                               
*   HERE WE ARE DEFINING A NEW JOB FILE                                         
*                                                                               
         CI,R8    F4                IS IT IS OR IS IT OS                        
         BAZ      JOB120            B IF OS                                     
         LI,R15   K8                HERE IF IS                                  
         BAL,R5   GETPI             GET SUPPLIED PRIORITY                       
         LI,R15   PRIDFLT           NOT PRESENT, USE DEFAULT                    
         LW,R14   R15               R14= PRIORITY                               
         B        JOB50             PROCESS ALLOT, ETC....                      
*                                                                               
JOB120   RES      0                 DEFINING AN OS AREA FILE                    
         LW,R5    JOB#              R5= NUMBER OF RUNNING JOB                   
         LW,R13   R5                                                            
         BAL,R8   SMHEXBCD          CONVERT JOB# TO EBCDIC IN R12,R13           
         LW,R14   JOBPRI            R14= PRIORITY OF RUNNING JOB                
         B        JOB60             ALLOT THE FILE                              
         TITLE    '** JOB1 - PROCESS STATUS CHECK **'                           
*                                                                               
*                                                                               
*                                                                               
JOB200   RES      0                                                             
         LI,R15   K5                                                            
         BAL,R5   GETPI             GET JOB#                                    
         B        JTRAPX            NOT PRESENT, SO IT MUST BE A BAD CAL        
         LW,R7    R15               R7= JOB# FOR WHICH STATUS IS WANTED         
         LI,R15   K8                                                            
         BAL,R5   GETPI             GET PRIORITY IN R15                         
         B        JOB220            NOT PRESETN, ANY CALLER IS OK               
*  WHEN PRIORITY PARAMETER IS PRESENT IN STATUS MODE OF                         
*   JOB CALL, THIS IS A REQUEST TO CHANGE THE JOB'S PRIORITY.                   
*    THIS IS ALLOWED ONLY IF THE CALLER IS COOPERATIVE OR CPR.                  
         BIFRBM   JOB210            OK                                          
         BIFMU    JOB210            OK                                          
         B        JTRAPX            OTHERWISE, BAD CALL                         
JOB210   RES      0                                                             
         LW,R13   R7                                                            
         PUSH     R15               SAVE PRIORITY                               
         BAL,R8   SMHEXBCD          CONVERT JOB# TO EBCDIC IN R13               
         PULL     R15               R15= PRIORITY                               
         LW,R10   R13               R10= JOB NUMBER                             
         LW,R11   M24                                                           
         LD,R12   BFJJJ000                                                      
         SCD,R12  8                                                             
         STS,R10  R12               MERGE JOB# INTO JOB FILE NAME               
         SCD,R12  -8                                                            
         LI,R0    '  '                                                          
         STH,R0   R12               R12,R13 CONTAIN FILE NAME FOR SEARCH        
*                                    AND IS OF THE FORM '  JJJ000'              
*                                   WHICH MEANS TO SEARCH FOR ANY FILE          
*                                   WHICH HAS THIS JOB# AND IS NOT AN           
*                                   EXTENSION FILE.                             
         DISABLE                                                                
         CW,R10   JOB#                                                          
         BNE      %+2               B IF AFFECTED JOB NOT RUNNING               
         STW,R15  JOBPRI            CHANGE RUNNING JOB PRIORITY                 
         ENABLE                                                                 
         LI,R8    KIS                                                           
         BAL,R5   FMMASTX           GET 'IS' AREA'S INDEX IN R6                 
         BAL,R0   SYMCRSH             AREA HAS TO BE VALID, BUT ...             
         LW,R10   R15               SET PRIORITY TO GIVE TO JOB                 
         BAL,R8   SETPRI            CHANGE PRIORITY OF JOB IN IS AREA           
         NOP                                                                    
         LI,R8    KOS                                                           
         BAL,R5   FMMASTX           GET OS AREA INDEX                           
         BAL,R0   SYMCRSH                                                       
         BAL,R8   SETPRI            CHANGE JOB PRIORITY IN OS AREA              
         NOP                                                                    
*                                                                               
*   PROCESS 'JOB STATUS' OPTION                                                 
*        R3       FPT ADDRESS                                                   
*        R7       JOB NUMBER                                                    
JOB220   RES      0                                                             
         LI,R15   K6                                                            
         BAL,R5   GETPI             GET ADDRESS TO STORE JOB STATUS             
         B        JOB240            NOT PRESENT                                 
         LW,R11   JOB#              R11= NUMBER OF RUNNING JOB                  
         LH,R12   SYMB              R12= CURRENT JOB                            
         LI,R0    3                                                             
         CW,R7    R12               IS JOB GRTR THAN CURRENT JOB                
         BGE      JOB230            YES, JOB 'DOESN'T EXIST'                    
         LI,R0    2                                                             
         CW,R7    R11               IS JOB GRTR THAN RUNNING JOB                
         BG       JOB230            YES, STATUS= 'WAITING'                      
         BL       JOB222            B IF JOB COMPLETED                          
         LW,R0    K:JCP1            EQUAL; MAY BE RUNNING OR COMPLETED          
         CI,R0    1                 HAS A JOB CARD BEEN READ                    
         BANZ     JOB224            YES, JOB IS RUNNING                         
JOB222   RES      0                                                             
         LI,R0    0                 STATUS= 'COMPLETED'                         
         B        JOB230                                                        
JOB224   RES      0                                                             
         LI,R0    1                 SET STATUS= JOB RUNNING                     
JOB230   RES      0                                                             
         STW,R0   *R14              STORE STATUS                                
*                                                                               
*   PROCESS 'JOBS WAITING' OPTION                                               
*        R3       FPT ADDR                                                      
*        R7       JOB NUMBER                                                    
JOB240   RES      0                                                             
         LI,R15   K7                                                            
         BAL,R5   GETPI             GET ADDRESS TO STORE 'JOBS WAITING'         
         B        JOB250            DONE, EXIT                                  
         SW,R7    JOB#              R7= # OF JOBS AHEAD                         
         BGZ      %+2                                                           
         LI,R7    0                                                             
         STW,R7   *R14              STORE VALUE                                 
*   BACKGROUND WILL NOW BE CRANKED UP IF WE ARE IN                              
*   'AUTO BKGD START' MODE AND IF IT IS NOT ALREADY                             
*   RUNNING.                                                                    
JOB250   RES      0                                                             
         LW,R0    1,R3              GET FPT WORD 1                              
         CW,R0    Y1                IS THIS A BATCH CALL                        
         BAZ      JOB252             NO, BRANCH                                 
         LW,R0    SYMB              GET SYMBIONT FLAGS                          
         CI,R0    SYMBC             IN AUTO BKG START MODE                      
         BAZ      JOB252             NO, BRANCH                                 
         BAL,R8   BKGSEQ             YES, START UP BKGD                         
         NOP                         BKGD ALREADY RUNNING                       
JOB252   RES      0                                                             
         LI,R15   TYCNORM           NORMAL TYPE COMPLETION                      
         B        JOBERR3           TAKE NORMAL EXIT                            
         TITLE    '** JOB1 - PROCESS DELETE MODE OF JOB CAL **'                 
*                                                                               
*                                                                               
*                                                                               
JOB300   RES      0                                                             
         LI,R15   K5                                                            
         BAL,R5   GETPI             GET JOB# TO DELETE                          
         B        JTRAPX            BADCAL                                      
*   BUILD A SKELETON FILE NAME WITH SPECIFIED JOB NUMBER.                       
         LW,R13   R15               R13= JOB NUMBER                             
         BAL,R8   SMHEXBCD          CONVERT TO EBCDIC                           
         LW,R14   R13                                                           
         LW,R15   M24                                                           
*                                                                               
*   SEARCH RFT TO MAKE SURE THIS JOB DOES NOT HAVE A FILE OPEN                  
         LH,R1    RFT#              R1= NUMBER OF RFT ENTRIES                   
JOB310   LD,R10   RFT1,R1           GET FILE ENTRY                              
         BEZ      JOB320            B IF NOT IN USE                             
         SCD,R10  8                 POSITION NUMBER TO R10, BITS 24-31          
         CS,R14   R10               COMPARE JOB NUMBERS                         
         BE       JOBERR8           ERROR, CAN'T DELETE OPEN FILES              
JOB320   BDR,R1   JOB310                                                        
*                                                                               
*   OK TO DELETE ALL THE FILES ASSOCIATED WITH THE SPECIFIED JOB#.              
*        R3       FPT ADDRESS                                                   
*        R13      JOB# IN EBCDIC (BITS 8-31)                                    
*                                                                               
         LI,R1    -1                GET A BLOCKING BUFFER                       
         BAL,R5   FINDBB            R15= BBCW ADDRESS                           
         B        JOBERR9           ERROR, NONE AVAILABLE                       
         LI,R8    KIS                                                           
         BAL,R5   FMMASTX           GET 'IS' AREA'S INDEX IN R6                 
         BAL,R0   SYMCRSH             AREA HAS TO BE VALID, BUT ...             
         LW,R10   R15               SET ADDRESS OF BBCW FOR DELETE              
         PUSH     R13                                                           
         BAL,R8   JOBDLTE           DELETE ALL FILES IN IS AREA                 
         B        JOBERR10          ERROR                                       
*                                                                               
         PULL     R13                                                           
         LI,R8    KOS                                                           
         BAL,R5   FMMASTX           GET OS AREA INDEX                           
         BAL,R0   SYMCRSH                                                       
         BAL,R8   JOBDLTE           DELETE ALL FILES IN OS AREA                 
         B        JOBERR17          ERR (R15 = TYC)                             
         LI,R15   TYCNORM           NORMAL COMPLETION                           
         B        JOBERR17          TAKE NORMAL EXIT                            
         TITLE    '** JOB1 - ERROR CLEANUP AND EXITS **'                        
*                                                                               
JTRAPX   B        TRAPX             ILLEGAL CALL, ETC                           
*                                                                               
JOBERR1  LI,R15   K70               BAD AREA NAME                               
JOBERR2  BAL,R8   JOBRELT           CLEANUP TSPACE                              
JOBERR3  B        TMX1              TMSETERR,TMTYC, ETC.                        
*                                                                               
JOBERR4  LI,R15   X'7A'             ILLEGAL JOB CARD                            
         B        JOBERR2                                                       
*                                                                               
JOBERR5  RES      0                                                             
         PULL     3,R5                                                          
JOBERR6  LB,R15   R10               R15= TYC                                    
         CI,R15   K3                IS IT NON-EXISTENT FILE                     
         BNE      %+2               NO, bRANCH                                  
         LI,R15   K71               YES, SUBSTITUTE ERROR FOR POSTING           
JOBERR7  LW,R0    1,R3              GET FPT WORD 1                              
         CW,R0    Y1                BATCH CALL                                  
         BAZ      JOBERR3           NO                                          
         B        JOBERR2           YES, RLS TSPACE                             
*                                                                               
JOBERR8  LI,R15   K60               FILE BUSY                                   
         B        JOBERR3                                                       
*                                                                               
JOBERR9  LI,R15   K55               NO BLOCKING BUFFER                          
         B        JOBERR3                                                       
*                                                                               
JOBERR10 RES      0                                                             
         PULL     R13                                                           
*                                                                               
JOBERR17 RES      0                                                             
         LW,R6    R10               SET ADDRESS OF BBCW AND                     
         BAL,R11  RELADBUF          RELEASE IT                                  
         B        JOBERR3           EXIT                                        
*                                                                               
         TITLE    '** JOB1 - JOBSCAN SUBROUTINE **'                             
*************                                                                   
*  JOBSCAN  *                                                                   
*************                                                                   
*                                                                               
*   ROUTINE TO VALIDATE AND SUPPLY DEFAULT JOB CARD PARAMETERS FOR THE          
*   SYMBIONTS, AND BUILD THE !!JOB ACCT,NAME,PRI MESSAGE TO BE                  
*   OUTPUT TO OC.  (ID FIELD IS ADDED LATER)                                    
*                                                                               
*   AT ENTRY:  R1   WORD ADDRESS OF INPUT BUFFER WHICH CONTAINS JOB CARD        
*              R2   WORD ADDRESS OF BUFFER WHERE OUTPUT MESSAGE WILL            
*                     BE CONSTRUCTED.                                           
*              R5   LINK                                                        
*                                                                               
*   ROUTINE RETURNS +1 IF A FORMAT ERROR EXISTS ON THE INPUT JOB CARD           
*   ROUTINE RETURNS +2 WHEN THE JOB CARD HAS BEEN VALIDATED, DEFAULTS           
*    PROVIDED, AND THE OC MESSAGE CONSTRUCTED.                                  
*                                                                               
*   AT EXIT:  R14   PRIORITY(IN BINARY)                                         
*                                                                               
*   ALL REGISTERS ARE DESTROYED                                                 
*                                                                               
JOBSCAN  RES      0                                                             
         PUSH     R5                                                            
         PUSH     R2                                                            
         LW,R14   0,R1              GET 1ST WORD OF INPUT BUFFER                
         LW,R15   1,R1              GET SECOND WORD OF INPUT BUFFER             
         SLD,R14  -8                SHIFT SO BYTE COUNT IN BYTE 0 OF BUF        
         STW,R14  0,R2              STORE IN MESSAGE BUFFER                     
         STW,R15  1,R2                                                          
         SLS,R1   2                 R1= BA OF INPUT BUFFER                      
         SLS,R2   2                 R2= BA OF OUTPUT BUFFER                     
*   NOW SCAN JOB CARD FOR PARAMETERS                                            
         AI,R1    5                 R1= BYTE POINTER TO NEXT CHAR IN  INBUF     
         AI,R2    6                 R2= BYTE POINTER TO NXT CHAR IM MSG BUF     
         BAL,R5   JSCAN             DO THE DEFAULTS, SCAN, DTC.                 
         B        JOBSCANE          ERROR IN JOB CARD                           
         PULL     2,R5              CLEANUP STACK                               
         SLS,R6   2                 R6= BYTE ADDRESS OF BUFFER                  
         SW,R2    R6                R2= # OF BYTES IN MESSAGE                   
         STB,R2   0,R6              SAVE IN BYTE 0 OF MESSAGE BUFFER            
JOBNX    B        1,R5              NORMAL EXIT (+2)                            
*                                                                               
JOBSCANE RES      0                                                             
         PULL     2,R5                                                          
JOBEX    B        0,R5              ERROR EXIT (+1)                             
         TITLE    '** JOB1 - JSCAN SUBROUTINE **'                               
*************                                                                   
*   JSCAN   *                                                                   
*************                                                                   
*                                                                               
*   SUBROUTINE VALIDATES JOB CARD, SUPPLIES DEFAULTS AND REMOVES                
*   LEADING BLANKS .                                                            
*                                                                               
*   AT ENTRY:     R5   LINK                                                     
*                 R1   BYTE POINTER TO CHARACTER FOLLOWING JOB                  
*                      IN INPUT BUFFER.                                         
*                 R2   BYTE POINTER TO CHARACTER FOLLOWING JOB                  
*                     IN OUTPUT BUFFER.                                         
*                                                                               
*   AT EXIT:      R2   POINTS TO NEXT BYTE TO STORE IN OUTPUT BUFFER            
*                 R14  PRIORITY OF JOB                                          
*                                                                               
JSCAN    RES      0                                                             
         LI,R12   75                MAX NUMBER OF BLANKS THAT MAY REMAIN        
         LI,R13   ' '               GET BLANK FOR COMPARE                       
JSCAN10  RES      0                 SCAN-OFF BLANKS IN INPUT BUFFER             
         CB,R13   0,R1              IS THIS CHAR A BLANK                        
         BNE      JSCAN20           NO, BRANCH                                  
         AI,R1    1                 BUMP INDEX                                  
         BDR,R12  JSCAN10                                                       
         B        JSCAN35           NO OPTIONAL PARAMETERS                      
JSCAN20  RES      0                                                             
         LI,R13   '.'                                                           
         CB,R13   0,R1              IS IT A PERIOD                              
         BE       JSCAN35           YES, END OF CARD (NO PARAMS)                
         LI,R12   8                 R12= MAX # OF BYTES IN THIS FIELD           
         BAL,R8   SCANM             SCAN AND MOVE ACCOUNT NUMBER                
         CI,R6    1                 WAS A COMMA READ                            
         BNE      JSCANE            NO, ERROR IN JOB CARD                       
         LI,R12   12                R12= MAX # OF CHARACTERS                    
         BAL,R8   SCANM             SCAN AND MOVE NAME FIELD                    
         CI,R6    2                 END OF CARD                                 
         BNE      JSCAN30            NO, GET PRIORITY                           
         LI,R0    '1'               STORE DEFAULT PRIORITY IN MSG BUFFER        
         STB,R0   0,R2                                                          
         AI,R2    -1                MOVE OUTPUT POINTER BACK                    
         LI,R0    ','                                                           
         STB,R0   0,R2                                                          
         AI,R2    2                 NEXT CHAR TO STORE                          
         LI,R14   PRIDFLT           DEFAULT PRIORITY                            
         B        JSCAN50                                                       
*                                                                               
JSCAN30  RES      0                                                             
         CI,R6    1                 IS IT END OF FIELD                          
         BNE      JSCANE            NO, FORMAT ERROR                            
         LI,R12   1                 SCAN AND MOVE PRIORITY FIELD                
         BAL,R8   SCANM                                                         
         CI,R6    2                 IS IT END OF CARD                           
         BNE      JSCANE            NO, ERROR                                   
         AI,R2    -2                MOVE POINTER BACK                           
         LB,R14   0,R2              GET EBCDIC PRIORITY                         
         AI,R2    1                 POINTEER TO JOB# IN MESSAGE BUFFER          
*   VERIFY THAT PRIORITY IS IN THE RANGE FROM 0 TO 7.                           
         AI,R14   -X'F0'                                                        
         BLZ      JSCANE            ERROR IN PRIORITY                           
         CI,R14   7                                                             
         BG       JSCANE            ERROR, PRIORITY TOO BIG                     
         B        JSCAN50           DONE, EXIT                                  
*   HERE THERE ARE NO OPTIONAL PARAMETERS ON JOB CARD.                          
JSCAN35  RES      0                                                             
         LI,R1    1                 SET BYTE POINTER PAST COUNT                 
         LB,R12   DFLTP             R12= # OF CHAR IN DEFAULT PARAMS            
JSCAN40  RES      0                                                             
         LB,R13   DFLTP,R1          GET 1ST CHAR                                
         STB,R13  0,R2              STORE IN OUTPUT BUFFER                      
         AI,R1    1                 ADVANCE POINTERS                            
         AI,R2    1                                                             
         BDR,R12  JSCAN40                                                       
         LI,R14   PRIDFLT           R14= DEFAULT PRIORITY                       
*                                                                               
*   HERE THE JOB CARD HAS BEEN VALIDATED AND DEFAULTS SUPPLIED WHERE            
*   NECESSARY                                                                   
*   REGISTERS ARE:                                                              
*        R2       ADDRESS OF NEXT BYTE TO STORE IN OUTPUT BUFFER                
*        R3       FPT ADDRESS                                                   
*        R7       TSPACE POINTER (BATCH CALL ONLY)                              
*        R14      JOB PRIORITY                                                  
*                                                                               
JSCAN50  RES      0                                                             
JOBSCX   B        1,R5              RETURN NORMALLY                             
*                                                                               
JSCANE   RES      0                                                             
JOBSCXE  B        0,R5              RETURN ABNORMALLY                           
         TITLE    '** JOB1 - SCANM SUBROUTINE **'                               
***********                                                                     
*  SCANM  *                                                                     
***********                                                                     
*                                                                               
*   SUBROUTINE TO SCAN AND MOVE AN EBCDIC STRING.                               
*                                                                               
*   AT ENTRY:     R1    FROM POINTER (WORD)                                     
*                 R2    TO POINTER (WORD)                                       
*                 R8    LINK                                                    
*                 R12   MAXIMUM NUMBER OF CHARACTERS TO MOVE                    
*                                                                               
*   AT EXIT:      R6    -1 IF ERROR                                             
*                        1 IF COMMA (END OF FIELD)                              
*                        2 IF BLANK (END OF CARD)                               
*                                                                               
SCANM    RES      0                                                             
         LW,R6    R12               SAVE ORIGINAL COUNT                         
SCANM10  LB,R0    0,R1              GET BYTE                                    
         STB,R0   0,R2              STORE BYTE                                  
         AI,R1    1                 BUMP BYTE POINTERS                          
         AI,R2    1                                                             
         CI,R0    ' '               IS IT A BLANK                               
         BE       %+3               YES, SET FLAG AND RETURN                    
         CI,R0    '.'               IS IT A PERIOD                              
         BNE      %+3               NO, BRANCH                                  
         LI,R6    2                 YES, SET FLAG                               
         B        *R8               RETURN                                      
*                                                                               
         CI,R0    ','               IS IT A COMMA                               
         BNE      SCANM20           NO                                          
         CW,R6    R12               COUNT SAME AS AT ENTRY                      
         BNE      %+3               NO, SET END OF FIELD INDICATOR              
         LI,R6    -1                YES, ERROR                                  
         B        *R8                                                           
         LI,R6    1                                                             
         B        *R8                                                           
SCANM20  RES      0                                                             
         AI,R12   -1                DECREMENT COUNT                             
         BGEZ     SCANM10           B IF NOT DONE                               
         LI,R6    -1                ERROR, TOO MANY CHARACTERS                  
         B        *R8                                                           
         TITLE    '** JOB1 - JOBRELT SUBROUTINE **'                             
*************                                                                   
*  JOBRELT  *                                                                   
*************                                                                   
*                                                                               
*  SUBROUTINE TO RELEASE AND DECHAIN TSPACE                                     
*                                                                               
*   AT ENTRY:     R7   TSPACE POINTER                                           
*                 R8   LINK                                                     
*                                                                               
*   ROUTINE USES R0,R5,R6,R9-R11                                                
JOBRELT  RES      0                                                             
         LI,R5    64                                                            
         STB,R5   R7                RESTORE LENGTH TO PTR                       
         LB,R5    TCBPOINT                                                      
         AI,R5    STISPCE           R5= POINTER TO CHAIN HEAD                   
         DISABLE                                                                
         LW,R6    *R5               GET POINTER                                 
JOBRELT1 RES      0                                                             
         BEZ      JOBRELT3          NONE, RETURN                                
         CW,R6    R7                IS THIS THE ONE WE WANT                     
         BNE      JOBRELT2          NO                                          
         LW,R6    *R6               YES, GET NEXT IN CHAIN                      
         STW,R6   *R5               FIX LINK                                    
JOBRELT3 RES      0                                                             
         ENABLE                                                                 
         PUSH     R8                                                            
         BAL,R8   RELTEMP           RELEASE THE TSPACE                          
         PULL     R8                                                            
         B        *R8                                                           
*                                                                               
JOBRELT2 RES      0                                                             
         STW,R6   R5                SAVE FWD LINK                               
         LW,R6    *R6               GET NEXT POINTER                            
         B        JOBRELT1                                                      
         TITLE    '** JOB1 - M:JOB FPTS DCBS ETC **'                            
*                                                                               
* FPT TO WRITE TO BATCH FILE                                                    
*                                                                               
JOBWRIT  RES      0                 FPT TO WRITE TO BATCH FILE                  
         DATA     X'91000006'       DCB PTR IS IN R6                            
         DATA     X'C0000010'       ERR, ABN, WAIT                              
         DATA     JOBERR6,JOBERR6   ERR, ABN                                    
*                                                                               
* FPT TO READ USERS BATCH FILE                                                  
*                                                                               
JOBREAD  RES      0                 FPT TO READ USER'S BATCH FILE               
         DATA     X'90000006'       DCB INDIRECT THRU R6                        
         DATA     X'C0000010'                                                   
         DATA     JOBERR6,JOBERR6   ERR,ABN                                     
*                                                                               
* FPT TO OPEN AND READ USERS BATCH FILE                                         
*                                                                               
JOBDCB   RES      0                 DCB TO OPEN AND READ USER BATCH FILE        
         DATA     X'0B000000'                                                   
         DATA     X'03000000'                                                   
         DATA     0                                                             
         GEN,15,17  120,JOBERR6     BYTE COUNT, ERROR ADDR                      
         DATA     JOBERR6           ABN ADDR                                    
*                                                                               
* FPT TO CLOSE DCB POINTED TO BY R6                                             
*                                                                               
JOBCLOSE RES      0                                                             
         DATA     X'95000006'                                                   
         DATA     0                                                             
         PAGE                                                                   
*                                                                               
* FPT TO ALLOT A FILE                                                           
*                                                                               
JOBALLOT RES      0                 FPT TO ALLOT A FILE                         
         GEN,8,1,23  X'5A',1,0                                                  
         DATA     P1+P2+P3+P4+P5+F1     ERROR, ORG, FILENAME, FSI               
         DATA     JOBERR5           ERROR ADDRESS                               
         DATA     2                 COMPRESSED FORMAT                           
*                                                                               
* ASSIGN FPT                                                                    
*                                                                               
JOBASN   DATA     X'88800006'       DCB PTR IS IN R6                            
         DATA     P1+P4+P14         FILE NAME AND ACCOUNT NAME PTRS             
         DATA     JOBERR6                                                       
*                                                                               
* FPT TO GET ASSIGNMENT                                                         
*                                                                               
JOBGASN  RES      0                                                             
         DATA     X'89800006'       DCB PTR IS IN R6                            
         DATA     P1+P4+P14         AREA/FILENAME AND ACCOUNT NAME              
         DATA     JOBERR6                                                       
         DATA     TSAREA                                                        
         DATA     TSACCNT                                                       
         PAGE                                                                   
*                                                                               
*                                                                               
*   CONSTANTS                                                                   
*                                                                               
JOBREC   TEXT     '!EXU    '                                                    
*                                                                               
JOBDOTS  DATA,1   '.',0,0,'.'       LEFT AND RIGHT DOTS                         
*                                                                               
RECSZ    EQU      28                SIZE OF !EXU COMMAND                        
*                                                                               
         OLAYEND                                                                
         FIN      #SYMB                                                         
         END                                                                    
