Parallel 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
hitmanthesilentassasin
Participant
Posts: 150
Joined: Tue Mar 13, 2007 1:17 am

Parallel Routine

Post 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
}
hitmanthesilentassasin
Participant
Posts: 150
Joined: Tue Mar 13, 2007 1:17 am

Post 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!!
aebdw
Premium Member
Premium Member
Posts: 3
Joined: Mon Dec 02, 2013 4:32 pm

Post by aebdw »

We are facing the same issue, can someone help with the fix ?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

That error was path search failure.

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

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

seems ORA-03113 started popping up frequently :wink:
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

... and at a moments notice it could change again... and again...

:wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post 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
PhilHibbs
Premium Member
Premium Member
Posts: 1044
Joined: Wed Sep 29, 2004 3:30 am
Location: Nottingham, UK
Contact:

Post 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.
Phil Hibbs | Capgemini
Technical Consultant
pbttbis
Premium Member
Premium Member
Posts: 36
Joined: Thu Dec 11, 2014 3:30 am
Location: South Africa
Contact:

Re: Parallel Routine

Post 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...
PBT TBIS Consultant
Post Reply