Fundamentals of Basics Routines

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

Dsnew
Participant
Posts: 90
Joined: Tue Apr 19, 2005 2:08 pm

Fundamentals of Basics Routines

Post by Dsnew »

I have a very fundamental question regarding routines.
Can somebody please tell me where we can write routines in datastage.
I would appreciate if somebody could give me a example of a simple routine and where to write it in DS.
Please dont ignore it as a very basic/fundamental question.
Can i pass values and get returned values from routines too?

Thanks in advance
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Dsnew - nothing gets ignored here. :wink:

You write Routines via the Manager client tool. When your cursor is over in the Routine branch of the repository, the File menu will give you the option to create a New Server Routine. You can also copy an existing one and edit it much the same way you would do that for any other object, like a job or table metadata.

Rather than provide a simple routine, why not take a look at the Routines that come with the product? In that same branch are many different categories of routines, simply double-click on one to check its properties and to see the code behind it. I've found that exploration to be quite worthwhile as they are generally well documented as to how they work and the code something you could learn from.

And yes, you can certainly pass values as 'arguments' to a Routine. Note, however, that they can only return a single value (although you could always stash multiple bits of data in that 'single value') and the name of that value is hard-coded to Ans so you would need to ensure anything you write sets that properly.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

ADVERTISEMENT

Post by ray.wurlod »

We expect shortly to announce availability of a beginners' class in writing server routines. (This is already available from my personal business, we're working on offering it through DSXchange.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Dsnew
Participant
Posts: 90
Joined: Tue Apr 19, 2005 2:08 pm

Post by Dsnew »

Thank you chulet.

But how do we know which header file to include ?

Also can you please throw some light on the types
-Transform function
-Before/After Subroutine
-Custom Universe Function
Does the coding method change for these types?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Header file? Experience. You could go through the included routines and see which ones include which headers and try to figure out why. You could also find the header files under your DSEngine directory and examine them there. You'll be able to tell from what's defined in them when you would need to use them.

As for the other questions, they mostly dictate where it can be used. Transform functions are used in Transform derivations, constraints, etc and can have multiple inputs but only one output. B/A subroutines take only one input and only return a status, nothing more. Never played with Custom Universe Functions, so not really sure but not something a typical user would need.

Try creating a new routine and switching the Type yourself to see how the Arguments and Code tabs change accordingly.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Custom UniVerse functions were originally intended for DataStage customers who already had their business rules functions written in the UniVerse database, which was the original engine for DataStage. This is no longer the case, so it's a requirement that is likely to atrophy in DataStage. As a beginner, the best idea is to forget that it is there.

Other than that, Craig has pretty much covered the territory.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
parag.s.27
Participant
Posts: 221
Joined: Fri Feb 17, 2006 3:38 am
Location: India
Contact:

Re: Fundamentals of Basics Routines

Post by parag.s.27 »

Dsnew wrote:I have a very fundamental question regarding routines.
Can somebody please tell me where we can write routines in datastage.
I would appreciate if somebody could give me a example of a simple routine and where to write it in DS.
Please dont ignore it as a very basic/fundamental question.
Can i pass values and get returned values from routines too?

Thanks in advance
Hi,
You can write basic routines in a very simple way. You can see the Routines category in the left hand side pane. you can just right click on that category and select new routine.

In the new opened work space you can define arguments, to which you can pass values from any transformer when you call the routine. Then in the code area you can use those arguments. Just remember to return the answer at the end of ur logic
Thanks & Regards
Parag Saundattikar
Certified for Infosphere DataStage v8.0
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Go to Routines Folder in the Designer. By default you won't see the routine folder. You need to enable this by clicking Tools/options and inside that go to appearance/Repository Tree. Click Show routines.

A good start is to look at the existing routine codes. Double any routine and inside that click the code tab you will find the codes used for that routine
Regards
Siva

Listening to the Learned

"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Do you guys skip over all the previous replies when you reply to a thread? Just wondering as you've both basically just gone over ground we've already covered. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Thanks for mentioning that Craig. I did skipped all previous thread.
Regards
Siva

Listening to the Learned

"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
ram.m
Participant
Posts: 14
Joined: Tue Feb 21, 2006 1:16 am
Location: Bangalore
Contact:

Re: Fundamentals of Basics Routines

Post by ram.m »

Dsnew wrote:I have a very fundamental question regarding routines.
Can somebody please tell me where we can write routines in datastage.
I would appreciate if somebody could give me a example of a simple routine and where to write it in DS.
Please dont ignore it as a very basic/fundamental question.
Can i pass values and get returned values from routines too?

Thanks in advance

Hi,

there are 2 ways to write routines.u can write routines in designer and Manager.in Designer in the repository items rightclick on the routine and select create routine.a window will be dispaly.there u can write.in Manager also same way.

Thanks
Ram
ram
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:roll:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There are, indeed, other ways to write routines, including in text files outside of DataStage. But let's not muddy the waters!
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

Ram, Rasi and Parag,

Please don't ridicule yourselves. There is no point in repeating the same over and over again.

Many Thanks,
Naveen.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Let's all remember that premium content answers are not visible to everyone, and therefore, some non-premium folks may answer something similar to a premium content answer without knowing it. :wink:
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Post Reply