creating and executing a PX routine

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
AlanPA
Participant
Posts: 7
Joined: Mon Apr 28, 2008 7:05 pm

creating and executing a PX routine

Post by AlanPA »

Hi,

I had tried creating a c program for removing unwanted characters in the string and it works.

FUNCTIONALITY
==========
ROUTINENAME("A~b~C")---> AbC


The code is like this....(It worked when I put the main ())
==================
replace_al
==================
#include <stdio.h>
#include <string.h>

char* replace(char* Array)
{
temp=0;
temp = new char[strlen(Array) + 12];
strcpy(temp,Array);
while (*temp!=NULL)
{
if (*temp=='^'||*temp=='~'||*temp=='|'||*temp=='.'||*temp=='\n'){
while (*temp!=NULL){
*temp=*(temp+1);
if (*temp!=NULL) temp++;
}
temp=Array;
}
temp++;
}

return Array;
}

after replacing the main function with that of the above and creating the file using

/usr/vacpp/bin/xlC_r -O -c -qspill=32704 replace_al.cpp

the .o file is created..

When I give the details in the routine properties like
Type:External function
Object type: object
Return type:char*
LibraryPath:/home/ABCD/replace_al.o :::This is where the .o file resides::

Arguments
Arg1 char*

When I try running the DS job, it compiles with no errors but gets aborted .

The error I get is

Transformer_3: Failed to load the library "V0S3_alanPxReplace_1_Transformer_3.o"; 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 "V0S3_alanPxReplace_1_Transformer_3": rtld: 0712-001 Symbol replace_al__FPc was referenced
from module /dstage/home/dsadm/Ascential/DataStage/Projects/SG_AMP_CON/RT_BP1988.O/V0S3_alanPxReplace_1_Transformer_3.o(), but a runtime definition
of the symbol was not found..


Could you guys please help me on this.

Thanks and Regards,

Alan
BugFree
Participant
Posts: 82
Joined: Wed Dec 13, 2006 6:02 am

Post by BugFree »

I think the routine name and the function inside the routine should be the same. in your case both of them should be "replace". I got this error sometime back and i think this solved it.
Ping me if I am wrong...
AlanPA
Participant
Posts: 7
Joined: Mon Apr 28, 2008 7:05 pm

Done!!!

Post by AlanPA »

Thanks A lot...It worked out fine... :D
SettValleyConsulting
Premium Member
Premium Member
Posts: 72
Joined: Thu Sep 04, 2003 5:01 am
Location: UK & Europe

Post by SettValleyConsulting »

Agree. Remember also that routine names are case-sensitive; I had the same error and traced it back to routine names spelled the same but with different capitalisation.
Post Reply