Running Script through Execute Command Activity

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ravij
Premium Member
Premium Member
Posts: 170
Joined: Mon Oct 10, 2005 7:04 am
Location: India

Running Script through Execute Command Activity

Post by ravij »

Hi,

I want to run the Unix shell script using Execute Command Activity in Sequence job. I have given the command in Command box like
sh -c ". /u6/app/datastage751/dwhsetld/invoice/scripts/stg_invdisct_ods_load_uanz.sh"
But Seq job got aborted. My question is: Is that command incorrect? or the way I defined bothe command and file path in the same Command box is incorrect?

I searched in the forum but could not get required solution.

Please tell me how to run the script

Thanks in advance.
Ravi
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Leave out the sh -c and the double quotes.
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 »

And the dot. If you still have problems, post the actual error(s) - simply saying it "got aborted" doesn't really help us help you. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ravij
Premium Member
Premium Member
Posts: 170
Joined: Mon Oct 10, 2005 7:04 am
Location: India

Post by ravij »

Hi Ray/Hulett,

Thanks for your reply.

The job got aborted even I changed the command as
. /u6/app/datastage751/dwhsetld/invoice/scripts/stg_invdisct_ods_load_uanz.sh)
The error message I got is
22:17:33: Execute_UANZ (COMMAND . /u6/app/datastage751/dwhsetld/invoice/scripts/stg_invdisct_ods_load_uanz.sh) started
22:17:33: Execute_UANZ finished, reply=1
22:17:33: Stop_Run Executed
22:17:33: Sequence terminated
Should there be space between the Dot(.) and / or not?
Please help to resolve this issue.

Your help would be appreciated.
Ravi
ravij
Premium Member
Premium Member
Posts: 170
Joined: Mon Oct 10, 2005 7:04 am
Location: India

Post by ravij »

The job got aborted even I changed the command as
. /u6/app/datastage751/dwhsetld/invoice/scripts/stg_invdisct_ods_load_uanz.sh
The error message I got is
22:17:33: Execute_UANZ (COMMAND . /u6/app/datastage751/dwhsetld/invoice/scripts/stg_invdisct_ods_load_uanz.sh) started
22:17:33: Execute_UANZ finished, reply=1
22:17:33: Stop_Run Executed
22:17:33: Sequence terminated
Should there be space between the Dot(.) and / or not?
Please help to resolve this issue.

Your help would be appreciated.
Ravi
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The problem is in your script, which exits with a status of 1. DataStage assumes that a non-zero exit status is a failure, since this is the convention followed in all shells. If you want to make sure that this does not occur, make sure that your script exits with a zero status if the script does not encounter any errors. Usually exit 0 is sufficient (controlled by appropriate logic, of course).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ravij
Premium Member
Premium Member
Posts: 170
Joined: Mon Oct 10, 2005 7:04 am
Location: India

Post by ravij »

Thanks a lot Ray.

You are correct my script exits with status of 1. I will change it as 0 and run the job again. If change 1 as 0, will it impact on script?

Thank you once again.
Ravi
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What is your script doing? Is there a significance to the return code of '1'? As noted, the convention is a zero to indicate success and a non-zero return to indicate a problem. Typically.

Only you can tell us what 'impact' the change of exit status would mean, seeing as how we have no clue what you are doing in it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
lstsaur
Participant
Posts: 1139
Joined: Thu Oct 21, 2004 9:59 pm

Post by lstsaur »

Ravi,
Code like the following:
/u6/app/datastage751/dwhsetld/invoice/scripts/./stg_invdisct_ods_load_uanz.sh
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Why? :?

Nothing wrong with simply a full path to the script:

Code: Select all

/u6/app/datastage751/dwhsetld/invoice/scripts/stg_invdisct_ods_load_uanz.sh
Or were you going for something like this?

Code: Select all

cd /u6/app/datastage751/dwhsetld/invoice/scripts/ && ./stg_invdisct_ods_load_uanz.sh
-craig

"You can never have too many knives" -- Logan Nine Fingers
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post by rameshrr3 »

You can use sh-c in the command box and the rest of the script in the arguments box
lstsaur
Participant
Posts: 1139
Joined: Thu Oct 21, 2004 9:59 pm

Post by lstsaur »

Craig,
Absolutely agree with your statements. What I was trying to tell Ravi that either code as
/u6/app/datastage751/dwhsetld/invoice/scripts/./stg_invdisct_ods_load_uanz.sh
or
. /u6/app/datastage751/dwhsetld/invoice/scripts/stg_invdisct_ods_load_uanz.sh

will work since he asked whether he should put a / after the . or not.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ah... ok. My advice earlier on was to forget the dot but if for some reason it has got to be in there somewhere, that's two somewheres. :wink:
-craig

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