actually i post about this issue before but many folkz miss-understood with my quesion,
We are checking for the delimited file records validation
Delimited file will have data like this:
Aaaa|sdfhxfgh|sdgjhxfgjh|sdgjsdg|sgdjsg|
Aaaa|sdfhxfgh|sdgjhxfgjh|sdgjsdg|sgdjsg|
Aaaa|sdfhxfgh|sdgjhxfgjh|sdgjsdg|sgdjsg|
So we are checking for where the files of records we got is having validating length or not
NOTE:the structer of the file will be present in the teradata db,we will fetch the structer of the file then we will validate
in the teradata configured table we wil get details about
column name,oder number will be order of column in tht table�.it will be 1 2 3�.like tht,length of the column
for ex. if we are checking for file of 3 columns then in the table we wil hav 3 columns of size varchar(5),so now every feild in the file should have lenght <=5,
script which i wrote:
#------------------------------------------
# Reading through the file and checking for the column length
#----------------------------------------------------
logNote "Reading through the temp file and and checking for the column length"
while read col_nm col_order_num col_len
do
typeset -i col_len
typeset -i col_len_good
col_len_good=`expr $col_len + 1`
logNote "col_nm : $col_nm"
logNote "col_order_num : $col_order_num"
logNote "col_len : $col_len"
logNote "col_len_good : $col_len_good"
awk 'BEGIN{col_ord='$col_order_num';col_l='$col_len'}{FS="|"}{if (length($col_ord) > col_l) print $0;}' $Src_File >> $Src_File.bad
awk 'BEGIN{col_ord='$col_order_num';col_l='$col_len_good'}{FS="|"}{if (length($col_ord) < col_l) print $0;}' $Src_File > $Src_File.temp
rm -f $Src_File
mv $Src_File.temp $Src_File
done <$RPT_FILE
==============================================================
In the script col_nm, col_order_num ,col_len we will fetch from table
col_nm =column name
col_order_num =oder number will be order of column in tht table�.it will be 1 2 3�.like tht
col_len=length of the column
its working fine bi=ut we had performance issue.
can any come up with some better solution
mostly using with awk,awk array might be easy i guess
thankz in advance
[/FONT][/FONT][/FONT][/FONT]