Reading last line of a CSV file

Hi
I have a file which I am reading line by line and processing it.
But the last line is not getting read in the file loop until I put an enter in the end.

#!/bin/ksh -p
v_org_id=${P1}
FILE=${P2}
NEW_FILE_NAME=$APPLPTMP/b1.txt
BAKIFS=$IFS
IFS=$'\n'
exec 0<"$FILE"
echo "File to be processed.....: ${FILE}"  
while read -r line
do
v_initial=`echo "$line" |cut -d'|' -f1-3`
echo "v_initial.....: ${v_initial}"
v_last_name=`echo "$line" |cut -d'|' -f4`
v_first_name=`echo "$line" |cut -d'|' -f5`
OUTPUT=`sqlplus -s ${LOGIN} <<EOF
set pages 0 lines 120 trimout on trimspool on tab off echo off verify off feed off serverout on
var mavar varchar2(100);
Emp_first_name('${v_first_name}') 
into :mavar from dual;

echo"$v_initial"'|'""$OUTPUT"'|'">> $NEW_FILE_NAME
done
print mavar;
exit;
EOF`


What do you mean by 'put an enter in the end'? Of the file? Yes, if the line doesn't end in a newline, it's not going to work right.

You can append a newline before reading the entire file, ignoring blank lines. This should handle both cases.

Your programming tells why:

IFS=$'\n'

You are writing a program, telling how each line (record/field) is separated.