From Wikipedia:
Logan's Run is a 1976 science fiction film based on the novel of the same name by William F. Nolan and George Clayton Johnson. It depicts a utopian future society in which population and the consumption of resources are managed and maintained in equilibrium by the simple expediency of killing everyone who reaches the age of thirty, thus avoiding the issue of overpopulation. The story follows the actions of Logan 5, a "Sandman," as he "runs" from society's lethal demand.
I saw that movie, I didn’t know the name. You were given colors, green (young), yellow (middle aged), red (report to the auditorium to get killed, only it wasn’t ‘being killed’, it was doing your duty for the benefit of society, some ‘god’)