The funniest interview I had was with some blonde girl in her twenties, who read through my CV and said: "Oh, you see. We cannot send your application to our client. You see, here I have hundred of applications from people at your age, who are managers in their thirties, and you are not. There is most probably something wrong with you." And it was a position for a programmer, not a manager.
And it was when I was in my early thirties, not forties.
Currently, I'm almost 40, and I seek only for remote work (family issues). I have been paid for programming for the last 14 years. I had different jobs like sysadmin, dba, programmer; using over 10 different languages.
And despite all that searching for work is really hard. Usually, it stops at the recruiter who is only interested in an answer to "how much do you want to get?". After that, there is no counter offer, no negotiation, nothing. Sometimes there is an answer like "you want too much, but don't negotiate at this recruitment step".
When I get to the technical part of the interview, I usually get some Yeti-Level programs to write. Yeti-Level, because you are not going to write anything like that in those time restrictions in that jobs. A good example is implementing a program which gets input from a file, in the input, there are domino tiles, and a function needs to match them and find the longest chain... all must be super optimized from the beginning. And you have 5-10 minutes to do everything, including reading the task description, examples and writing tests.
The funny fact is that this company is searching for candidates for months. The sad fact is that due to such strange recruitment process, good old experienced programmers will starve.
I really think that I did very bad choice with my career. There are so many other jobs where people are not removed because of age, and experience is really appreciated. In IT you just need to accept that companies want young inexperienced kids, who want to get little figures, but a game room is a must.