Page 1 of 1

creating and executing a PX routine

Posted: Tue May 06, 2008 1:03 am
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

Posted: Tue May 06, 2008 1:35 am
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.

Done!!!

Posted: Tue May 06, 2008 2:46 am
by AlanPA
Thanks A lot...It worked out fine... :D

Posted: Tue May 06, 2008 9:29 am
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.