Validate no of rows in source and footer

How do you validate the no of rows received in source with footer(count) and if both count matches then only it should load to target?

Questions by sureshgut

Showing Answers 1 - 3 of 3 Answers

Saurabh

  • Feb 23rd, 2013
 

I am assuming the source ia a flat file with no header record but footer record for count. You can have a set of unix command in a unix script and execute the script from pre-session command. Check the Fail task if any tasks fails in the properties tab of pre-session command.

Data in test_file.txt
Record1
Record2
Record3
Record4
Record5
5

Script:
record_count=`sed /^$/d test_file.txt | sed $d | wc -l`
footer_count=`sed /^$/d test_file.txt | sed -n $p`
if [[ $record_count -eq $footer_count ]];
then exit 0
else exit 1
fi

  Was this answer useful?  Yes

saurav

  • Apr 3rd, 2013
 

You can utilize the MD5 hash functionality within the mapping

  Was this answer useful?  Yes

vijay

  • Jan 6th, 2014
 

Design a mapping with 2 flow.1 to load the data into target with all necessary columns.2nd target will have only count information and set a target load plan as said above.In the session level. Set the output files to have both targets with same name.And in the properties set the option to merge/append the files if they alreay exists.This would work out..

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions