File Validation Logic

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
fabiosantos
Participant
Posts: 4
Joined: Fri Dec 09, 2016 5:36 am

File Validation Logic

Post by fabiosantos »

Hi all,

Can you please help me with the logic for the following requirement

Source - Sequential File


Target1 (Database) - if all rows validate as OK


Target 2 (Sequential File) - if 1 or more rows validate as Non OK

After read a delimited file and validated, if 1 or more rows Non OK, all rows from source file should be moved to a bad file, adding the rejection reason for the bad rows.

The validation includes datatypes, range of values, number of delimiters.

If the all rows be OK, persists all rows in database.

Also, in the end of the process, is required update the file status in database as OK or Failed.

Thanks in Advance
UCDI
Premium Member
Premium Member
Posts: 383
Joined: Mon Mar 21, 2016 2:00 pm

Post by UCDI »

sounds like design more than logic, but I would have my validation "job" append 2 columns (valid true/false, reason (null for valid rows)). Then write that to a dataset. Now flow into job #2 that reads the dataset, sorts off the valid column so that invalid rows are first, and checks the first row. This result will be passed into job #3 which reads the dataset again, and sends all the rows down 1 of your 2 paths by checking the output of job 2 to decide. Something like this...

(this is over-modular, you can do it in 2 jobs with the same concepts if you prefer. My team makes a lot of small, reusable modules so by habit I break things down).
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

It sounds like you will need at least 2 or 3 jobs. What have you tried so far?
At what point are you stuck on?
Choose a job you love, and you will never have to work a day in your life. - Confucius
fabiosantos
Participant
Posts: 4
Joined: Fri Dec 09, 2016 5:36 am

Post by fabiosantos »

Hi UCDI,

How to create a Data Set file? I don't have the data set file yet.
UCDI
Premium Member
Premium Member
Posts: 383
Joined: Mon Mar 21, 2016 2:00 pm

Post by UCDI »

I am on 11.x but I think its been around a while.
Under files in your stages for parallel jobs you should see dataset as an option.

The file type really does not matter too much. You are not even required to land in a file, that is just an example of the logical steps to take. You can aggregate or do a variety of other things to make a binary choice on what path to take though the code.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Datasets? They are a key parallel framework component so they've been around... forever. I wasn't sure what you meant by you "don't have it yet", guessing that you did not mean the actual stage, yes? If you just meant you haven't used one yet, that's a whole 'nuther kettle of fish and easily solved. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply