verify file format before run

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
samp
Participant
Posts: 25
Joined: Thu Nov 06, 2003 4:34 am

verify file format before run

Post by samp »

Hi,

i would like to test if my sequential file in source (csv separated ;) is good before run job.

i explain.

i would like to check if all my columns have got datas.
my goal is to isolate if it is possible the bad line (ex: wrong date) before running the job in order to eliminate the potential abort of the job.

and i would like to isolate the bad lines.

should i read my csv as one column and separate in a transformer in n columns and test them one by one?

or

is there an an option in the sequential witch can tell me if the file is corrupted or not?
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Re: verify file format before run

Post by gateleys »

Most of the file format checking is something I do via a routine. Only when the routine reports no exception do I go ahead.

However, you may try this sequence of steps -

1. Read them as a single column.
2. Exclude non-numeric columns that may contain commas (if file is comma-delimited) by checking if the commas are contained within a pair of quotes. This way you get the actual number of delimiters (here, comma).
3. In the Xfmr, check if the delimiter count (obtained in step 2) = expected num of cols - 1. If not, report as exception.
4. In the Xfmr, split the row into columns.
5. Regarding dates, I think you meant wrongly "formatted" date, and not "wrong date". I expect to get my dates in D4/YMD format, and hence, perform to check if they satisfy the condition, else raise an exception.
gateleys
Post Reply