A DNS name is just a name for an IP address so us humans don't have to remember IP addresses (that could change as well). It got nothing to do with ports.
Since you don't specify a port, the client will use the default port and because both names translate to the same address it will end up connecting to the same thing in either case. If you're just using A records you'll have to specify the port and can use either of the names (since they're equivalent) to connect to either one.
If you want one name to go to the 9987 server and the other name to the 9988 server you'll have to use SRV records instead.
Something like this for example:
Code:
ts.mydomain.com IN A 1.2.3.4
_ts3._udp.ab.com IN SRV 5 100 9987 ts.mydomain.com.
_ts3._udp.cd.com IN SRV 5 100 9988 ts.mydomain.com.
When sending PMs please make sure to include a reference link to the thread in question in the body of your message.