
Scenario:
Let consider the scenario where your Transaction Jobs are dependent on your Master Jobs and you have to schedule your transaction jobs such that without completion of master it won’t get executed.Scenario is based on daily execution of both job.
To achieve this follow the below steps –
1) Batch File Export: Take export of batch file for your transaction jobs.
How:
2) Global Variable Declaration: Open your transaction job and add create following global variable.
$STATUS_JOB_DIM datatype as varchar(1)
$JOB_STATUS datatype as varchar(1)
3) Job Modification: Add one script and conditional as follow.
4) Job Status Script: In script use the following command
$STATUS_JOB_DIM = sql('DS_SQL_ANYWHERE','select status from abc.al_history where service = \'JOB_DIM\' and END_TIME in (select max(END_TIME) from abc.al_history where service = \'JOB_DIM\') and convert(varchar(8),start_time)=convert(varchar(8),getdate())');
### use repo name in place of abc.
print($STATUS_JOB_DIM);
if($STATUS_JOB_DIM='D')
begin
$JOB_STATUS='D';
end
else
begin
$JOB_STATUS='E';
end
5) Conditional: Put your Transaction workflow in ELSE clause of conditional and put a Script in THEN clause.
IF Condition: ($JOB_STATUS = 'E' or $JOB_STATUS is NULL)
6) Conditional Script: Within script put the following command:
print('Master tables are not populated yet, Cannot Initiate'||$G_JOB_NAME );
#### create a global variable $G_JOB_NAME or Hard code your job name ###
sleep('600000'); ### A pause of 10 min ###
print(exec( 'Your batch file path,'',8)); ### Provide your exported batch file location ###
7) Job Scheduling: Now go to DS management console and schedule your transaction job. At time of execution it will first check the Master Job status if Master Job not completed yet then job will take a pause and re execute itself after 10 min.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
7 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |