Page 1 of 1

Suppress "Status Code=0" output of dsjob command

Posted: Mon Dec 10, 2007 3:36 pm
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

Posted: Mon Dec 10, 2007 8:48 pm
by rleishman
try

Code: Select all

dsjob ..... >/dev/null 2>&1

Posted: Tue Dec 11, 2007 2:02 am
by ray.wurlod
That throws too much away! Try

Code: Select all

dsjob ... | grep -v 'Status code = 0'

Posted: Mon May 05, 2008 7:18 pm
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.

Posted: Mon May 05, 2008 7:32 pm
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.

Posted: Mon May 05, 2008 7:50 pm
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..

Posted: Mon May 05, 2008 10:01 pm
by ray.wurlod
Of course it's working! And being discarded to /dev/null, which is what you specified. That part is working also.

Posted: Mon May 05, 2008 10:08 pm
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!

Posted: Tue May 06, 2008 7:12 am
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

Posted: Tue May 06, 2008 7:13 am
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

Posted: Tue May 06, 2008 7:55 am
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.

Posted: Tue May 06, 2008 8:33 am
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"

Posted: Tue May 06, 2008 4:13 pm
by ray.wurlod
Where does StageCnt get assigned its value?

The redirection operator ( > /dev/null) discards the output of the preceding pipeline, surely?

Posted: Tue May 06, 2008 4:57 pm
by chulett
Again, you've neither explained what you are trying to accomplish nor what isn't working for you. :?