Parallel Routine Object File

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
chaks
Premium Member
Premium Member
Posts: 39
Joined: Wed Nov 22, 2006 9:21 pm
Location: MA

Parallel Routine Object File

Post by chaks »

Hello...i have written a parallel routine for the first time and i'm facing problem in running it. i want ur help in resolving the issue.

here are the details regarding the routine...
ObjectTesting.cpp:
#include <stdlib.h>
#include <stdio.h>
#include <iostream.h>
#include <stdcomp.h>
char * ObjectTestOne()
{
char * OutStr;
OutStr="Hello World - Object Testing";
return OutStr;
}

I compiled this C++ program with the compiler options from Administrator

compiler: /opt/SUNWspro/bin/CC
compileropt: -dalign -O -PIC -library=iostream -c
LD_LIBRARY_PATH: /usr/lib:/lib
Before compiling the program without main(), i tried it with main() and the program was running fine.after that i removed main() and compiled it.
command:
/opt/SUNWspro/bin/CC -dalign -O -PIC -library=iostream -c ObjectTesting.cpp

got the object file ObjectTesting.o

and linked the object file to the prallel routine as follows:

routine name: ObjectTesting
external subroutine name: ObjectTestOne
library path : /modl/apps/fold/dsdata/common/bin/ObjectTesting.o
object type : object


when i try to use this routine in a sample job i get the following error:

Transformer_3: Failed to load the library "V136S0_test_Transformer_3.so"; either the directory containing the library file
is not on the library search path, or the library was compiled on a system
that is incompatible with this system: Could not load "V136S0_test_Transformer_3": ld.so.1: osh: fatal: relocation error: file /modl/apps/fold/projects/nylim-GENEVA/RT_BP393.O/V136S0_test_Transformer_3.so: symbol __1cGObjOne6F_W_: referenced symbol not found. [transform/transform.C:1668]

do i have to place the object file in a specific folder or place it anywhere and provide the link in library path of routine.

I think the error has something to do with the object file linking, but don't know how to resolve it.


looked at similar posts but didn't get info regarding, where to place the object file? do we need to create any shared object? etc.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Did you create a "parallel routine" entry in your Repository to allow DataStage to find your code at run time?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chaks
Premium Member
Premium Member
Posts: 39
Joined: Wed Nov 22, 2006 9:21 pm
Location: MA

Post by chaks »

Thank you very much for ur reply Ray...

Yes i did...
with options set as..
routine name: ObjectTesting
external subroutine name: ObjectTestOne
library path : /modl/apps/fold/dsdata/common/bin/ObjectTesting.o
object type : object
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

Put the object file in one of the 'library folders'; Provide that as lib path & recompile. That will give you an idea of what to do.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
Sreedhar
Participant
Posts: 187
Joined: Mon Oct 30, 2006 12:16 am

Post by Sreedhar »

Hi,

The program name and the function name should match, in order to exectue that so...


either rename your program name or function.

either both should be ObjectTesting.cpp/ObjectTesting ()
or ObjectTestOne.cpp/ObjectTestOne()

Let know if it still causes you problem.

Regards,
Regards,
Shree
785-816-0728
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I don't think that is required. When you register the routine you have to tell it the name of object code and the CPP function name. You can have a main if you want as well but main is not the CPP function name.

You need to compile with the same options as the jobs. You can look those options up in Manager, I think. The link option is the only difference. I have a post where all this is explained in detail. Josh has a nice blog bout it as well.

If you have a main then you can test it at the UNIX prompt and by pass DataStage to see your results. Makes testing easier. You need to use args in main to call the CPP function. Hope this helps.
Mamu Kim
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

Need not be the same. I put the example in this blog: http://it.toolbox.com/blogs/dw-soa/data ... easy-20926 specifically to say that.
Sreedhar wrote:Hi,

The program name and the function name should match, in order to exectue that so...


either rename your program name or function.

either both should be ObjectTesting.cpp/ObjectTesting ()
or ObjectTestOne.cpp/ObjectTestOne()

Let know if it still causes you problem.

Regards,
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
Rob4732
Premium Member
Premium Member
Posts: 66
Joined: Mon Oct 06, 2008 5:14 pm

Post by Rob4732 »

Hello All,

I found this post and it describes the same scenario I am facing. I have created the HelloWorld c++ code:

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

char * ObjTestOne()
{
char* OutStr;
OutStr="Hello World - Object Testing";
return OutStr;
}

I tested the version with main() in it and it works.

Compiled(see below) creating the ObjTestOne.o object:

/opt/sunstudio12.1/bin/CC -dalign -O -PIC -library=iostream -c -xarch=v9 ObjTestOne.cpp

I created my parallel routine in ds as shown below:
routine name: HelloWorld
external subroutine name: ObjTestOne
library path : /home/user/ObjTestOne.o
object type : object

I don't think the location of the object file matters, as long as the routine points to it.

When I reference my routine in a parallel transformer, job aborts with following message:

xfm_patient: Failed to load the library "V0S20_job_stg_patient_xfm_patient.so"; either the directory containing the library file
is not on the library search path, or the library was compiled on a system
that is incompatible with this system: Could not load "V0S20_job_stg_patient_xfm_patient": ld.so.1: osh: fatal: relocation error: file /ibm/server/projects/CLARITY_TO_OHSUDW/RT_BP64.O/V0S20_job_stg_patient_xfm_patient.so: symbol __1cKObjTestOne6F_W_: referenced symbol not found.

Any help appreciated.

thx
Robert
We don't see things as they are;
We see them as we are.
Rob4732
Premium Member
Premium Member
Posts: 66
Joined: Mon Oct 06, 2008 5:14 pm

Post by Rob4732 »

Found the problem.

The return type in my parallel routine was char . I should have selected char* . My bad.


thanks
We don't see things as they are;
We see them as we are.
Post Reply