Invoke unix script using c program

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
somesh2suma
Participant
Posts: 23
Joined: Wed Apr 08, 2009 5:28 am
Location: Bangalore

Invoke unix script using c program

Post by somesh2suma »

hi

i want to invoke a unix script in a C program or datastage routine and also return some value from the script to the C program to use that value further.

Basically i am doing a Lookup operation in this unix script and returning the looked up data from a oracle database table..

please help me invoke as well as return data from the script to C program.
somesh2dsx
myukassign
Premium Member
Premium Member
Posts: 238
Joined: Fri Jul 25, 2008 8:55 am

Post by myukassign »

how about an Exec command squncer stage to call the C program, which inturn call the your scrip tin it.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

system() for C
somesh2suma
Participant
Posts: 23
Joined: Wed Apr 08, 2009 5:28 am
Location: Bangalore

Post by somesh2suma »

myukassign wrote:how about an Exec command squncer stage to call the C program, which inturn call the your scrip tin it.
thats a good idea to call routine but i want to call routine from transformer itself.
Sainath.Srinivasan wrote:how about an Exec command squncer stage to call the C program, which inturn call the your scrip tin it.
yes through System function hope i can run a unix command but result of this will be either exit numbers like 0 & -1 etc, but i want to get the value which is there in a script variable to the C program.
somesh2dsx
somesh2suma
Participant
Posts: 23
Joined: Wed Apr 08, 2009 5:28 am
Location: Bangalore

Post by somesh2suma »

Now due to performance issue with the oracle connectivity for each and every record, i am planning to keep all my lookup table contents into normal unix file seperated by comma.

with this the performance will be atleast improved. On whole now my requirement is to :
1. call a c routine in datastage transformer
2. call a unix script for lookup in the unix file.
3. return the looked up data to c function or datastage directly.

please let me know for initial steps and commands used... and will research on this further.
somesh2dsx
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

somesh2suma wrote:with this the performance will be atleast improved.
Your proof?

How are you moving the records from Oracle to the text file(s)?

Why not just effect the lookup directly against the virtual Data Set created by using the text file as the source for the reference input to a Lookup stage? There is no need for a C routine (not least because DataStage does not use C routines), and definitely no need for a UNIX command, which tends to create a new shell for each one invoked. Performance of that would suck.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
somesh2suma
Participant
Posts: 23
Joined: Wed Apr 08, 2009 5:28 am
Location: Bangalore

Post by somesh2suma »

ray.wurlod wrote:
somesh2suma wrote:with this the performance will be atleast improved.
Your proof?

How are you moving the records from Oracle to the text file(s)?

Why not just effect the lookup direc ...
Ray,
i mean to say i am using a normal unix file instead of an oracle table. so instead of creating insert statements for the given data, i will store the given data in file seperated by comma.....
somesh2dsx
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

This to me sounds like a Really Bad Idea. Either resolve your 'performance issues' with the Oracle lookup or do a normal lookup directly against the flat file. Easy Peasy.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply