Some high level programming languages, such as C, can return an integer on the program call. The integer can be retrieved by specifying the RETURNS keyword in the function definition, For example:
%function(DTW_DIRECTCALL) dc3(IN CHAR(3) p1) RETURNS(retval) { %EXEC { /QSYS.LIB/NETDATA.LIB/MYPGM.PGM %} %}
When the function call completes successfully, the parameter retval contains the value returned by the program.