Page 1 of 1

Extracting info from the consol

Posted: Thu Apr 12, 2007 11:27 am
by videsh77
Hi

If I run the command below in Unix

./bin/dsjob -lparams <projname> <dsjobname> > Somefile.txt

Parameters gets copied to the Somefile.txt but status of the command shown separately on the consol.

For unsuccessful command I get following output :
Status code = 0
ERROR: Failed to open job

For successful command as well we get
Status code = 0

So I would like to capture ERROR in my script so as to find out which job could not provide params
it has.

If the output of the command above if I assign it to the variable in a script, these details are
not retained in that variable. Can someone guide me how to capture this ERROR so I can mention some
xyz job is unable to provide parameters?

Posted: Thu Apr 12, 2007 3:22 pm
by ray.wurlod
Status is reported through stderr (it is documented thus).

Redirect file unit 2 to an appropriate file (or even to the same file).

Code: Select all

$DSHOME/bin/dsjob -lparams $project $jobname > Somefile.txt 2>Error.txt

$DSHOME/bin/dsjob -lparams $project $jobname > Somefile.txt 2>&1

Posted: Mon Apr 16, 2007 5:11 pm
by videsh77
Thanks Ray, it worked as expected.