Page 1 of 2

help in DSJOB command

Posted: Thu May 19, 2011 4:13 am
by pandeesh
HI,

i am trying to run a job uing dsjob command.
but it throws failed to open project.

ihave executed ,

eadm@bbmkscrtst02::/opt/app/dstage/DataStage752/Ascential/DataStage/DSEngine/bin>dsjob -server bbmkscrtst02 -user eadm -password pass-word -run padev rowcount

ERROR: Failed to open project

Status code = 81016

Where padev is my project name and rowcount is the job i want to run.

while exeutibng the hostname command i am getting bbmkscrtst02.

In some other posts, they mentioned about signon file.

where (in which path) i can find that signon file?

I have tried ../dsenv and exexuted the dsjob command.

but i have got the same error again.

Whats the mistake in that command i have executed?

Where i can check the list of the projects which reside under bbmkscrtst02?

is there any directory in $DSHOME to check teh names of the projects?

thanks

Posted: Thu May 19, 2011 5:04 am
by pandeesh
Dsjob is working now;

i have given the project name in smallletters. because of that it throwed error.

now i want to know where the signon file is located?

And where to find the list of projects in the server?

thanks

Posted: Thu May 19, 2011 5:27 am
by pandeesh
hi i want to run a below logic in a script using dsjob command.

i have a job which has to run 100 times regartdless of the return code of the run.

the second run has to start afer the first one is over.

I have tried with the below script

Code: Select all

i=0

While [ i -le 100 ]

do

  dsjob command----

  if [ $? -eq 0 ]
  then

  i = `expr $i + 1 `

  fi

done
but i am getting the error;

Status code = -10 DSJE_JOBLOCKED
ERROR: Failed to lock job

Status code = -10 DSJE_JOBLOCKED
ERROR: Failed to lock job


May i know whats wrong in the script?

can anyone help me?

thanks

Posted: Thu May 19, 2011 4:40 pm
by ray.wurlod
There's nothing wrong in the script except that you don't wait for the job to finish before attempting to restart it (there's no evidence that you're using $i as an invocation ID). It is not possible to run a job that is already running.

So, what are you trying to accomplish here?

Posted: Thu May 19, 2011 9:32 pm
by pandeesh
i want to wait for the job until it finishes its run.

After that i want to start the next run.

How to achieve this?

Thanks

Posted: Fri May 20, 2011 5:07 am
by pandeesh
Hi,

And one more doubt is , i am triggering a sequence using dsjob command
the sequence aborts after some 4 th job in the sequence.

Again if i run the dsjob comand it throws DSJE_BADSTATE Error STATUS CODE=-2.

My requirement is ,while running the dsjob comand again it should start from the 4 th job and not from the beginnig of the sequence,

Provided checkpoint is enabled in the sequence.

How to achieve this ?

thanks

Posted: Fri May 20, 2011 5:23 am
by MarkB
If you are using KornShell, you can wait for the job to finish by using the wait command.

Code: Select all

dsjob blah blah &
wait
For a sequence, set the sequence as adding checkpoints to be restartable, and in your Job Activity set the Execution Action to Reset if Required, Then Run.

Posted: Fri May 20, 2011 5:33 am
by pandeesh
Hi,

i have tried the below script:

i=0

While [ i -le 100 ]

do

dsjob command----
Wait
if [ $? -eq 0 ]
then

i = `expr $i + 1 `

fi

done

Now i am getting:

Status code = 0
./rowcount.sh[13]: i: not found
Error running job


Status code = -2 DSJE_BADSTATE
./rowcount.sh[13]: i: not found
Error running job

Status code = -2 DSJE_BADSTATE
./rowcount.sh[13]: i: not found
Error running job

Status code = -2 DSJE_BADSTATE
./rowcount.sh[13]: i: not found

Status code = 0
./rowcount.sh[13]: i: not found
Error running job

Status code = -2 DSJE_BADSTATE
./rowcount.sh[13]: i: not found
Error running job

Status code = -2 DSJE_BADSTATE
./rowcount.sh[13]: i: not found
Error running job


2) i have changed the script like below:

i=0

While [ i -le 100 ]

do

dsjob command----
wait
i = `expr $i + 1 `


done
Status code = 0
./rowcount.sh[11]: i: not found

rror running job

Status code = -2 DSJE_BADSTATE
./rowcount.sh[11]: i: not found
Error running job

Status code = -2 DSJE_BADSTATE
./rowcount.sh[11]: i: not found
Error running job

Status code = -2 DSJE_BADSTATE
./rowcount.sh[11]: i: not found

Status code = 0
./rowcount.sh[11]: i: not found


we dont know how long the job take to finish?

So how we can check whether the job is finished or running?

thanks

Posted: Fri May 20, 2011 5:41 am
by MarkB
Look at my post ... after the dsjob command you need an ampersand (i.e. &) to put the job into the background ... then the wait command should work.

Posted: Fri May 20, 2011 5:51 am
by pandeesh
hi,

i am still getting the same error..

My script is like this:

#!/bin/ksh
i=0

while [ $i -le 100 ]
do

dsjob -server bbmkscrtst02:31539 -user etladm -password dev-1234 -run ODSDEV rowcount &
wait


i = `expr $i + 1`

done



Status code = 0
rowcount.ksh: i: not found
Error running job

Status code = -2 DSJE_BADSTATE
rowcount.ksh: i: not found
Error running job

Status code = -2 DSJE_BADSTATE
rowcount.ksh: i: not found
Error running job

Status code = -2 DSJE_BADSTATE
rowcount.ksh: i: not found

Status code = 0
rowcount.ksh: i: not found
Error running job

Status code = -2 DSJE_BADSTATE
rowcount.ksh: i: not found
Error running job

Status code = -2 DSJE_BADSTATE
rowcount.ksh: i: not found
Error running job

Status code = -2 DSJE_BADSTATE
rowcount.ksh: i: not found

Posted: Fri May 20, 2011 6:24 am
by MarkB
Maybe you should check your Kornshell reference for proper syntax ... this is a DataStage forum, not a Kornshell forum :roll:

Have you tried something like (not tested) ....

#!/bin/ksh
typeset -i i=0
while [[ $i <= 100 ]]; do
dsjob command &
wait
insert error checking routine here
((i+=1))
done

Posted: Fri May 20, 2011 6:25 am
by chulett
Do not run the jobs in the background or use the O/S wait. Do add the "-wait" option to the dsjob command.

Why not use a Sequence job with the Start/End Loop stages?

Posted: Fri May 20, 2011 7:02 am
by MarkB
Forgot about the -wait duh - not enough coffee yet ... though my Kornshell remarks stay the same ... 8)

Posted: Fri May 20, 2011 7:24 am
by pandeesh
i want to find the alternative for start/end loop stages via script.

After adding -wait option also, i am getting the same error:


Status code = 0
./rowcount.ksh[11]: i: not found
Error running job

Status code = -2 DSJE_BADSTATE
./rowcount.ksh[11]: i: not found
Error running job

Status code = -2 DSJE_BADSTATE
./rowcount.ksh[11]: i: not found
Error running job

Status code = -2 DSJE_BADSTATE
./rowcount.ksh[11]: i: not found

Status code = 0
./rowcount.ksh[11]: i: not found
Error running job

Status code = -2 DSJE_BADSTATE
./rowcount.ksh[11]: i: not found
Error running job

Status code = -2 DSJE_BADSTATE
./rowcount.ksh[11]: i: not found
Error running job

Status code = -2 DSJE_BADSTATE
./rowcount.ksh[11]: i: not found

Status code = 0
./rowcount.ksh[11]: i: not found
^Z[1] + Stopped (SIGTSTP) ./rowcount.ksh
etladm@bbmkscrtst02::/work/cr

Posted: Fri May 20, 2011 7:36 am
by chulett
Repost your script. You have a problem at line 11.