Page 1 of 1

Invoke unix script using c program

Posted: Mon Sep 27, 2010 5:24 am
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.

Posted: Mon Sep 27, 2010 5:58 am
by myukassign
how about an Exec command squncer stage to call the C program, which inturn call the your scrip tin it.

Posted: Mon Sep 27, 2010 6:27 am
by Sainath.Srinivasan
system() for C

Posted: Tue Sep 28, 2010 12:06 am
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.

Posted: Tue Sep 28, 2010 12:13 am
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.

Posted: Tue Sep 28, 2010 12:29 am
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.

Posted: Tue Sep 28, 2010 6:58 am
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.....

Posted: Tue Sep 28, 2010 7:11 am
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.