DSRoutine

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
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

DSRoutine

Post by dspxlearn »

Hi,

I am new in writing routines .I am wondering if,a routine can return more than one value or not.
In my requirement, i am getting a string delimited by commas.I have to extract each string delimited by comma.I am using string[] function for attain this.
Or is there any other way to do this.
Thanks and Regards!!
dspxlearn
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

Use Field Function.
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

Hi balajisr,


Thats fine..My problem is, can a routine return more than one value. :idea:
Eg:
I am getting a string,

Hi,How,Do,You,Do

So in the string i have to extract the strings dilimited with commas.i.e,
Hi
How
Do
You
Do

I have to pass these values to my next Jobactivity as parameter..
:arrow:
Thanks and Regards!!
dspxlearn
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

It may be possible with Start and End loop activity.
Pass on a value thorough a parameter say 'I' from the looping activity and fetch the Ith value of the given string and pass as parameter to the next job activity.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
bchau
Charter Member
Charter Member
Posts: 46
Joined: Tue Jan 18, 2005 7:39 am
Location: Japan
Contact:

Post by bchau »

dspxlearn wrote:Thats fine..My problem is, can a routine return more than one value. :idea:
Eg:
I am getting a string,

Hi,How,Do,You,Do

So in the string i have to extract the strings dilimited with commas.i.e,
Hi
How
Do
You
Do

I have to pass these values to my next Jobactivity as parameter..
:arrow:
Can you provide more details about what you are trying to do?

If you are setting the job parameters in the job activity stage, you can use the "field" function to extract the target value. In your example you can use field("Hi,How,Do,You,Do",",",4) to extract "You" from the string to set the parameter.
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

As kumar mentioned you can use start loop activity. Pass the comma delimited string to the loop activity.Choose delimiter as comma.
The job will invoked for each item in the comma delimited string.

It would be better if you can give some more details of what you are trying to do?.
Last edited by balajisr on Mon May 22, 2006 10:48 pm, edited 1 time in total.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

dspxlearn wrote:My problem is, can a routine return more than one value.
To answer your question - No. You need to do exactly what it sounds like you are doing, returning some kind of delimited value and then breaking it up into its component parts after the fact.
-craig

"You can never have too many knives" -- Logan Nine Fingers
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

Hi Kumar_s,

My requirement is i will be getting a seq file in which, there will be multiple lines which are comma delimited.Each line is a set of parameters to the job activity.
So, i have to read each line and divide them based on the delimiter (,) and pass these list to the job activity which has the job.
After this, i have to proceed to the next line and so on.... :( :(
Thanks and Regards!!
dspxlearn
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

As mentioned use Start loop activity to pass the value of n to the funtion field("Hi,How,Do,You,Do",",",n) which lies in routine acitivity. The output of the routine activity for each loop can be passed to the subsequent job activity as a parameter.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply