U@CRTSBMJOB

U@CRTSBMJOB creates a job, updates the job parameters, or both; and then it submits the batch job to the Job Scheduler.

To use theU@CRTSBMJOB routine

  1. Populate all of the appropriate fields for the E@JR group.

  2. Populate the working storage parameter fields.

  3. Move the entire parameter working storage to the E@JSPARAMS field.

  4. Perform U@CRTSBMJOB

    The calling program has no method of knowing when the job actually starts or completes.

Module JOBRTNS
Unused Fields (None)
Output The batch job is submitted to the Job Scheduler.

Required Fields

Field Type and length Definition
E@JRCREATE A 1 Y = Deletes an existing job definition before creating a new one.
E@JRMODIFY A 1

Y = Deletes an existing job definition before creating a new one.

Note: If neither E@JRCREATE nor E@JRMODIFY has a value of Y, the routine sets E@JRMODIFY to Y.
E@JRDELQJB A 1 Deletes all Job Scheduler entries for the job except for running jobs. If the job already exists and it is running, then the routine fails and returns Y in the E@JRERROR field.
E@JRNOMODIFEX A 1 Forces the routine not to update the job if it already exists. If the job exists, then the routine returns Y in the E@JRERROR field.
E@JRSTEPS Occurs 20 times Group label for each step occurrence. The following fields are subscripted.
E@JSTOKEN A 10 Case-sensitive form ID to be run in this step.
E@JSPROJECT A 14 Product line, data area, or data ID name for the application form ID. user and environment form IDs have no product line, so in those cases, move spaces to this field.
E@JSPARAMS A 2000 The parameters for this step, strung together in contiguous order. Not all steps have parameters.

Optional Fields

Field Type and length Definition
E@JRJOBREQDESC A 30 Description for the job.
E@JSJOBSTPDESC A 30 Description for the job step.
E@JSDISTGRP A 10 Distribution groups you have defined in Distribution Group Maintenance.
E@JSPRINTER A 10 Appropriate printer
E@JSNBRCOPIES N 2 Number of copies to print if sent directly to a printer. The default is to 1.
E@JSSAVE A 1 Whether or not to save the job definition after it has completed. The default is to Y.
E@JRJOBQUEUE A 5 Job queue you want to submit the job through. (If left blank, the default queue is used.)
E@JRSTARTDATE N 8 Date the job should start. (If left blank, the job starts now.)
E@JRSTARTTIME N 6 Time the job should start. (If left blank, the job starts now.)

Return Value

Field Type and length Definition
E@JRERROR A 1

Y = Call failed.

N = Call successful.

Programming Example for Application Form ID

     IF        F1@FC = 'S'
     EVAL      E@JRUSERNAME   = E@USERNAME             
                                          
     CALLP     U@STR@INIT(%ADDR(E@STR@DS):             
               %ADDR(E@JRJOBNNAME): 1:                 
               %SIZE(E@JRJOBNNAME): 1)                 
     CALLP     U@STR@ITEMDLM(%ADDR(E@STR@DS): 'IC588':     
               1: 5: ' ': 1: 1)                        
                                                   
     CALLP     U@LOADJOB                         Load Job   
     IF        E@JRERROR = 'Y'                       
     EVAL      E@JRCREATE     = 'Y'                     
     EVAL      E@JRISMULTSTEP = 'N' 
     EVAL      E@JRISMULTSTEP = 'N'                    
     EVAL      E@JRNBRSTEPS   = 1                      
     EVAL      E@JSTOKEN(1)   = 'IC588'                
     EVAL      E@JSPROJECT(1) = E@PRODUCTLINE          
     EVAL      E@JSNBRCOPIES(1) = 1                    
     EVAL      E@JSSAVE(1)    = 'Y'                    
     MOVEL(P)  F1@TIME       E@JSPARAMS(1)             
     ELSE                                              
     EVAL      E@JRCREATE     = 'N'                    
     EVAL      E@JRMODIFY     = 'Y'                    
     MOVEL(P)  F1@TIME       E@JSPARAMS(1) 
     ELSE                              
     EVAL      E@JRCREATE     = 'N'                    
     EVAL      E@JRMODIFY     = 'Y'                    
     MOVEL(P)  F1@TIME       E@JSPARAMS(1)              
     ENDIF                                                
     CALLP     U@CRTSBMJOB                Create And Submit Jo
     IF        E@JRERROR <> 'N'                             
     EVAL      E@ERRORNBR     = 911                         
     ENDIF                                                  
     ENDIF