Run batch file to call a DS Job to run

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

ylai20
Participant
Posts: 15
Joined: Tue Jun 08, 2010 10:12 pm

Run batch file to call a DS Job to run

Post 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.
Last edited by ylai20 on Mon Nov 08, 2010 3:28 am, edited 1 time in total.
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post by Sreenivasulu »

Welcome board ! Pls refer the manuals.

Regards
Sreeni
ylai20
Participant
Posts: 15
Joined: Tue Jun 08, 2010 10:12 pm

Post 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:
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
ylai20
Participant
Posts: 15
Joined: Tue Jun 08, 2010 10:12 pm

Post 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.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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)
ylai20
Participant
Posts: 15
Joined: Tue Jun 08, 2010 10:12 pm

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ylai20
Participant
Posts: 15
Joined: Tue Jun 08, 2010 10:12 pm

Post 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?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ylai20
Participant
Posts: 15
Joined: Tue Jun 08, 2010 10:12 pm

Post 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?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ylai20
Participant
Posts: 15
Joined: Tue Jun 08, 2010 10:12 pm

Post 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..
ylai20
Participant
Posts: 15
Joined: Tue Jun 08, 2010 10:12 pm

Post 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?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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?
Post Reply