If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Triggering Cognos job from Script

Started by anjan, 22 Nov 2012 07:49:57 AM

Previous topic - Next topic

anjan

Hi All,

I am using script which provided by cognos(trigger.sh) to run cognos job, based on the success of this script I want to run another scripts which does another active, But I am not able to track the success or failure on trigger.sh as trigger.sh as script is not giving any error code or exit code if job fails.

Is there any way to trap this.

Thanks

Danno

I am assuming that you are running this on Linux but it should apply to most *nix.

I usually put a variable after the command I execute that hold the value of $?.

Something like RC=$?

Then use an if statement to evaluate the output of $RC. You can also end your script with "exit $?" and get output from the script.

Hopefully this points you in a good direction.


anjan

Hi Danno

I have used this but the variable gives only the sucess of the script, whether it trigred or not, but it does not give the status of cognos job.

The other thing  I noticed is the script give exit code immediately and does not wait for cognos job to finish.


Thanks

Danno

Where are you placing the variable? That would be my question. Unfortunately we don't run shell scripts for Cognos here but I do use them a lot for other things and putting the variable right after the Cognos job in the script should get you a return value.

Here is a simple example of how I would do this:

echo hello
echo $?    # Exit status 0 returned because command executed successfully.

boguscmd
echo $?    # Exit status non-zero returned because command executed unsuccessfully.




anjan

I have used the same in my script but still its not giving me the exit code for job but its give exit code trigger script, if the job fails its still gives ge suess code

Danno

I am not sure where to take you from here. I don't have a similar setup to test this on. Perhaps someone else can jump in or you can post your script for us to review.

vasudev_chavan

#6
We can complete this task and logic will be as follows.

1. Trigger report.
2. Monitor the exist level code with step 3.
3. Also add a task of writting the report status to a DB/table using a event studio job.
4. Depending on the flag written to the DB carry on the future jobs/activity.
5. Reset the value in DB once the future task is completed.