FIELD FUNCTION

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
MARKO970
Participant
Posts: 20
Joined: Thu Nov 13, 2003 5:46 am

FIELD FUNCTION

Post by MARKO970 »

HI ALL.

i' ve still a problem with special characters.
i cannot use some function with parallel xe and i'm looking for
the best performance way to retrieve special char from a srting.

someone knows if there is a function that retrieve more of one spec char
from a srting???? ex: ("MARK&O AND % SO*N")
CAN I EXTRACT ALL THE SPEC CHAR IN THIS STRING WITH A SINGLE FUNCTION????

can i use the field function???

thanks all for help!
1stpoint
Participant
Posts: 165
Joined: Thu Nov 13, 2003 2:10 pm
Contact:

Post by 1stpoint »

Do you want to extract or replace??
You may want to do an ereplace instead of a field..
Just an idea.
MARKO970
Participant
Posts: 20
Joined: Thu Nov 13, 2003 5:46 am

Post by MARKO970 »

hi 1st,

i need to reject the rows if a field contain some special characters
so now i'm using COUNT or INDEX to know if the string contain a specific char(if return of these functions is 0, i know that the string is right...)
but so i have to process only one character at time ... if i have to control
10 character i have to do 10 controls ... there's a best function ???

p.s.
do you know how can i use IsValid function , there's an example someway ???

thanks for help...
1stpoint
Participant
Posts: 165
Joined: Thu Nov 13, 2003 2:10 pm
Contact:

Custom Function

Post by 1stpoint »

You can write your own custom function that would look something like this (the code below returns 1 if all characters are non-alpha chars:

Code: Select all

*IsValidString(Arg1)
Str=Upcase(ereplace(Arg1,' ',''))
Ans = 1
for i = 1 to len(Str)
    If (Str[i,1] < 'A' or Str[i,1] > 'Z') or
       (Str[i,1] < '0' or Str[i,1] > '9')  Then 
      Ans = 0 
      goto Done
    End
Next i
Done:
Teej
Participant
Posts: 677
Joined: Fri Aug 08, 2003 9:26 am
Location: USA

Post by Teej »

Unfortunately, this type of behavior have to be coded in. There is no equivalent standard function in C/C++ that does this task. The closest is strpbrk() which find the first appearance of any provided characters in a string.

If you wish to do it all within one function, you will definitely need to create a buildOP stage that does this task within a while loop for every row of data. Do a search on this forum for BuildOP or BuildOPS and you will get a number of guides that will help you get up to speed on this concept.

I do not see any equivalent transform function that does anything close to what you need to be done.

-T.J.
Developer of DataStage Parallel Engine (Orchestrate).
MARKO970
Participant
Posts: 20
Joined: Thu Nov 13, 2003 5:46 am

Post by MARKO970 »

THANKS FOR HELP, NOW I TRY TO USE THE BUILOP (PRAY FOR ME ....)...
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You could upgrade to version 7, and get the BASIC Transformer stage.
8)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Teej
Participant
Posts: 677
Joined: Fri Aug 08, 2003 9:26 am
Location: USA

Post by Teej »

ray.wurlod wrote:You could upgrade to version 7, and get the BASIC Transformer stage.
8)
Sssh! The One must journey on the tough path for a while. 8)

-T.J.
Developer of DataStage Parallel Engine (Orchestrate).
Post Reply