As an input I have strings like :
"Modem"=X:"49255080","Pkg"=l:0,"Svc"=l:4,"Brch"=L:0,"Reason"=l:0,"CfgDuration"=L:1800,"Duration"=L:1800,"EndTime"=T:1132056185,"UpV"=L:8,"DnV"=L:8,"Ses"=l:7,"Sec"=l:32,"StartTime"=T:1132056185;
So structured like:
key=type:value,key=type:value,... ;
Keys are not always all available and sequence can be different. I need to split this up into seperate fields. I first tried with column-import but because sequence can change, keys can be missing I don't see how I can get this to work.
So next option: I was writing a parallel-routine, but I'm not very good at C.
I have an Oracle-function that does this thing (but that would mean that I first load to a table and then do an extra step to another table, which I would like to avoid)
Oracle function is :
Code: Select all
CREATE OR REPLACE FUNCTION GET_AVL (p_avl VARCHAR2, p_param VARCHAR2) RETURN VARCHAR2 IS
ret VARCHAR2 (4000);
BEGIN
IF INSTR (UPPER (p_avl), '"' || UPPER (p_param) || '"') = 0 THEN
RETURN '';
ELSE
ret := SUBSTR (p_avl,INSTR (UPPER (p_avl), '"' || UPPER (p_param) || '"') + LENGTH (p_param) + 5);
IF INSTR (ret, ',') != 0 THEN
ret := SUBSTR (ret, 1, INSTR (ret, ',')-1);
END IF;
RETURN RTRIM (LTRIM (ret, '"'), '";');
END IF;
END;
Main problem i have is finding a C-version for the INSTR, without writing a recursive function.
So actually 2 questions:
-can anyone help with a C-function that finds the position of string B in string A?
OR
-Do you see any other (high-performant) alternative for this function?
(I know this is a datastage forum not a C-forum, but I think the question fits here)