Creating a task

This topic describes how to create a task to be scheduled with the Db2 administrative task scheduler.

Procedure

  1. On the Db2 Admin Task Scheduler panel, enter C in the Cmd area and press Enter.
    The Create Db2 Admin Task panel is displayed, as shown in the following figure:
    Figure 1. Create Db2 Admin Task panel
     AUTOXPRT V1R1 ---------- Create Db2 Admin Task  --------- 2023/10/21  21:06:17 
     Option   ===>                                                 Scroll ===> CSR  
                                                                                    
     Task Name  . . . .                                                           > 
     Task Description                                                             > 
                                                                                    
     Begin Timestamp  . . 2023-09-04-00.22.41.000000 (Db2 Timestamp)                
     End Timestamp  . . . 2023-09-07-00.39.41.000000 (Db2 Timestamp)                
     Max Invocations  . . 2          (Integer, Blank)                               
     SSID . . . . . . . .            (Blank for any datasharing member)             
                                                                                    
     Invocation Options:                                                            
       Interval (minutes) 1          (Integer, Blank)                               
               -Or-                                                                 
       Trigger:                                                                     
         Task Name . . .                                                          > 
         Cond  . . . . .             (GT,GE,EQ,LT,LE,NE)                            
         Code  . . . . .             (Integer, Blank)                               
               -Or-                                                                 
       Point in Time . .                                                          > 
                                                                                    
     Execution Source:                                                              
       JCL Dataset . . .                                                            
       JCL Member  . . .             (If Partitioned Dataset)                       
       Job Wait  . . . . P           (Y - Yes, N - No, P - Purge)                   
               -Or-                                                                 
       Procedure Schema                                                           > 
       Procedure Name                                                             > 
       Procedure Input                                                            > 
                                                                                    
                                                                                    
                                                                                    
  2. Complete the fields as follows:
    Task Name
    (Required) Enter a unique task name to differentiate this from other Db2 administrative task scheduler tasks. The following variables are allowed to ensure unique task names when multiple jobs are created:
    • &SEQ resolves to a sequential number that is incremented when referenced.
    • &TIMESTAMP resolves to the Db2 timestamp returned from the CURRENT TIMESTAMP when the job is added to the Db2 administrative task scheduler.
    Task Description
    Enter a description for the task.
    Begin Timestamp
    If you want the task to execute at a specific starting time, enter it in the format CCYY-MM-DD-HH.MM.SS.thmiju. If not specified, the task may be executed immediately. The variable &CURRENT can be specified to use the current timestamp when the job is added to the Db2 administrative task scheduler. &CURRENT can be combined with any valid Db2 timestamp expression to specify a future time. For example:
    &CURRENT + 5 DAYS 
    &CURRENT + YEAR
    End Timestamp
    If you want the task to end at a specific time, enter it in the format CCYY-MM-DD-HH.MM.SS.thmiju. If not specified, the task may be executed as scheduled indefinitely. The variable &CURRENT can be specified to use the current timestamp when the job is added to the Db2 administrative task scheduler. &CURRENT can be combined with any valid Db2 timestamp expression to specify a future time. For example:
    &CURRENT + 5 DAYS
    &CURRENT + YEAR
    Max Invocations
    Enter the maximum number of times this task can be executed. If not specified, there is no limit to the number of executions.
    SSID
    Enter a particular subsystem that should execute the task. If not specified, the task may execute on any member of a data sharing group.
    Invocation Options
    Select one of the following invocation options.
    Interval (minutes)
    Specify the time in minutes to execute a repeating task.
    Trigger
    These fields allow you to define the parameters that cause the task to be triggered.
    Task Name
    Specify another Db2 administrative task scheduler task that, when complete, triggers the execution of this task.
    Cond
    Specify the type of comparison to be made on the condition code of the triggered task. If not specified, the task is triggered upon completion of the trigger task without regard to its condition code.
    Code
    Specify the condition code to compare to determine if task gets triggered.
    Point in Time
    Specify a point-in-time string in UNIX cron format that indicates one or more specific times to begin task execution. The format is:
    minute hour day_of_the_month month_of_the_year day_of_the_week
    where:
    • minute can be 0-59
    • hour can be 0-23
    • day_of_the_month can be 1-31
    • month_of_the_year can be 1-12 or upper-, lower-, or mixed-case three-character strings, based on the English name of the month: jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, or dec
    • day_of_the_week can be 1-7 or upper-, lower-, or mixed-case three-character strings, based on the English name of the day: mon, tue, wed, thu, fri, sat, or sun
    Each field must be separated by a blank. For more information on the UNIX CRON format for the Db2 administrative task scheduler, refer to the Db2 Administration Guide for your version of Db2.
    Execution Source
    These fields allow you to specify the location of the task execution JCL or stored procedure.
    JCL Dataset
    JCL Member
    Enter the fully qualified data set and member name containing the execution JCL.
    Job Wait
    Indicate whether the job can be executed synchronously. Valid values are:
    • Y: Synchronous execution
    • N: Asynchronous execution
    • P: Synchronous execution, after which the job status in z/OS® is purged.
    Procedure schema
    Procedure name
    Enter the stored procedure name and schema (qualifier or creator name).
    Procedure Input
    Enter the input parameters for the Db2 stored procedure. This parameter must be specified as a Db2 SELECT statement.
  3. When you have completed the required fields, press Enter, then PF3.
    The Db2 Admin Task Scheduler panel is displayed. The task you created is listed on this panel.

What to do next

You can check the status of the task, delete the scheduled task, or view the scheduled task settings.