Page 2 of 2
Posted: Fri Mar 02, 2007 8:29 am
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
Posted: Fri Mar 02, 2007 8:47 am
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'
Posted: Fri Mar 02, 2007 9:23 am
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 ?
Posted: Fri Mar 02, 2007 9:39 am
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.
Posted: Fri Mar 02, 2007 10:32 am
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;
}
Posted: Fri Mar 02, 2007 10:35 am
by ady
Thanx a ton.. DSguru, we are currently working on the issue .. I will try and let you know if anything works.