How to compile an enternal C/C++ Routine and use in DS PX

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
maffan76
Participant
Posts: 110
Joined: Tue Aug 23, 2005 5:27 am

How to compile an enternal C/C++ Routine and use in DS PX

Post by maffan76 »

Hi,
We have recently jumped from Server Version to PX and have to migrate jobs from Server verison to PX. While reading the Pdfs in my understanding that basic routines are no more usable in PX. So to acheive teh same funcationality we will have to write C/C++ functions and call it from transformer. I could not find any good example(s)/tutorial in any Pdf to how to build Parallel external routines on windows platform.

Can some guid me how to compile and link the routine in DS PX or any sample for it.

Thanks in Advance.
Regards,
Affan
"Questioning is Half Knowledge"
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Read the chapter on Custom Stages in the Parallel Job Developer's Guide.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
benny.lbs
Participant
Posts: 125
Joined: Wed Feb 23, 2005 3:46 am

Re: How to compile an enternal C/C++ Routine and use in DS P

Post by benny.lbs »

You may refer to your DataStage Client installation disk in \Samples\TrxExternalFunctions\, it gives you a sample to build Parallel Transformer External Function.
maffan76 wrote:Hi,
We have recently jumped from Server Version to PX and have to migrate jobs from Server verison to PX. While reading the Pdfs in my understanding that basic routines are no more usable in PX. So to acheive teh same funcationality we will have to write C/C++ functions and call it from transformer. I could not find any good example(s)/tutorial in any Pdf to how to build Parallel external routines on windows platform.

Can some guid me how to compile and link the routine in DS PX or any sample for it.

Thanks in Advance.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

ray.wurlod wrote:Read the chapter on Custom Stages in the Parallel Job Developer's Guide.
Correction, look in the Parallel Job Advanced Developer's Guide.

Going to add this thread to my favourites. :lol:

You can also look in the old Orchestrate Guides as they have some more sample C code and are sometimes more complete then the DataStage guides. Ask Ascential Support for a copy.
trammohan
Participant
Posts: 47
Joined: Thu Nov 13, 2003 12:47 pm

Post by trammohan »

here is the command for compiling external C/C++ routines in UNIX

aCC -c +z file_name

call this a.out from Datastage routine as external routine..

Ram
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

I assume you want to replace your old DataStage BASIC routines with C functions. These functions can be called directly from a parallel transformer and the sample functions are a good place to start. It is written in a C language so you should find a good C reference book, I don't think Ascential have any documentation on these.
maffan76
Participant
Posts: 110
Joined: Tue Aug 23, 2005 5:27 am

Post by maffan76 »

Thanks everyone,
I did look into the Parallel Job Advanced Developer Guide but could nto find anything related to Parallel Routines. it does explain the Stage Type but no tutorial on Parallel Routines.

As far as the samples are concerned, no sample of windows :( and there are no exmaples of how to build parallel routines for Windows Platform as i am running 7.5x2 on windows XP (for sample dev) though i know the platform is not officially supported but the version runs on this with no problem, correct me if i am wrong.
Regards,
Affan
"Questioning is Half Knowledge"
Eric
Participant
Posts: 254
Joined: Mon Sep 29, 2003 4:35 am

Post by Eric »

Do you want to build static or dynamic libraries?

For static libraries you need to compile a *.lib file
for dynamic libraries you need to build a *.dll file

How you generate these depend on your choice of using command line 'nmake' or the Visual Studio .net application.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Why would a C routine on Windows be any different from the same C routine on UNIX? Unless, of course, it interacts with the file system (pathnames are different) - but the whole goal of parallel jobs is to keep data in memory (virtual Data Sets) as much as possible.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Eric
Participant
Posts: 254
Joined: Mon Sep 29, 2003 4:35 am

Post by Eric »

ray.wurlod wrote:Why would a C routine on Windows be any different from the same C routine on UNIX?
The routine code may be the same, but to create a windows DLL you will require a different function decleration and sometimes different include definitions. This is due to the way the windows platform uses a DLL at runtime.
clshore
Charter Member
Charter Member
Posts: 115
Joined: Tue Oct 21, 2003 11:45 am

Post by clshore »

Another caveat, my documentation (7.5) specified that a C++ compiler was required.
I have not tried (yet) on a Windows platform.

Carter
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Re: How to compile an enternal C/C++ Routine and use in DS P

Post by vmcburney »

[quote="maffan76"]Hi,
We have recently jumped from Server Version to PX and have to migrate jobs from Server verison to PX. quote]
And another thing, you don't have to migrate your jobs from server to PX. :twisted: You only need to migrate those jobs that need to run faster and would benefit from a parallel architecture. Since you already have a large investment in server jobs and server routines why migrate those that are working and working well? Server jobs and parallel jobs can live happily together. You may also find a parallel job with a server transformer gives you enough of a performance improvement.
Post Reply