![[Toc]](../../toc.gif)
![[Index]](/idx.gif)
Distinguish between empty and omitted parameter
You can check if a parameter has been ommitted using the function <ARG.
This is useful if you work with default values for parameter and if an
empty string is a valid value for a parameter.
(Note that this is only possible in internal or external REXX functions or
procedures! see also Starting new VIO/Fullscreen sessions)
Example:
/* sample code to show how to distinguish between omitted and */
/* empty parameter */
/* call the subroutine with omitted and empty */
/* parameter */
call TestRoutine '', 'v2', , 'v4'
exit
/* sample sub routine */
TestRoutine:
parse arg v1, v2, v3, v4, v5
do i = 1 to 5
if arg( i, 'E' ) = 1 then
do
say 'Parameter ' || i || ' was entered. '
say ' The value is "' || arg( i ) || '"'
end
else
say 'Parameter ' || i || ' was omitted. '
end /* do i = 1 to 4 */
return
Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs