  It is well-known that the existence of more than two ends in the sense of
J.R. Stallings for a finitely generated discrete group $G$ can be detected on
the cohomology group $\mathrm{H}^1(G,R[G])$, where $R$ is either a finite
field, the ring of integers or the field of rational numbers. It will be shown
(cf. Theorem A*) that for a compactly generated totally disconnected locally
compact group $G$ the same information about the number of ends of $G$ in the
sense of H. Abels can be provided by $\mathrm{dH}^1(G,\mathrm{Bi}(G))$, where
$\mathrm{Bi}(G)$ is the rational discrete standard bimodule of $G$, and
$\mathrm{dH}^\bullet(G,\_)$ denotes rational discrete cohomology as introduced
in [6].
  As a consequence one has that the class of fundamental groups of a finite
graph of profinite groups coincides with the class of compactly presented
totally disconnected locally compact groups of rational discrete cohomological
dimension at most 1 (cf. Theorem B).
