Page 1 of 1

DataStage Routines - What Are they?

Posted: Tue Dec 21, 2010 9:31 pm
by wfkurtz1
Could someone give me a brief description of what a DS Routine is and when, why & where I might want to use one?

Thanks in advance.

Posted: Tue Dec 21, 2010 9:39 pm
by ray.wurlod
A DataStage parallel routine is an external function, written in C++, to perform any task that you like but which, for example, it is too tricky to achieve using regular Transformer stage expressions. One example is the ability to replace one substring with another anywhere in a main string, the so-called Ereplace() function.

Parallel Routines as viewed in the Repository are not routines at all, but rather metadata that record the existence, location, type and arguments of these external functions.

Posted: Tue Dec 21, 2010 10:10 pm
by chulett
And since we're in the General forum...

Server routines are written in DataStage BASIC and can be used in much the same manner as Ray noted but in the Transformer stage in a Server job. They also are what you can run 'Before' or 'After' jobs or stages and are what the Routine Activity stage in Sequence jobs run.

Like any routine, they can vary from the terminally simple to extremely complex. The 'job control' code I have in my toolkit (courtesy of Uncle Ken) is a thousand or more lines of routine code. Never bothered to count it all. :wink:

Posted: Wed Dec 22, 2010 9:40 pm
by wfkurtz1
Thanks guys. Once created can a routine be manipulated similarily to a stage type and be instantiated as a step in the flow of a job? Do you know if any of the 30+ pdfs in the doc set explain routines?

Posted: Thu Dec 23, 2010 4:34 am
by ray.wurlod
Routines are separately-callable components - so the answer to your question is "yes". Manuals are the DataStage Programmer's Guide and the DataStage BASIC manual.