I have been playing with various configuration to make this work. At one point I created an A record for www and updated the IP address with ddns. That obviously resolved the sub-domain as expected. I then went back deleted the A record and recreated a CNAME record for www again. I tried pinging www.mydomain.com again, and this time, ping was able to resolve the host correctly! I am not sure why it is now working, but did not the first time. I even tried flushing the dns cache, and tried from a different host, and it works correctly as expected.
Thanks for taking the time to respond.