Server routine in a parallel job with a Basic transformer?

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

ady
Premium Member
Premium Member
Posts: 189
Joined: Thu Oct 12, 2006 12:08 am

Post by ady »

I got the source as varchar, trimmed and specified the routine and i specified the output format as "CHAR". This did not work.

Could there be any other problem?... plz help
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Ok. Lets take a step back. Build a simple routine and call it from within a basic transformer in a px job.

Code: Select all

Ans = EREPLACE(Arg1, "AAA", "xxx")
Build a text file with a few records that have AAA at different places. Run the px job. See if all instances of 'AAA' get replaced with 'xxx'
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ady
Premium Member
Premium Member
Posts: 189
Joined: Thu Oct 12, 2006 12:08 am

Post by ady »

@DSguru

I created a routine like u said and it works in a PX job... I really dont understand why the original dosent work ??

DSguru , you said that you posted a routine dealing with ascii values ..... can you point me to it ?
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Here'sthe post I was referring to. Feel free to tweak it to fit your needs.
For a final shot, recreate your original routine. Re-compile it and see if it works. There is nothing wrong with it, apparantly.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

The following should work for you. Its your BASIC routine translated in C.

Code: Select all

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

char* myStripChar(char *str)
{ //Declare Variables
  const int size = 1000;
  char ch;
  char* ret = (char *)malloc (size); 
  int ascii, i;
  i = 0;
  ascii = 0;

  while (*str) //for the complete input string
  {
       ch = *str++;
       ascii = ch;
	   if ((ascii >= 32) && (ascii <= 122) && (ascii != 91) && (ascii != 93) && (ascii != 94))
	   {
		   strcpy(&ret[i++], &ch);
	   }
	   
   }
   ret[i] = '\0'; //Terminate the string
   

   return ret;

}
Last edited by DSguru2B on Fri Mar 02, 2007 10:42 am, edited 1 time in total.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ady
Premium Member
Premium Member
Posts: 189
Joined: Thu Oct 12, 2006 12:08 am

Post by ady »

Thanx a ton.. DSguru, we are currently working on the issue .. I will try and let you know if anything works.
Post Reply