Synopsis
Creates a job based on an existing job and schedules it to start later.
Description
Creates a job from the specified existing job, if it is in either a holding or waiting state. The new job is scheduled to start later at the specified release time. Typically, this routine is used to create & schedule a job from within another job. Only jobs that are in a holding or waiting state can be used as a template for the new job.
Input
Input | Description |
---|---|
Common Input | Includes all 5 inputs of the Callable Routines Common Input. |
Template Job Name | The name of the job to be used as a template for the new job. The specified name must exactly match the job name as displayed by the WhereScape RED Scheduler. The specified job must be in a holding or waiting state in order to be used as a template. |
New Job Name | The name of the job to be created. The new job name cannot already exist. |
Job Description | A description of the new job. When not specified the setting of the Template job is copied. |
New Job Status | The initial status/frequency of the new job:
|
Scheduled Release Date/Time | The date/time when the new job is scheduled to be run. |
Thread Count | The number of threads for the new job. When not specified, the setting of the Template job is copied. |
Scheduler Preference | A scheduler type or a specific scheduler name that is allowed to run the job. When not specified, the setting of the Template job is copied. Note Some jobs/tasks can only run in a specific environment, such as Windows or UNIX/Linux. |
Maximum Logs to Retain | The maximum number of logs to retain. When not specified, the setting of the Template job is copied. |
Success Command | A command-line action to execute upon successful completion of the new job. When not specified, the setting of the Template job is copied. The command must be executable within the context of the scheduler that runs the job—it must be a valid Windows/UNIX/Linux command that is appropriate to the scheduler environment. |
Failure Command | A command-line action to execute upon failure of the new job. When not specified the setting of the Template job is copied. The command must be executable within the context of the scheduler that runs the job—it must be a valid Windows/UNIX/Linux command that is appropriate to the scheduler environment. |
Output
Output | Description |
---|---|
Return Code | Output Return Code:
|
Return Message | Output message indicating the action applied or the reason for no action. |
Result Number | Output Result Number:
|
SQL Server
SQL Server Parameters: Ws_Job_CreateWait
Callable Routine Type: PROCEDURE.
Parameter Name | Datatype | Mode |
---|---|---|
@p_sequence | INTEGER | IN |
@p_job_name | VARCHAR(64) | IN |
@p_task_name | VARCHAR(64) | IN |
@p_job_id | INTEGER | IN |
@p_task_id | INTEGER | IN |
@p_template_job | VARCHAR(64) | IN |
@p_new_job | VARCHAR(64) | IN |
@p_description | VARCHAR(256) | IN |
@p_state | VARCHAR(64) | IN |
@p_release_time | DATETIME | IN |
@p_threads | INTEGER | IN |
@p_scheduler | VARCHAR(64) | IN |
@p_logs | INTEGER | IN |
@p_okay | VARCHAR(256) | IN |
@p_fail | VARCHAR(256) | IN |
@p_att1 | VARCHAR(64) | IN |
@p_att2 | VARCHAR(64) | IN |
@p_att3 | VARCHAR(64) | IN |
@p_att4 | VARCHAR(64) | IN |
@p_att5 | VARCHAR(64) | IN |
@p_att6 | VARCHAR(64) | IN |
@p_att7 | VARCHAR(64) | IN |
@p_att8 | VARCHAR(64) | IN |
@p_return_code | VARCHAR(1) | OUT |
@p_return_msg | VARCHAR(256) | OUT |
@p_result | INTEGER | OUT |
SQL Server Examples: Ws_Job_CreateWait
– The p_ VARIABLES are normally PARAMETERS in a RED-generated Procedure. DECLARE @p_sequence integer DECLARE @p_job_name varchar(256) DECLARE @p_task_name varchar(256) DECLARE @p_job_id integer DECLARE @p_task_id integer DECLARE @p_return_msg varchar(256) DECLARE @p_status integer DECLARE @v_result_num integer DECLARE @v_return_code varchar(1) DECLARE @v_return_msg varchar(256) DECLARE @v_run_date datetime SET @v_run_date = DATEADD(MONTH, 1, GETDATE()) EXEC Ws_Job_CreateWait @p_sequence, @p_job_name, @p_task_name, @p_job_id, @p_task_id , 'Daily Run', 'New Daily Run2', 'This is the New Daily Run job.', 'ONCE' , @v_run_date , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL , @v_return_code OUTPUT , @v_return_msg OUTPUT , @v_result_num OUTPUT
Teradata
Teradata Parameters: Ws_Job_CreateWait
Callable Routine Type: PROCEDURE.
Parameter Name | Datatype | Mode |
---|---|---|
p_sequence | INTEGER | IN |
p_job_name | VARCHAR(64) | IN |
p_task_name | VARCHAR(64) | IN |
p_job_id | INTEGER | IN |
p_task_id | INTEGER | IN |
p_template_job | VARCHAR(64) | IN |
p_new_job | VARCHAR(64) | IN |
p_description | VARCHAR(256) | IN |
p_state | VARCHAR(10) | IN |
p_release_time | TIMESTAMP | IN |
p_threads | INTEGER | IN |
p_scheduler | VARCHAR(8) | IN |
p_logs | INTEGER | IN |
p_okay | VARCHAR(256) | IN |
p_fail | VARCHAR(256) | IN |
p_att1 | VARCHAR(4000) | IN |
p_att2 | VARCHAR(4000) | IN |
p_att3 | VARCHAR(4000) | IN |
p_att4 | VARCHAR(4000) | IN |
p_att5 | VARCHAR(4000) | IN |
p_att6 | VARCHAR(4000) | IN |
p_att7 | VARCHAR(4000) | IN |
p_att8 | VARCHAR(4000) | IN |
p_return_code | VARCHAR(1) | OUT |
p_return_msg | VARCHAR(256) | OUT |
p_result | INTEGER | OUT |
Teradata Examples: Ws_Job_CreateWait
– The p_ VARIABLES are normally PARAMETERS in a RED-generated Procedure. DECLARE p_sequence integer; DECLARE p_job_name varchar(256); DECLARE p_task_name varchar(256); DECLARE p_job_id integer; DECLARE p_task_id integer; DECLARE p_return_msg varchar(256); DECLARE p_status integer; DECLARE v_result_num integer; DECLARE v_return_code varchar(1); DECLARE v_return_msg varchar(256); CDATA[CALL [METABASE].Ws_Job_CreateWait ( p_sequence, p_job_name, p_task_name, p_job_id, p_task_id , 'Daily Run', 'New Daily Run', 'This is the New Daily Run job.', 'ONCE' , (CURRENT_TIMESTAMP + INTERVAL '1' MONTH) , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL , v_return_code , v_return_msg , v_result_num );
Oracle
Oracle Parameters: Ws_Job_CreateWait
Callable Routine Type: FUNCTION.
Parameter Name | Datatype | Mode |
---|---|---|
p_sequence | NUMBER | IN |
p_job_name | VARCHAR2 | IN |
p_task_name | VARCHAR2 | IN |
p_job_id | NUMBER | IN |
p_task_id | NUMBER | IN |
p_template_job | VARCHAR2 | IN |
p_new_job | VARCHAR2 | IN |
p_description | VARCHAR2 | IN |
p_state | VARCHAR2 | IN |
p_release_time | DATE | IN |
p_threads | NUMBER | IN |
p_scheduler | VARCHAR2 | IN |
p_logs | NUMBER | IN |
p_okay | VARCHAR2 | IN |
p_fail | VARCHAR2 | IN |
p_att1 | VARCHAR2 | IN |
p_att2 | VARCHAR2 | IN |
p_att3 | VARCHAR2 | IN |
p_att4 | VARCHAR2 | IN |
p_att5 | VARCHAR2 | IN |
p_att6 | VARCHAR2 | IN |
p_att7 | VARCHAR2 | IN |
p_att8 | VARCHAR2 | IN |
p_return_code | VARCHAR2 | OUT |
p_return_msg | VARCHAR2 | OUT |
FUNCTION Return Value | NUMBER | OUT-Function |
Oracle Examples: Ws_Job_CreateWait
– The p_ VARIABLES are normally PARAMETERS in a RED-generated Procedure. p_sequence number; p_job_name varchar2(256); p_task_name varchar2(256); p_job_id number; p_task_id number; p_return_msg varchar2(256); p_status number; v_result_num number; v_return_code varchar2(1); v_return_msg varchar2(256); v_result_num := Ws_Job_CreateWait ( p_sequence, p_job_name, p_task_name, p_job_id, p_task_id , 'Daily Run', 'New Daily Run', 'This is the New Daily Run job.', 'ONCE' , ADD_MONTHS(SYSDATE, 1) , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL , v_return_code , v_return_msg );
DB2
DB2 Parameters: Ws_Job_CreateWait
Callable Routine Type: PROCEDURE.
Parameter Name | Datatype | Mode |
---|---|---|
p_sequence | INTEGER | IN |
p_job_name | VARCHAR(64) | IN |
p_task_name | VARCHAR(64) | IN |
p_job_id | INTEGER | IN |
p_task_id | INTEGER | IN |
p_template_job | VARCHAR(64) | IN |
p_new_job | VARCHAR(64) | IN |
p_description | VARCHAR(256) | IN |
p_state | VARCHAR(10) | IN |
p_release_time | TIMESTAMP | IN |
p_threads | INTEGER | IN |
p_scheduler | VARCHAR(8) | IN |
p_logs | INTEGER | IN |
p_okay | VARCHAR(256) | IN |
p_fail | VARCHAR(256) | IN |
p_att1 | VARCHAR(4000) | IN |
p_att2 | VARCHAR(4000) | IN |
p_att3 | VARCHAR(4000) | IN |
p_att4 | VARCHAR(4000) | IN |
p_att5 | VARCHAR(4000) | IN |
p_att6 | VARCHAR(4000) | IN |
p_att7 | VARCHAR(4000) | IN |
p_att8 | VARCHAR(4000) | IN |
p_return_code | VARCHAR(1) | OUT |
p_return_msg | VARCHAR(256) | OUT |
p_result | INTEGER | OUT |
DB2 Examples: Ws_Job_CreateWait
– The p_ VARIABLES are normally PARAMETERS in a RED-generated Procedure. DECLARE p_sequence integer; DECLARE p_job_name varchar(256); DECLARE p_task_name varchar(256); DECLARE p_job_id integer; DECLARE p_task_id integer; DECLARE p_return_msg varchar(256); DECLARE p_status integer; DECLARE v_result_num integer; DECLARE v_return_code varchar(1); DECLARE v_return_msg varchar(256); CALL [METABASE].Ws_Job_CreateWait ( p_sequence, p_job_name, p_task_name, p_job_id, p_task_id , 'Daily Run', 'New Daily Run', 'This is the New Daily Run job.', 'ONCE' , (CURRENT TIMESTAMP + 1 MONTH) , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL , v_return_code , v_return_msg , v_result_num );