Page 1 of 1

Sample px routine

Posted: Sun Mar 04, 2007 9:27 am
by Madhu1981
Hi,

I am good at C++ and i am interested in writing parallel routines. I really don't know how to start up.

Can some one send me the syntax or one simple routine so that i can understans it clearly.

Thanks in advance.

Posted: Sun Mar 04, 2007 10:32 am
by ray.wurlod
Search the forum. Search the manuals. There are examples out there.

Posted: Sun Mar 04, 2007 10:36 am
by DSguru2B
If you know how to code in C/C++ then it should be a piece of cake for your. You just need to code functions. Test it out on command line. Then link it to datastage by creating a parallel routine and providing the object file's path. Search will reveal all.

Posted: Sun Mar 04, 2007 8:40 pm
by ray.wurlod
The most important piece, as will all programming, is to establish your requirements and design your algorithm before even touching any code. In the case of DataStage functions, give some thought also to whether you can make the function more generic/re-usable.

Posted: Tue Mar 06, 2007 4:39 am
by videsh77
Check advpx.pdf, comes with your DataStage installation. Therein check the chapter for "Specifying your own parallel stages".

Posted: Tue Mar 06, 2007 6:04 am
by jhmckeever
You can find source code for two parallel routines here:

<a href="viewtopic.php?t=106358">pxEReplace</a> and <a href="viewtopic.php?t=107882">matchRegexp</a>

HTH,
J.

Posted: Mon Mar 12, 2007 4:17 am
by rameshrr3
Sorry to Hijack This thread:

Once i have created and object file 'routine.o', where do i place it so that my transformer can access the same? Should the location of the object file be an entry in LD_LIBRARY_PATH? Im aware of how to define a parallel routine in manager. But how do i get to use this routine succesfully in transformer?

Thanks
Ramesh

Posted: Mon Mar 12, 2007 4:48 am
by kumar_s
You need to create a new routine from Datastage and supply all the necessary details along with the directory path of the object code that are residing.
The new routine will refer the functionality of the created C++ code.

Posted: Mon Mar 12, 2007 5:40 am
by rameshrr3
The routine worked after i removed the main() function , and added my compiler library directory to the datastage LD_LIBRARY_PATH environment variable.

Posted: Mon Mar 12, 2007 7:10 am
by DSguru2B
There is no main() function in a px routine. DataStage looks for function name. You can have 10 C functions in a single file doing different transformations, with 10 px routines, all pointing to a single object file and they all will work.

Posted: Mon Mar 12, 2007 8:24 pm
by kumar_s
If your issue is solved, you can mark the topic as resolved.