while read linea
do
#echo "Archivos Entrada: $linea"
largo=`awk '{print length($linea)}'`
echo "largo : $largo "
if [ $largo == 171 ]; then #Here's the problem, I take this line and it works
echo "a es igual a 1"
fi
done < ${PATH_DAT}/$ArchPro #while read linea
$linea is not substituted because it is within 'ticks'.
And awk wants to read from stdin.
As a result $largo is empty, leading to your second problem (that should say error in [ ]).
An improvement is