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.
- Log into Data Services Management Console.
- On the left panel, click Administrator > Batch.
- Select repository name.
- Click ‘Batch Job Configuration’ tab.
- Click ‘Export Execution Command’ for the job in question.
- Optional: Uncheck the ‘Use password file’ option. (Then no password file will be created, the password will be encrypted into the bat file.)
- Click Export.
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.
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.