Originally Posted by
Gardyloo
As a rule, codeshare flight numbers are only applied in cases where either (a) the flight terminates or ends in the home country of the codeshare partner, or (b) the flight connects from or to a flight actually operated by the codeshare airline, or, in the case of SIN-HKG, it connects to another AA codeshare, in this case possibly HKG-LAX/SFO/ORD/JFK.
It's helpful when planning such flights to look at the AA timetable, which makes a clear distinction between "operated by codeshare airlines" and "operated by codeshare airlines, connection required." While the codeshare typically won't exist unless it has a logical connection to an AA coded or operated flight, you don't actually need to connect to that flight to book the AA code if it is in the former category. For example, AA5870 (JL) HKG-HND can be booked as a standalone flight.