Scenario with Sequential file for the Reject/Load selection

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
vamsi2508
Participant
Posts: 10
Joined: Sun Apr 24, 2011 6:24 am

Scenario with Sequential file for the Reject/Load selection

Post by vamsi2508 »

hi friends,

Here is a problem i am currently facing in my module.

I am reading a file using a sequential file stage. The column in the file is of Char data type.

It contains records with
single character - for ex : A

double characters - for ex : AA

more than two : for ex : AABBCCC

the requirement is if the record in the column is having one character, then it should get loaded. if the record is of more than one character, i must go to the reject file.

have a look at the following data, for clear picture of the scenario:

Sample_column (datatype:char)
Y -------------------------------------------SHOULD GO TO THE TARGET
YK -----------------------------------------SHOULD GOT TO THE REJECT
YT-----------------------------------------REJECT
C-----------------------------------------LOAD
CB---------------------------------------REJECT
CCN--------------------------------------REJECT
KJ--------------------------------------REJECT
K -----------------------------------------LOAD
LL--------------------------------------REJECT

Kindly help me..Thanks alot for your time and patient reading of my issue.
Vamsi Karthik
Consultant/DWBI
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Define the field as Char(1) on the input link metadata.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
peddakkagari
Participant
Posts: 26
Joined: Thu Aug 12, 2010 12:07 am

Post by peddakkagari »

Create stage variable by using length function

If Len(input_column)=1 then Y else N

then put the stagevariable=Y for target and N for reject

Thanks,
Sreekanth
vamsi2508
Participant
Posts: 10
Joined: Sun Apr 24, 2011 6:24 am

Post by vamsi2508 »

Thank you very much sir..

But i need to send the records with more than one character to the reject AT THE SOURCE LEVEL IT SELF. Not after any transformations. Hope i am clear..

At the source level itself, while reading ,if the sequential file stage encounter a record with more than one column, immediately that record should go to the source level reject.

Even if i define the metadata to be Char(1) , the for each record it takes the first character and loads..if wont mind how many characters are there..
Vamsi Karthik
Consultant/DWBI
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Define a second field consisting of VarChar data type.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
singhald
Participant
Posts: 180
Joined: Tue Aug 23, 2005 2:50 am
Location: Bangalore
Contact:

Post by singhald »

add neviorment variable $APT_IMPORT_REJECT_STRING_FIELD_OVERRUNS and mark it to YES

which will reject the input records from sequential stage if any field value length exceed to defined varchar.
Regards,
Deepak Singhal
Everything is okay in the end. If it's not okay, then it's not the end.
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Post by SURA »

These type of rejects may give warnings. In some projects they may not allow warnings.

Keep it in mind.


DS User
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Define a second field consisting of VarChar data type.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vamsi2508
Participant
Posts: 10
Joined: Sun Apr 24, 2011 6:24 am

Post by vamsi2508 »

can you please elaborate sir ? On what exactly the meaning/implementation of Define a second field consisting of VarChar data type and how it is going to help me achieve the requirement. Thank you..
Vamsi Karthik
Consultant/DWBI
Post Reply