How to capture the file name and row number

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
syam
Participant
Posts: 10
Joined: Wed Nov 29, 2006 5:03 am

How to capture the file name and row number

Post by syam »

Hi All;

I am using the file pattern to read the source files.And during the rejection process i want to capture the row number and the file name into the error log table so that user can know which record is rejected and from which file in the file pattern is it rejected.
Thanks in advance

Thanks;
Syam.
SHYAM
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Not possible.

The reject link gets rows that do not match the defined metadata. You get the input row as a raw string, in one column. This is not negotiable.

There is a workaround, which is to read the file as a single VarChar column and parse it yourself in a Transformer stage. The Sequential File stage can add a File Name column. You could use a Filter command or stage variables to detemine the line number within the file. You may need to partition on File Name for the stage variable approach to work.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

You can include RowNumberColumn in addition to FileNameColumn.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Can't the business go off of a key column in the record? If not then add a running number to your file pre-hand before processing.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Hi Mister Hasty. If the OP is using File Pattern this implies sequential files and this implies no key.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Agreed Ray ji. Hence, pre-process to attach a running number.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Wont it be simple to find the file name and row num directly using RowNumberColumn in addition to FileNameColumn rather than, Pre processing all the files and find the file names back with the help of running nubmer. :roll:
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Yes it would be. But as we are all in the mode of suggestions, I threw my poll ticket in as well.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply