How to do the flat file validation for the below requirements by using ssis? Can some one please help me out by using script task or any other task?
My flat file has header, Trailer and Data.
1) If I have more than one header or trailer then i have to send an email with message as "More than one header or Trailer". Here is example of header and trailer format below.Header record always starts with 10 and trailer record always starts with 90.
102011061518051501
9000000000090000000007
3) If i don't have header or trailer record in my flat file then i have send an email with message "No header or Trailer record."
4) If i don't have detail records then i have to send an email. Here is example of Data format below.It always starts with 20. Here is the example of detail record.
2001137442136 I82980878
5) If i don't have flat file in the directory (C:\) then i have to send an email.
6) If the number of records value in the trailer doesn't match with the Trailer + Header + Detail record then i have send an email with message as "Mismatch in Total record count". Here is the flat file data below.First row is header and last record is trailer and middle of them are detail records. Here is the number of records in the flat file is 9 and in the trailer record you can see the 9 at 12th position.
102011061518051501
2001137442136 I82980878
2001999999998 D82980878
2002446524046 D82980878
2003560811205 D82980878
2001060938579 A82980878
2001860493988 D
2001640430969 D82980878
9000000000090000000007
7) If there is a mismatch in the detail record count then i have to send an email as "Mismatch in the detail record count". we can find the detail record count in the trailer i.e;7 at the last position in the trailer record.
9000000000090000000007