How to create and execute routines in 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
Marley777
Premium Member
Premium Member
Posts: 316
Joined: Tue Jan 27, 2004 3:26 pm

How to create and execute routines in PX

Post by Marley777 »

Hi, I have created code in unix scripts then called the scripts from a sequencer, but would like to learn more about creating and calling DS routines. Can someone point me to a good tutorial of some kind? Also, why would I need a routine instead of a unix shell script(looking for an example)?
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

This is what is called a "non-trivial topic". I will address the "why", but for the "how" you need to read these documents:

Chapter 5 of the Parallel Job Advanced Developers Guide located in your installation documentation (note: not available via download from IBM) and the "guaranteed to put an insomniac to sleep in 10 minutes" Custom Operators Reference Guide http://publibfp.dhe.ibm.com/epubs/pdf/c1929250.pdf.

WHY you'd want to use a routine is simple - you want to add custom functionality to DataStage that can be run in parallel to avoid slowing down a parallel processing job stream with a single-threaded procedure.

Fortunately there are multiple ways to accomplish this including build-ops, custom stages and wrappers (all of which are covered in Chapter 5).

Originally many existing custom stages and operators were written by IBM consultants that knew C++ better than the DataStage transformer, or felt it would be faster to run custom C++. Lately, with the transformer speed and functionality improvements in recent releases, I have been asked by many clients to replace these custom stages with transformers. This is because they don't have the expertise to support the custom operators, which have become "black boxes" that can't be upgraded or fixed by their in-house staff.
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
vinothkumar
Participant
Posts: 342
Joined: Tue Nov 04, 2008 10:38 am
Location: Chennai, India

Post by vinothkumar »

Marley777
Premium Member
Premium Member
Posts: 316
Joined: Tue Jan 27, 2004 3:26 pm

Post by Marley777 »

Thanks for the response so far.

also wondering if I can use datastage basic code to create a routine that will be called in a px job? Or do I have to use C++?
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

BASIC transformer is available in PX job. But it will be very slow.

You have to use C++ to create parallel routines
You are the creator of your destiny - Swami Vivekananda
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Unless we are talking about before/after routines, those are still in BASIC even for Parallel jobs.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Marley777
Premium Member
Premium Member
Posts: 316
Joined: Tue Jan 27, 2004 3:26 pm

Post by Marley777 »

If we have custom routines written for server jobs and want to convert to px jobs, how can we do that? Do we need to rewrite in C++?

Thanks.
datisaq
Participant
Posts: 154
Joined: Wed May 14, 2008 4:34 am

Post by datisaq »

IBM Certified - Information Server 8.1
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

RStone wrote:If we have custom routines written for server jobs and want to convert to px jobs, how can we do that? Do we need to rewrite in C++?

Thanks.
Yes, you will need to recode these routines to c++ for PX jobs. While you can use BASIC transform stages in PX jobs and call your original routines from these stages, you lose performance and some functionality when doing so.
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

RStone wrote:If we have custom routines written for server jobs and want to convert to px jobs, how can we do that? Do we need to rewrite in C++?
Maybe - my experience has been that many custom routines can be recreated using standard PX stages combined with wrapped UNIX commands, eliminating the need for C++.
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
Marley777
Premium Member
Premium Member
Posts: 316
Joined: Tue Jan 27, 2004 3:26 pm

Post by Marley777 »

Hi, is this statement true

"The parallel routines can only be called from the parallel transformer(datastage parallel job transformer) in a datastage job."

Was thinking you can execute routines in a sequencer?
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Yes parallel routines can be called only from the Parallel Transformer.

You cannot call parallel routines from the Sequencer.
You are the creator of your destiny - Swami Vivekananda
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Andy

How fast are UNIX commands compared to compiled C routine?
Mamu Kim
Post Reply