Help to find length of string avoiding trailing spaces

Hi,
I have a record of length 200 bytes and values filled is only 100 bytes and remaining 100 spaces is occupied by spaces. In script wen i try to find the length of the entire record it should get as 200 not 100. i tried using length and wc -c but it doesnt work can anyone have any idea on this???
Tis was the code i tried:-

cat RPCSFILE.txt | grep '^D' | while read LINE
do
expr length '$LINE' | read LEN
if [$LEN -ne 200]; then 
echo "Incorrect line"
fi
done

What about using awk..?

awk 'length($0) < 200' file

In shell to preserve spaces, unset IFS, for example:

while IFS= read LINE 

Depending on your type of input, you may also need to switch off backslash interpretation with the -r option:

while IFS= read -r LINE
awk '/^D/ && length<200' RPCSFILE.txt