DSXchange: DataStage and IBM Websphere Data Integration Forum
View next topic
View previous topic
Add To Favorites
This topic has been marked "Resolved."
Author Message
timsmith_s
Participant



Joined: 13 Nov 2005
Posts: 54

Points: 372

Post Posted: Mon Feb 26, 2007 8:38 pm Reply with quote    Back to top    

DataStage® Release: 7x
Job Type: Parallel
OS: Unix
I have read posts regarding regular expression in filters, but would anyone please help with understand if the Modify or Transformer stages support them too? Can they be used for parsing values, or only to exclude records?

Thx - T
ray.wurlod

Premium Poster
Participant

Group memberships:
Premium Members, Inner Circle, Australia Usergroup, Server to Parallel Transition Group

Joined: 23 Oct 2002
Posts: 54072
Location: Sydney, Australia
Points: 293282

Post Posted: Mon Feb 26, 2007 9:58 pm Reply with quote    Back to top    

The answer to your first question is NO, which makes your second question moot. A Filter stage uses something like regular expressions in its WHERE clause, but does not support the full gamut of ...

_________________
RXP Services Ltd
Melbourne | Canberra | Sydney | Hong Kong | Hobart | Brisbane
currently hiring: Canberra, Sydney and Melbourne
Rate this response:  
Not yet rated
kumar_s

Premium Poster


since February 2006

Group memberships:
Premium Members, Heartland Usergroup

Joined: 16 Jun 2005
Posts: 5240

Points: 26349

Post Posted: Tue Feb 27, 2007 12:58 am Reply with quote    Back to top    

External Filter stage can be leverage more for this purpose.

_________________
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Rate this response:  
Not yet rated
jhmckeever



Group memberships:
Premium Members

Joined: 14 Jul 2005
Posts: 297
Location: Melbourne, Australia
Points: 3043

Post Posted: Tue Feb 27, 2007 3:17 am Reply with quote    Back to top    

It is possible to use regular expressions in parallel transformers, but only after you've done all the hard work yourself...

You can define a Parallel Transformer by creating a C function using the <regex.h> library. We're using this at the moment and it works well. It provides full regular expression support in parallel transformers and performance is pretty good too. You can get extended expression support using the REG_EXTENDED flag.

Let me know if you require further details. If you want a place to start, lookup the 'regcomp' and 'regexec' functions in the library.

J.

_________________
John McKeever
Data Migrators
MettleCI - DevOps for DataStage
Rate this response:  
Not yet rated
kumar_s

Premium Poster


since February 2006

Group memberships:
Premium Members, Heartland Usergroup

Joined: 16 Jun 2005
Posts: 5240

Points: 26349

Post Posted: Tue Feb 27, 2007 5:01 am Reply with quote    Back to top    

jhmckeever, you mean you have created a BuildOps?

_________________
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Rate this response:  
Not yet rated
jhmckeever



Group memberships:
Premium Members

Joined: 14 Jul 2005
Posts: 297
Location: Melbourne, Australia
Points: 3043

Post Posted: Tue Feb 27, 2007 6:11 am Reply with quote    Back to top    

DOH! Sorry - That post was typed Pre-Coffee (hence my excuse for a brain wasn't awake).

Nope, I created a Parallel Routine (Not 'parallel transformer'), referencing a function I defined in a custom C library.

By way of payment for my daft error, here's the code ...

Code:
#include <sys/types.h>
#include <regex.h>

int matchRegexp(char *inString, char *inPattern)
{
    int i;
    regex_t re;
    char buf[256];

    i=regcomp(&re, inPattern, REG_EXTENDED|REG_NOSUB);
    if (i != 0) {
        (void)regerror(i,&re,buf,sizeof buf);
        /* printf("%s\n",buf); */
        return(0);             /* report error */
    }
    i = regexec(&re, inString, (size_t) 0, NULL, 0);
    regfree(&re);
    if (i != 0) {
        (void)regerror(i,&re,buf,sizeof buf);
        /* printf("%s\n",buf); */
        return(0);             /* report error */
    }
    return(1);
}


Rgds,
John.

_________________
John McKeever
Data Migrators
MettleCI - DevOps for DataStage
Rate this response:  
timsmith_s
Participant



Joined: 13 Nov 2005
Posts: 54

Points: 372

Post Posted: Tue Feb 27, 2007 9:33 am Reply with quote    Back to top    

Thank you.
Rate this response:  
Not yet rated
kumar_s

Premium Poster


since February 2006

Group memberships:
Premium Members, Heartland Usergroup

Joined: 16 Jun 2005
Posts: 5240

Points: 26349

Post Posted: Tue Feb 27, 2007 4:55 pm Reply with quote    Back to top    

Search for "Editing Multiple Derivations" under transformer section in the Parallel Job Developer's Guide. There is something mentioned for Regular expression. I haven't gone through it fully.

_________________
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Rate this response:  
Not yet rated
Display posts from previous:       

Add To Favorites
View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2002 phpBB Group
Theme & Graphics by Daz :: Portal by Smartor
All times are GMT - 6 Hours