A study of CNO elements in barium stars