The vocative case is used to address a person. In Spanish, as in English, we have to mark the noun off with commas:
¿Pedro, puedes pasarme ese bolígrafo azul? (Peter, can you pass me that blue pencil?)
No lo sé, Anna. (I don’t know, Anna.)
The importance of the comma becomes more obvious if we look at a couple of alternatives, which have a very different meaning:
¿Me regalas un perro abuelo?
¿Me regalas un perro, abuelo?
While the first example involves that the child is asking for an old dog that is a grandfather, in the second example the boy is asking his grandfather to buy him a dog.