Script to compare lines

I need a simple script to parse a file with this data in it and have that script output a warning when CurrCapacity is more that 50% of MaxCapacity for a given pool Name, can anyone help ?

    CurrCapacity: 5
    MaxCapacity: 20
    Name: fhlwDSource
    CurrCapacity: 5
    MaxCapacity: 20
    Name: repositoryDSource

start with this:

#!/bin/ksh
while read fld1 fld2  dummy
do
	if [[ "$fld1" = "CurrCapacity:" ]] ; then
		   cur="$fld2"
	fi
	if [[ "$fld1" = "MaxCapacity:" ]] ; then
		   max="$fld2"
	fi
	if [[ "$fld1" = "Name:" ]] ; then
		   result=$(( ( $cur * 100 ) / $max ))
		   if [[ $result -gt 50 ]] ; then
				echo "$fld2 is bad $result percent"
		   else
				echo "$fld2 is okay at $result percent"
		   fi
	fi
done < filename

Thanks for the reply but I keep getting this error when I run it ?

syntax error: `result$=' unexpected

init0,

looks to me that you have a typo if you get a syntax error 'result$=' the script assigns a value to 'result' not 'result$'. Check your typing of the script and try again. Looks to me like it should work, I had a similar script in mind but jim beat me to it.