Sample px routine

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
Madhu1981
Participant
Posts: 69
Joined: Wed Feb 22, 2006 7:49 am

Sample px routine

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Search the forum. Search the manuals. There are examples out there.
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 »

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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
videsh77
Premium Member
Premium Member
Posts: 97
Joined: Thu Dec 02, 2004 10:43 am
Contact:

Post by videsh77 »

Check advpx.pdf, comes with your DataStage installation. Therein check the chapter for "Specifying your own parallel stages".
Thanks with regards,
videsh.
jhmckeever
Premium Member
Premium Member
Posts: 301
Joined: Thu Jul 14, 2005 10:27 am
Location: Melbourne, Australia
Contact:

Post 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.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post 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
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post 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.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

If your issue is solved, you can mark the topic as resolved.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply