Page 1 of 2

Run batch file to call a DS Job to run

Posted: Mon Nov 08, 2010 2:51 am
by ylai20
I want to run a DS job without open the Data Stage program, so i want to create a batch file which will trigger a DS job when i double click on the batch file.

For example, i want to create a batch file called "Call_DSJob", after I double click this file, it will run the DS Job in DS background. The problem is i am not sure how to do it...

Appreciate if you guys can help me up :)

I have found from forum the syntax for batch file is
dsjob -server %vSERVER% -user %vUSER% -password %vPASSWORD% -run %vDS_PROJ_NAME% %vDS_JOB_NAME%

And my DS job details are:
1) Server : BI_Server
2) USer : admin
3) Password : 123
4) DS Proj Name : BI
5) Job Name : BI_DS_JOB
So is my syntax should look like this way?
dsjob -server %BI_Server% -user %admin% -password %123% -run %BI% %BI_DS_JOB%

Thanks.

Posted: Mon Nov 08, 2010 3:04 am
by Sreenivasulu
Welcome board ! Pls refer the manuals.

Regards
Sreeni

Posted: Mon Nov 08, 2010 3:17 am
by ylai20
Sreenivasulu wrote:Welcome board ! Pls refer the manuals.

Regards
Sreeni
Hi thanks for your reply, i have download 2 manuals..admin and director..but couldnt find the info..appreciate if you can let me know which manual i should get? :oops:

Posted: Mon Nov 08, 2010 3:44 am
by ArndW
There is no need to download manuals, the WebSphere DataStage Programmer's Guide that comes with every client installation has a whole Chapter (Chapter 1) describing the command line interface.

Posted: Mon Nov 08, 2010 4:03 am
by ylai20
Ok, got it!
dsjob -run
[ -mode [ NORMAL | RESET | VALIDATE | RESTART ] ]
[ -param name
=
value ]
[ -paramfile filename ]
[ -warn n ]
[ -rows n ]
[ -wait ]
[ -stop ]
[ -jobstatus ]
[ -userstatus ]
[ -local ]
[ -opmetadata [ TRUE | FALSE ] ]
[ -disableprjhandler ]
[ -disablejobhandler ]
[useid] project job | job_id
Is this command put inside the batch file, or need to type and run in command prompt? Sorry for asking so many 'dumb' question..i really have no idea..
Can give me some simple sample...will be very much appreciated.

Posted: Mon Nov 08, 2010 4:31 am
by ArndW
the "dsjob" command is called from the command line - the syntax is identical in UNIX and Windows environments.

In your case the command

Code: Select all

dsjob -server BI_Server -user admin -password 123 -run BI BI_DS_JOB
should start the job (any parameters will get their default values)

Posted: Mon Nov 08, 2010 7:36 pm
by ylai20
But i want to create a batch file to run it when i double click, instead of using command prompt...Actually i will schedule Windows to execute this batch file...so should i copy this code into the batch file? Will it be the same?

And when i try to run it in command prompt, it said dsjob is not recognized..is this the way i should run?
C:\Documents and Settings\user>dsjob
'dsjob' is not recognized as an internal or external command,
operable program or batch file.

Posted: Mon Nov 08, 2010 8:00 pm
by ray.wurlod
Either use the full pathname of the dsjob command or include its parent directory in your command search list (PATH environment variable).

Posted: Mon Nov 08, 2010 8:18 pm
by ylai20
I have copy the code and put in the batch file..

@ECHO ON
dsjob -server BI_Server -user admin -password 123 -run BI/Jobs/Backup/ TEST_NELSON
CLS
EXIT

The save this batch file to C:\IBM\InformationServer\Clients\Classic, where the dsjob.exe is located.
Then i execute it,
C:\IBM\InformationServer\Clients\Classic>dsdsjob -server BI_Server -user admin -password 123 -run BI\Jobs\Backup\EST_NELSON

But the command prompt just prompted out for a while, then it closed, when i check in the director, the job didnt run...am i doing the right way?

Posted: Mon Nov 08, 2010 8:41 pm
by chulett
dsjob uses the project name and job name, do not supply any category information. And without one of the "wait" options it will just start the job and exit back to the command line.

Posted: Mon Nov 08, 2010 9:09 pm
by ylai20
But my job is put under BI > Jobs > Backup
Then how it will know which one to take and run?

If without putting -wait , will it still run?

Posted: Mon Nov 08, 2010 9:20 pm
by chulett
Job names are unique, it knows. Use the syntax others have posted, don't make stuff up. And lastly... yes. Provided you get everything else right, of course.

Posted: Tue Nov 09, 2010 12:26 am
by ylai20
This is my final code in the batch file

Code: Select all

@ECHO ON 
dsjob -server bi_server -user admin -password 123 -run bi
CLS 
EXIT 
After i double click, it 'seems' working but prompt command closed very fast.
When i check the director, this job is not running..

I have put this 2 batch files in server, location is
1) C:\IBM\InformationServer\Clients\Classic
2) C:\IBM\InformationServer\Server\DSEngine\bin

I have tried to run both, no luck..pls help..

Posted: Tue Nov 09, 2010 3:02 am
by ylai20
I just got the solution in viewtopic.php?p=377446.

I need to create a sigon.file in order to run the batch file. May i know is it a neccesary to create this signon.file?

Posted: Tue Nov 09, 2010 3:57 am
by ArndW
I don't understand some of the difficulties here. Can you, from the CMD prompt, execute your batch (without the CLS so you can see the messages) and get your job running?