Long story short... everyone wants programmers that are young and want to change the world. When you're over 40, that doesn't go well, however that doesn't mean you have to get out of tech, just shift you're focus like I did :)
I became a security analyst. It's a way easier (though be it, less exciting) gig than being a programmer. Also being a programmer gave me a boost in a bunch of the domains (CISSP talk there) that cover the profession.
A bunch of other people I know have moved to other areas like:
Database Administrator, Network Administrator, System Administrator, Quality Assurance Analyst
Point is, you have WAAAAAAAAY more talents in those bones of your than you are willing to give yourself credit for... Don't give up yet!!!