Page 1 of 1

Parallel Routine

Posted: Thu Mar 20, 2014 9:04 pm
by hitmanthesilentassasin
Hi,

I am trying to convert names to camel case. I am trying to implement using the c++ code I found on this site (shown below). but when I am calling it from the parallel routine I am getting the below error. Can you please let me know what is the error meaning. I am pretty sure that it is able to find the routine because I have already tried a function that returns integer and its working fine. Just for your information I have used the options defined in the environment variables to compile and create shared objects using g++ compiler.

ERROR:

Code: Select all

Transformer_13: Failed to load the library "V0S13_casetester_Transformer_13.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 "V0S13_casetester_Transformer_13": /opt/IBM/InformationServer/Server/Projects/PJ/RT_BP469.O/V0S13_casetester_Transformer_13.so: undefined symbol: _Z7ConvMCTi.
CPP code:

Code: Select all

#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#include "ctype.h"

char* ConvMCT(char *str)  //Function with string input and string
{
   char *result = new char[sizeof(str)*sizeof(char *)];
   int x=0, Flag=1;  // Setting Flag to 1 to make the first letter capital.
   char CheckStr[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

   while(*str)
   {
      if(Flag=1)  //Check if the last character was not alphabet.
      {
         if(isalpha(*str) and islower(*str)) //Convert to uppercase if its a lower case alphabet.
         {
            result[x] = toupper(*str);
         }
         else
         {
            result[x] = *str; //No Change if its already in uppercase or not an alphabet.
         }

      }
      else
      {
         if(isalpha(*str) and isupper(*str))
         {
            result[x] = tolower(*str); //Convert to lowercase except the first character.
         }
         else
         {
            result[x] = *str;
         }
      }

      if(!strchr(CheckStr, *str))   //Check if the string is not a-z and A-Z.
      {
         Flag=1;
      }
      else
      {
         Flag =0;
      }
      ++x;
      ++str;
   }
   result[x] = '\0'; //Terminate the string
   return result; //Return the replaced string
}

Posted: Thu Mar 20, 2014 11:01 pm
by hitmanthesilentassasin
further to my previous post I understand that the issue is with the parameter definition of char * which is causing the trouble. Is there an alternate way of implementing this?

Thanks!!

Posted: Wed Aug 27, 2014 6:33 am
by aebdw
We are facing the same issue, can someone help with the fix ?

Posted: Wed Aug 27, 2014 7:44 am
by chulett
What 'same issue' - the exact same error calling the exact same parallel routine? If not, you need to start your own post with the gory details of your own particular problem.

Posted: Mon Sep 01, 2014 6:47 am
by priyadarshikunal
That error was path search failure.

Search for ConvMCT to get the original post which discusses about the problem with pointers.

Posted: Mon Sep 01, 2014 7:26 am
by priyadarshikunal
seems ORA-03113 started popping up frequently :wink:

Posted: Mon Sep 01, 2014 9:16 am
by chulett
... and at a moments notice it could change again... and again...

:wink:

Posted: Wed Sep 03, 2014 4:47 pm
by rameshrr3
What was the operating system you compiled on ? Linux ? Otherwise g++ is NOT the optimizing compiler for your platform for datastage parallel transformer. what is the default value of APT_COMPILER on your environment?

for HP-UX -> use aC++ compiler
for IBM-AIX -> use xlC/C++ compiler
for Solaris -> use Sun/Oracle workshop compiler ( cc )
Linux : g++

I dont think any other *Nix platform is currently supported.

Thanks
Ramesh

Posted: Tue Feb 24, 2015 9:33 am
by PhilHibbs
The code in the OP contains a memory leak. It is allocating memory with the new operator, and that memory never gets freed. How to fix this? Sorry, not possible. At present it is impossible to write string functions that do not have memory leaks or thread safety issues. IBM should implement a parallel routine type that receives and returns a std::string object, as this is precisely what the string class was invented for.

Re: Parallel Routine

Posted: Thu Sep 10, 2015 11:41 pm
by pbttbis
hitmanthesilentassasin wrote: if(Flag=1) //Check if the last character was not alphabet.
Just a note for others wanting to use the code above. It needs to be Flag==1 Or Flag>0 otherwise it uppercases the entire string.

Also on my compiler I had to change "and" to "&&".

I hope it saves others some time debugging...