The 2 character codes are allocated by IATA, the airlines' international trade body. They are used for reservations, timetables, airport arrivals boards, etc. As noted above, the codes are pretty much used up but the addition of numbers in recent years has given more combinations. The memorable codes for the established carriers(eg BA for British AW) are all gone; this leads to eg Air 2000 getting DP.
There are also 3 character codes allocated by ICAO (International Civil Aviation Organisation). These are used for flight planning, ATC, etc. British Airways are BAW for example; Air 2000 are AMM (think about it!). They used to be the same 2 character codes as IATA, but when the codes ran out ICAO had to change first (they have many more operators to deal with).
IATA have meant for years to change to the same 3-character codes but the established airlines are resisting this because of the costs of reprogramming all their computer systems (any IT person will understand what this would imply in terms of cost and/or liability to bugs) for something that will give them no benefit; it will only benefit new entrants.
ICAO 3-character codes are all unique. IATA 2-character codes are reused where airlines do not operate in the same area (generally interpreted as the same continent).
There is a comparable split with airport codes. IATA does 3-character codes for these whereas ICAO does 4-character codes. So London Heathrow is LHR or EGLL dependent on system. The ICAO code is subdivided; E = Europe, G = Great Britain, and LL = 2 character code for airports within Britain.
US ICAO codes all start with K, and then the last 3 characters are the IATA ones. Thus KJFK and KMIA for New York JFK and Miami.
Canadian ICAO codes all start with CY, followed by a 2-character code. So it's CYYZ for Toronto and CYVR for Vancouver. Look familiar? The Canadians, like the Americans, base the IATA airport code on the ICAO one by chopping off the first letter, but because of the different format this leads to all the Canadian codes starting with Y. And that's how Toronto got to be YYZ. Actually, there's a bit more to it than that. Toronto was allocated CYTO, but when the current international airport (Pearson) opened subsequently, and a new code was needed, all the more appropriate 2-character codes within Canada had gone, so they used YZ for the last 2 letters. YVR for Vancouver is more understandable using these rules.
[This message has been edited by WHBM (edited 01-18-2003).]