Value from routine in routine activity

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
ds_team
Participant
Posts: 48
Joined: Sun Dec 03, 2006 12:18 am

Value from routine in routine activity

Post by ds_team »

Inside jobsequence i have a routine activity which calls a routine. I want to set a value inside this routine and in the next nested conditional stage i want to get this value and do a comparison. How can I get the value outside the routine.setting userstatus dont work out here.Can i use return to set the value. If so please give me the format for this.
arnabdey
Participant
Posts: 50
Joined: Wed Jan 10, 2007 5:56 am

Use Ans

Post by arnabdey »

Hi

From the routine you can retrun a value by giving the following
Ans=..... at the end
The value is returned only if it is a transform type routine.
Now it's output trigger should be Unconditional.... [b]NOT[/b] Ok (Conditional). In any subsequent stages you can access the value by <Routine Stage Name>.$ReturnValue. You can get it from Activity Variable option in the Expression Editor.
Arnab
ds_team
Participant
Posts: 48
Joined: Sun Dec 03, 2006 12:18 am

Re: Use Ans

Post by ds_team »

What do you mean by transform type routine?

I did set ans=1 inside my routine. but i was not able to get this value outside.

arnabdey wrote:Hi

From the routine you can retrun a value by giving the following
Ans=..... at the end
The value is returned only if it is a transform type routine.
Now it's output trigger should be Unconditional.... NOT Ok (Conditional). In any subsequent stages you can access the value by <Routine Stage Name>.$ReturnValue. You can get it from Activity Variable option in the Expression Editor.
arnabdey
Participant
Posts: 50
Joined: Wed Jan 10, 2007 5:56 am

Hi

Post by arnabdey »

When you develop the routine you have a Type drop-down menu in General Tab. There you need to specify as Transform Function. So when you go to the Code page, at the botton you get Return (Ans). So at the end of your routine, if the Ans is set, that will be returned.

Also check the triggerring.
Arnab
arnabdey
Participant
Posts: 50
Joined: Wed Jan 10, 2007 5:56 am

Post by arnabdey »

By the way it is not ans..... It is Ans.
Arnab
ds_team
Participant
Posts: 48
Joined: Sun Dec 03, 2006 12:18 am

Post by ds_team »

I did change the type of my routine to transform. But this routine doesnt serve my purpose. Is there any other way of doing this :(
arnabdey wrote:By the way it is not ans..... It is Ans.
arnabdey
Participant
Posts: 50
Joined: Wed Jan 10, 2007 5:56 am

Post by arnabdey »

Can you show me the code for the routine?

See you check the following

1. You should do
Ans=1 not ans=1

2. Check the trigger condition
Arnab
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In the downstream activity, click on the helper tool (which might be labelled something like Insert Job Parameter) or - if using the Expression Editor - choose Activity Variable. You will get a list of all activity variables from upstream activities, including your Routine activity's $ReturnValue, displayed in a list. Select it from that list.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Excuse me for my ignorance, but why cant you utilize the user status area. Sequence jobs do have user status areas. Correct me if i am wrong.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Just to throw more chum in the water, there's no need for User Status or to check the returned value separately in a downstream activity. You can do it directly in the triggers from the Routine Activity stage as there is a trigger type specifically for checking Return values.

If there's something wrong with your routine code, post it, we'll get it squared away. :wink:
-craig

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