help in DSJOB command

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

Moderators: chulett, rschirm, roy

pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

help in DSJOB command

Post 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
pandeeswaran
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post 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
pandeeswaran
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

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

Post 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?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post 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
pandeeswaran
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post 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
pandeeswaran
MarkB
Premium Member
Premium Member
Posts: 95
Joined: Fri Oct 27, 2006 9:13 am

Post 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.
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post 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
pandeeswaran
MarkB
Premium Member
Premium Member
Posts: 95
Joined: Fri Oct 27, 2006 9:13 am

Post 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.
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post 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
pandeeswaran
MarkB
Premium Member
Premium Member
Posts: 95
Joined: Fri Oct 27, 2006 9:13 am

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

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

"You can never have too many knives" -- Logan Nine Fingers
MarkB
Premium Member
Premium Member
Posts: 95
Joined: Fri Oct 27, 2006 9:13 am

Post by MarkB »

Forgot about the -wait duh - not enough coffee yet ... though my Kornshell remarks stay the same ... 8)
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

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

Post by chulett »

Repost your script. You have a problem at line 11.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply