Suppress "Status Code=0" output of dsjob command

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Sudhindra_ps
Participant
Posts: 45
Joined: Thu Aug 31, 2006 3:13 am
Location: Bangalore

Suppress "Status Code=0" output of dsjob command

Post by Sudhindra_ps »

hi,

I have configured shell script which calls "dsjob" command to execute an Datastage job in the "Extrnal Source Stage". But, dsjob command after execution outputs below information.
-------------------------------------------------------------------------
Finished waiting for job
Status code = 0
Status code = 0
-------------------------------------------------------------------------
Now, the above output from External Source stage gets into other succeeding stages in the job as input. Which I don't want. Can anybody tell me whether can we suppress the above output thatz coming from "dsjob" command.
I tried multiple ways to avoid this such as
(1) I have used "/dev/null"
(2) tried to redirect the output to temporary file "/tmp/tempfile.txt"
But even after I tried doing above mechanisms am still unable to suppress the output thrown by "dsjob command".
Can anybody please suggeste me here onto how can I suppress this output message.

Thanks & regards
Sudhindra P S
rleishman
Premium Member
Premium Member
Posts: 252
Joined: Mon Sep 19, 2005 10:28 pm
Location: Melbourne, Australia
Contact:

Post by rleishman »

try

Code: Select all

dsjob ..... >/dev/null 2>&1
Ross Leishman
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That throws too much away! Try

Code: Select all

dsjob ... | grep -v 'Status code = 0'
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

Hi,

I am sorry to reopen this old issue.
Actually, i was trying to suppress this return code (Status code = 0) from my dsjob commands. I got this issue posted few months back and i tried this option posted by ray.wurlod. But, couldn't succeed in eliminating this return code.

Code: Select all

dsjob ... | grep -v 'Status code = 0'
Can anyone let me know how this can be achieved.
Thanks and Regards!!
dspxlearn
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You want to suppress the status code and now you want the status code?

If the dsjob command has the -jobstatus option, then the exit status of dsjob is the exit status of the executed job.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

i don't want to capture the status codes and it doesn't have -jobstatus option in it.
my code was

Code: Select all

dsjob -stageinfo DS_PROJECT DS_JOB$INVOCATION_ID DS_STAGE
I tried to redirect it to device null (>/dev/null) but it isn't working..
Thanks and Regards!!
dspxlearn
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Of course it's working! And being discarded to /dev/null, which is what you specified. That part is working also.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It would help if you showed us the actual syntax you're using and what exactly "isn't working" about it. Details are your friends!
-craig

"You can never have too many knives" -- Logan Nine Fingers
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

Craig,
I was trying with the following syntax-

dsjob -stageinfo DS_PROJECT DS_JOB$INVOCATION_ID DS_STAGE | grep -v 'Status code = 0' | grep "In Row Number" | cut -f2 -d ":" | awk '{print $1}'` > /dev/null
Thanks and Regards!!
dspxlearn
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

Craig,
I was trying with the following syntax-

dsjob -stageinfo DS_PROJECT DS_JOB$INVOCATION_ID DS_STAGE | grep -v 'Status code = 0' | grep "In Row Number" | cut -f2 -d ":" | awk '{print $1}'` > /dev/null
Thanks and Regards!!
dspxlearn
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

And? What about this is your issue or the part the "isn't working"? It would help if *you* explained what you were trying to accomplish with this rather than us trying to figure it out and make assumptions based on our look at it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

Ok, now here is my code:

Code: Select all

$DSTAGE_EXE/dsjob -lstages $DS_PROJECT $DS_JOB$INVOCATION_ID | grep 'Src_' > $File
SrcCnt=0
TotalCnt=0

for LINE in `cat ${File}`
do
	SrcCnt=`$DSTAGE_EXE/dsjob -stageinfo $DS_PROJECT $DS_JOB$INVOCATION_ID $LINE | grep -v 'Status code = 0' | grep "In Row Number" | cut -f2 -d ":" | awk '{print $1}'` > /dev/null
	TotalCnt=`expr $TotalCnt+ $StageCnt`
done

echo "Total count of source records: $TotalCnt"
Thanks and Regards!!
dspxlearn
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Where does StageCnt get assigned its value?

The redirection operator ( > /dev/null) discards the output of the preceding pipeline, surely?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Again, you've neither explained what you are trying to accomplish nor what isn't working for you. :?
-craig

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