Age on a C.V?! Who does that. No one.. (and you shouldn't. Employers can't ask if you are married or your number of kids either. That can get you sued in many places).
We have a lot of older people where I work, some hired in. The trouble is we also get a lot of people who come through who've been in the same shop for 20 years and they think they know what they're doing, but when you ask them an SQL question they use a sequence of nested queries without any join statements. We get sysadmin who don't know how to map a network drive on the command line. We get people who want security jobs who can't answer, "What's the difference between a GET and a POST request?"
Another issue is that maybe shops are only looking to employ 40+ people in management positions, being team leads and architects. Maybe you hate that stuff and are looking for dev jobs and people are reluctant to hire you for that. The problem here lies in that most IT departments only have a pathway up the chain via management. For a lot of devs and admins, this isn't too bad and they can manage people fine. But there are those that really don't want to manage people, who hate it and there isn't really a pathway for people who just want to stay coding.
Finally, it could be that you're applying to all the wrong places where people do look down upon your for your age. They are probably shitty shops you didn't want to work for anyway. Are you willing to move? If not, you could also try short term contracts (3 ~ 8 months). There are a tons of those if you're willing to be away for a couple of months each year. You can also build up remote contracting opportunities this way too.
So to recap, you might be stuck in a city of discriminatory employers and it's not you, or you're looking for dev positions because that's what you love but people want your age group for management or