Filter

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
DS_MJ
Participant
Posts: 157
Joined: Wed Feb 02, 2005 10:00 am

Filter

Post by DS_MJ »

Hello:

Need to separate data by column Id's (COL_ID) into two files.

File 1 should have column id's with length 10 characters

File 2 should have column id's with "everything else."

COL_ID CHAR 18
AX02L7-CAL-110
AX02D7-DOM
ZZZ2D7-DMM-285

Am able to put column id's with length 10 Char to file 1.
using COL_ID[1,10] in transformer

However, in file 2 am NOT able to keep column id's with length 10 Char "OUT" they too get included in this other column Id's file.

Tried using constraint in transformer with
COL_ID <> COL_ID[1,10] or
COL_ID > COL_ID[1,10]

what happens then is that both files output COL_ID with 10 chars.

Code: Select all


Seq File ---> Transform --->COL_ID_with_10Chars
                   |
                   |
                  \/
            Rest_All_COL_ID

Tried using Filter Stage. But the job aborts due to the following errors:

In the Where Clause used COL_ID[1,10] for Link 1 but when I execute the job get the following error:

Parse error: Expected comparison, 'between', or 'like' operator, got: "["
Parse error: Expected boolean operator (and, or) got: "1".

How do I accomplish this...?
Thanks in advance,
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Check with len function and add it as a constraint to the required output file
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
DS_MJ
Participant
Posts: 157
Joined: Wed Feb 02, 2005 10:00 am

Post by DS_MJ »

narasimha wrote:Check with len function and add it as a constraint to the required output file
Thanks narasimha for your quick reply.

Can u elaborate...?
Thanks in advance,
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Post by meena »

Hi DS_MJ,
I think you can write constraint

Code: Select all


[i]Need to separate data by column Id's (COL_ID) into two files. 

File 1 should have column id's with length 10 characters 

File 2 should have column id's with "everything else."[/i]

Code: Select all

LEN(I/P)=10 (FOR FILE 1)
get a reject and keep it in second file(file 2). I am not sure but you can try...

Thank you
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

To follow up

Constraints on the file where you want 10 chars

Code: Select all

len(DSLink3.Key)=10
Constraints on the file where you want more then 10 chars

Code: Select all

len(DSLink3.Key)>10
or like meena said, write constraint for one and capture the reject in the other.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

COL_ID[1,10] will just give you substirng of the first 10 charecters. If you want the based on the length, it has been explined in the previuos post.
If you need the first char in the first link and rest in the second file, then use COL_ID[11,len(COL_ID)] for the second file.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
DS_MJ
Participant
Posts: 157
Joined: Wed Feb 02, 2005 10:00 am

Post by DS_MJ »

Thanks everybody:

Was able to use the Field function with Len function to get the required output.
Thanks in advance,
Post Reply