Call java code in datastage

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
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Call java code in datastage

Post by prasson_ibm »

Hi,
I have a java code with name Sum.java

code:-
class Sum1
{
int RetSum(int a1 , int a2)
{
return a1+a2;
}
}

class Sum
{
public static void main(String args[])
{
Sum1 a=new Sum1();
System.out.println(a.RetSum(10,20));
}
}

when i coplied this code it generates two class files
Sum.class and Sum1.class

I want to call this code in transformer.
Is it possible to do this,if it is please help me how to do ..??

Regards
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It's not as far as I know. There is a Java PACK that will allow you to do things like this but it is a option you need to purchase. Perhaps with a build-op? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

chulett wrote:It's not as far as I know. There is a Java PACK that will allow you to do things like this but it is a option you need to purchase. Perhaps with a build-op? :?
Hi Chulett Thanks for ur reply,Ok but i dont know how to use buildup stage,can u please help me writing this code in buildup stage and exec..???
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Nope, sorry, can't... don't have that particular skill set.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

1. Write a c program. Here's one I use:

Code: Select all

#include <stdlib.h>
#include <stdio.h>

char * AwHelloWorld(char * InString)
{
char* OutStr;
OutStr="Hello World!";
return OutStr;
}
2. Compile the code, on AIX I use "/usr/vacpp/bin/xlC_r -O -c HelloWorld.cpp"
3. Link the code, on AIX I use "/usr/vacpp/bin/xlC_r -O -G HelloWorld.o -o HelloWorld.o"
4. In the designer, create a parallel routine. Define it with the correct entrypoint (AwHelloWorld), as an object and with the correct parameter(s) and return type. Also use the correct full path to the HelloWorld.o file.
5. Create a job with a transform stage and call up the routine.
6. Bob's your uncle :)
Post Reply