cancel
Showing results for 
Search instead for 
Did you mean: 

Executing a job by another job using exec command

Former Member
0 Kudos

Hi All,

I have  a requirement as follows,I am triggerring the jobs from one parent job,where triggered jobs should run in  parallel.Below code waits for Job_Test_1 to complete and then triggers the Job_Test_2.But what I want is Job_Test_2 also should start when Job_Test_1 is running.How to achive this in SAP BODS.

[$G_JOB_NAME]=Job_Test_1;
print('The job is [$G_JOB_NAME] ');
exec('D:\Installation_folder\Data Services\log\[$G_JOB_NAME].bat','',1);
print('Failed job [$G_JOB_NAME] triggered');

[$G_JOB_NAME]=Job_Test_2;
print('Second job triggered ');
exec('D:\Installation_folder\Data Services\log\[$G_JOB_NAME].bat','',1);
print('The job second job triggered');

Thanks for your help in advance.

Indira

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Indra,

Request you to go through the below link in which anoop has beautifully explained the various ways to schedule the jobs.

http://scn.sap.com/docs/DOC-34648

In particular, I would request you to go through "Scheduling using  Web service" Part. In this part, Anoop has shown how to publish the jobs and in the subsequent steps showed us how to call the webservice in the Query transform.

In his example he took two query transforms to execute the job sequentially.

If you wann to execute the jobs parallel then just check by calling both the webservices in a single query transform.

Former Member
0 Kudos

Thanks Naveen. But that solution wont help me.Is there any other solution?

former_member200473
Contributor
0 Kudos

Hi Indira ,

If your requirement is that you need JOB_TEST2 should also be executed while JOB_TEST1 is executing, then call JOB_TEST2 in JOB_TEST1 using script with the help of EXEC() function.

In this when you will call JOB_TEST1, it will internally call JOB_TEST2 also.

Hope this helps you

Regards,

Shiva Sahu

Former Member
0 Kudos

Thanks Shiva.But it does not fulfill my requirement.

I have table where i capture failed jobs and only those jobs i need to trgger.

Your solution works if i know the job names so that I can call the next job.

Any urgent help is aprreciated.

Thanks,

Indira

former_member200473
Contributor
0 Kudos

Hi Indira,

I think this is also possible.( i may not be looking very deep).

If you are storing status for jobs in table then you can get the name from table pass them in global variable and use it.

create some global variable and assign the value dynamically for job name using script and on that basis you can call same ".bat" file in exec() function and use it.

Please update if this works.

Regards,

Shiva Sahu

Former Member
0 Kudos

the first job which got triggered wont come out until it finishes.

I have stored the names in table and then passing them one by one in global variable in while loop.loop comes out once the job is completed.