how to stop job after unix script returns value 1

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
marpadga18
Premium Member
Premium Member
Posts: 96
Joined: Fri Aug 20, 2010 8:51 am

how to stop job after unix script returns value 1

Post by marpadga18 »

Hi all,
My requirement is first write aunix shell script which checks if stop.txt file exists on remote machine or not. If stop.txt file exists my unix returns a integer value 1. Other wise it will run the rest of the script and returns integer value 0.
Unix script is running fine but problem with datastage Datastage requirement:If unix script returns a value 1 it should not run the next job. I tried using command output and return value from execute command in sequence, trigger but it is going to next job how to stop next job can any one can share ideas please it is urgent..

Thanks
marpadga
Thanks,
M
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The basic approach you chose by calling the script via the execute command stage is the correct method. But you aren't interpreting the returned string correctly - most likely due to extraneous new line character(s).

Output your returned value to the log file to see what you've got.

p.s. Any post marked "urgent" is usually processed as "non-urgent" in this forum - if it is truly an urgent issue then you should contact your support provider as you are paying them for prompt attention while this forum is staffed exclusivel by volunteers.
marpadga18
Premium Member
Premium Member
Posts: 96
Joined: Fri Aug 20, 2010 8:51 am

how to stop job after unix script returns value 1

Post by marpadga18 »

sorry @ArndW i am new to forum...

this is the meesage I am getting in director log MAIN_SEQ_VAT_UK_LOAD..JobControl (@EX_SH_test): Executed: /local/apps/Datastage/projects/xxx_xxxx_xxx/Scripts/test.ksh
Reply=0
Output from command ====>
1

in the execute command I am doing like this correct me if I am wrong
Expression type Trigger
custom EX_SH_test.$CommandOutput <>1

then also it going to the next job. this is the correct way? could anyone can tell any ideas



can you give any idea how to go ahead. any ideas.
Thanks,
M
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You need to remove the Field Mark(s) that they return with:

Convert(@FM,"",custom EX_SH_test.$CommandOutput) <> 1
-craig

"You can never have too many knives" -- Logan Nine Fingers
marpadga18
Premium Member
Premium Member
Posts: 96
Joined: Fri Aug 20, 2010 8:51 am

Post by marpadga18 »

chulett wrote:You need to remove the Field Mark(s) that they return with:

Convert(@FM,"",custom EX_SH_test.$CommandOutput) <> 1 ...
I tried two things
1)Convert("1",EX_SH_test.$CommandOutput) <> 1 it is saying genral synatx error.

2)Convert(@,"", EX_SH_test.$CommandOutput) <> 1
warning: Variable '@' not defined

Could you correct me were i am doing wrong?
Thanks,
M
marpadga18
Premium Member
Premium Member
Posts: 96
Joined: Fri Aug 20, 2010 8:51 am

Post by marpadga18 »

hey chutlet... I tried this
Convert(@FM,"", EX_SH_test.$CommandOutput) <> 1
now it is working fine but can you expalin about this functionality. I got the result but not able to understand the logic.Could you explain so that every body who reads this post can understand.

Thanks for your help chutlet :):):)
Thanks,
M
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So, it worked more better when you used the actual syntax I posted I see. :wink:

It's been explained here quite a number of times already. Best thing I can tell you to do is search for the error message that usually starts this conversation and you'll find plenty of examples.

Do an exact search for "[ParamValue/Limitvalue is not appropriate]" without the quotes.
-craig

"You can never have too many knives" -- Logan Nine Fingers
marpadga18
Premium Member
Premium Member
Posts: 96
Joined: Fri Aug 20, 2010 8:51 am

Post by marpadga18 »

Ok thanks chulett u rock :):):)
Thanks,
M
Post Reply