I am studying old chess games and want to be able to select certain openings. Is there any logic behind the ECO codes, or do you simply have to learn them all by heart?
Yes and no. The first letters are assigned based on certain criteria, after that it's pretty much memorizing the range of codes that cover a particular opening.
More logical schemes here Opening Names not ECO-friendly.
The ECO codes were a product of much thought and research. The logic behind them was somewhat based upon the fashions at the time of its design, but generally speaking it works pretty well.
A - includes all openings besides 1 e4 and 1 d4, but also certain openings after 1 d4, like the Benoni, Dutch, Trompowsky, and Budapest.
B - includes all semi-open games except the French, including Scandinavian, Alekhine, Modern/Pirc, Caro-Kann, and mostly the Sicilian.
C - includes the French, and mostly all 1 e4 e5 defenses.
D - includes all 1 d4 d5 openings, mostly Queen's Gambit, and the Grunfeld.
E - includes Catalan, Blumenfeld, Queen's Indian, Nimzoindian, and mostly the King's Indian.
The logic generally is that the further you go in a certain letter, the more specific and 'main line' the opening is.
For example, the Sicilian begins at B20 or 21 and you'd find moves such as
e4-c5a3 or b4 or Na3
in the first chapter and the Najdorf, arguably the absolute main line of the Sicilian, between B90 and B99.
You'd find opening moves such as 1. c3 in A00 (if it is included at all :) ). Of course, it would be somewhat silly to state that 1. d4 is more mainline than 1. e4, or 1. d4-Nf6 is more mainline than 1. d4-d5, so it is best if we don't think about why the five volumes are ordered in the way they are ordered. A is for 'flank openings' B and C for e4, D and E for d4, and that's the way it is.
Of course, what is absolute main line is not set in stone. For example I think Black doesn't like C99 (mainline Chigorin defence to the Ruy Lopez) very much nowadays and instead prefers the Breyer variation (C95?).
There's a book that cross references the ECO codes to the traditional `names'. Sorry I don't have it handy, but it's exactly what you could use. Also, if you can afford them, try to purchase a traditional opening book, such as NCO, Nunns Chess Openings, and also at least the one volume eco book by Informant. The complete set of Encyclopedias are awesome, but a little pricy.
I have downloaded the TWICfiles app, which I find quite useful at the moment. Perhaps I'll look into one of the books later on. Thx.