Yes, you can use any variable to get data into (and out of) a Mathcad program function. The only downside is that Mathcad doesn't like mixed units in an array or matrix.
All variables outside the "program" are available inside the protgram; but variables inside the program are local to the program. A common trick for getting multiple results out of a program function is to just stack them all together in a single array (use augment() or similar functions) and pass that array out as the result of the function.
Bung
Life is non-linear...