Page 2 of 2
Posted: Fri Feb 09, 2007 3:34 pm
by DSguru2B
Did you make this particular column with that humongous derivation a nullable column? Another point, nulls arent really populated in a flat file. You will just see an empty value.
Posted: Fri Feb 09, 2007 3:51 pm
by ray.wurlod
Nulls are populated in a flat file with whatever you specify as the Null Field Value property.
Posted: Fri Feb 09, 2007 3:58 pm
by ray.wurlod
vick wrote:Thanks a ton Ray!
I plugged in your code and concatenated with "V-" and it works great except for 5 & 6. (Values after ----------------> are the results)
Code: Select all
1. "3.5 L V6 24-Valve DOHC" ---------------------> V-6
2. "3.8 L V-6 24-Valve DOHC" ---------------------> V-6
3. "4.6 L V8 w/4 valve per CYL" -------------------> V-8
4. "5.5 L 32-Valve Aluminum V-12"----------------> V-12
5. "5.9 L V-12 32-Valve Aluminum"----------------> V-
6. "3.9 L V6 32-Valve Aluminum"------------------> V-
7. "AMG 5,439-cc 24-Valve Supercharged"-------> Null
How do you account for when the data is similar to 5 & 6 (When V6 or V-12 comes in before the word "Valve")
Any suugestions?
TIA
Try replacing the constant in the pattern ("V") with " V".
Code: Select all
If InLink.Product Matches "0X' V'1N0N0X" Then MatchField(InLink.Product, "0X' V'0N0X", 3) Else If InLink.Product Matches "0X' V-'1N0N0X" Then MatchField(InLink.Product, "0X' V-'0N0X", 3) Else @NULL
Posted: Mon Feb 12, 2007 9:15 am
by vick
Hey folks
My team lead has decided not to go with BASIC Tfr as he needs this to be a pristine DS-EE environment.
Looks like I need to develop a C-routine for this purpose.
Any suggestions, samples, pointers on developing a C-routine.
TIA
Posted: Mon Feb 12, 2007 9:18 am
by DSguru2B
Use strstr() C funtion to locate your string and then do substrings or you can use sscanf() to get the literal you require.
Posted: Mon Feb 12, 2007 11:24 am
by DSguru2B
Give it your best shot, post your code here and then we can go from there. Its not that hard.
Posted: Mon Feb 12, 2007 3:14 pm
by ray.wurlod
vick wrote:My team lead has decided not to go with BASIC Tfr as he needs this to be a pristine DS-EE environment.
Thinking of a word that rhymes with "anchor" but isn't "banker".
The DS-EE environment includes the BASIC Transformer stage. Therefore including such a stage does not in any way detract from your environment being pristine.
What we have with the BASIC Transformer stage is a tool that can do the job and which is part of the toolset. Now there's a requirement to develop in a language with which no-one on the team is familiar.
What's wrong with this picture?
Posted: Tue Feb 13, 2007 9:07 am
by vick
Hello folks
I was wondering if there is C-routine sample that somebody could pass across. I searched for it but could'nt find what I need.
It would be of great help to me as I will learn to code in a new language.
TIA
vick
Posted: Tue Feb 13, 2007 10:29 am
by DSguru2B
Well, its kind of hard to teach you a new language just through description. You have to go through language syntax, create your first program "Hello World", go through some functions etc etc etc.
Ill give you a piece of code, you can go through it, google up the functions, see what they do.
Code: Select all
//header files
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//Main Function
char* GetEngineInfo(char* inp)
{ //Declare Variables
const int SIZE = 100;
char* out = (char *)malloc (SIZE);
char* x = (char *)malloc (SIZE);
char* p = (char *)malloc (SIZE);
int i = 0;
//Check if input is empty
if (strlen(inp) < 1)
return NULL;
//Strip out the literal "Valve"
x = strstr(inp, "Valve");
if(x)
strncpy(x, " ",5);
//Look for character "V". If not found then search for "V-"
p = strstr(inp, "V");
if(!p)
p = strstr(inp, "V-");
//If either "V" or "V-" are found get everything untill you hit space
if(p)
{
while(strncmp(p, " ", 1) != 0 )
{
out[i++]=*p++;
}
out[i] = '\0'; //terminate string
}
//Return NULL if not found
else
{
strcpy(out,NULL);
}
return out;
}
The description for each and every function used in the code above can be googled up. C has been around for ages and hence a lot of information present on the web.
Posted: Tue Feb 13, 2007 11:06 am
by vick
Thanks a bunch DSguru2B. Appreciate all your help. I will try and let know.
Thanks once again
V
Posted: Tue Feb 13, 2007 11:14 am
by swades
Hi,
Is there any documents available for C-Guide( by IBM) like Basic Guide is available under "Ascential\DataStage751\Client\Docs"
Thanks
Posted: Tue Feb 13, 2007 11:17 am
by DSguru2B
Not that I know off. One of the primary reason being that C is widely used and has been around for many years and hence a lot of reference material can be found online.