Capture Reject Rows

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
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Capture Reject Rows

Post by arunkumarmm »

Hi,

I have a simple job, XML as source and sequential file as target with a transformer in between. Now, due to some extrodinary situations, the source records may have values more than the length assigned in the target stage. This is very rare but can occur. My requirement is to capture those records into a separate file as rejected records.

I created another link from the transformer and defined the constrain as MainLink.REJECTED but no rows are beeing passed on to this. Any thoughts? Or is there anyother way to achieve this?
Arun
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

They won't be rejected but simply truncated. You'll need to check the field sizes yourself and use an explicit constraint to move them down your 'reject' link.
-craig

"You can never have too many knives" -- Logan Nine Fingers
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post by arunkumarmm »

chulett wrote:They won't be rejected but simply truncated. You'll need to check the field sizes yourself and use an explicit constraint to move them down your 'reject' link.
Thanks Craig. But I have 2000+ columns and not sure on which columns will be affected. Should I need to include all the columns in the constrain and check? There is no other way to achieve this?
Arun
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

If that's your requirement, yes. One other 'trick' you can try is to increase the size of the fields defined in the job so they are larger than your target field sizes which would allow those 'oversized' values to actually be sent to your database. It should then do an actual physical reject of the row and then you can capture it as you intended originally. Worth a shot, I suppose. Try a test on a single field and value first before you go all crazy on the 2000+ columns you have.

Keep in mind the fact that it will also generate a warning and enough of them will fail the job.
-craig

"You can never have too many knives" -- Logan Nine Fingers
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post by arunkumarmm »

chulett wrote:If that's your requirement, yes. One other 'trick' you can try is to increase the size of the fields defined in the job so they are larger than your target field sizes which would allow those 'oversized' values to actually be sent to your database. It should then do an actual physical reject of the row and then you can capture it as you intended originally. Worth a shot, I suppose. Try a test on a single field and value first before you go all crazy on the 2000+ columns you have.

Keep in mind the fact that it will also generate a warning and enough of them will fail the job.
Thanks Craig. I will try this and let you know.
Arun
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post by arunkumarmm »

Any thoughts on using a ODBC stage to write the target file?
Arun
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Sorry but my second suggestion isn't valid for your target type. There's nothing in the nature of a sequential file that would cause rejects, I lost track of that and thought we were talking about a database table.

Now, you could use a database table as an intermediate staging point, a work table in other words and allow it to do the rejecting for you. Afterwards, source any survivors from the work table and then write them out to your flat file.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

arunkumarmm wrote:Any thoughts on using a ODBC stage to write the target file?
Using the text drivers? No clue how well that would work but might be worth experimenting with. If you give that a try, let us know. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post by arunkumarmm »

chulett wrote:
arunkumarmm wrote:Any thoughts on using a ODBC stage to write the target file?
Using the text drivers? No clue how well that would work but might be worth experimenting with. If you give that a try, let us know. :wink:
I'm trying on that. Will let you know.
Arun
Post Reply