The following two examples illustrate sample M code that could be used in simple RPCs.
SUM(RESULT,A,B) ;add two numbers S RESULT=A+B Q
SORT(RESULT,UNSORTED) ;sort numbers N I S I="" F S I=$O(UNSORTED(I)) Q:I="" S RESULT(UNSORTED(I))=UNSORTED(I) Q