Let $E$ be a rank $n$ locally free sheaf on a smooth $n$ dimensional variety $X$, and $s\in H^0(X,E)$. If $\dim Z(s)=0$ (which is the expected dimension), then we can understand the cohomology class of $Z(s)$ as a chern class of $E$. Can anything be said about this class if $\dim Z(s)>0$?

Not much can be said. For instance, let $X = \mathbb{P}^n$ and $E = \mathcal{O}(1)^{\oplus n}$. Then the zero locus of a section might be any linear subspace in $X$. In particular, its cohomology class is $H^k$, where $H$ is the hyperplane class and $k$ may be any integer in the range $0 \le k \le n$.

1more comment