Error displaying values from within a function

I am trying to reduce code and to minimize memory usage, by trying to display values from within a function. I can then call it multiple times. Something like this as function code:
function Formatting(x,y,value) {
dc.drawText(x, y, Graphics.FONT_XTINY, value, Graphics.TEXT_JUSTIFY_CENTER|Graphics.TEXT_JUSTIFY_VCENTER);
}

However, I get an error "Could not find symbol dc". Adding dc like in "function onUpdate(dc)" isn't possible.
Any ideas?