Variable number of arguments to a cobol program

Is there a way to create a COBOL sub-program (procedural) that accepts a variable number of arguments similar to the "C" va_start or "Java" ... or "C#" params keyword.

 

Thanks

 

Parents
  • You can do this in a procedural COBOL program by using the OPTIONAL phrase preceding the data-name. In the corresponding calling program you could then use the OMITTED phrase in the call statement if you did not wish to pass an actual parameter.

    In a method you may specify optional default parameters for which you assign a default value. You may also pass in parameters using the PARAMS keyword as the last parameter in the list and this will group all parameters passed into a one-dimensional array and pass this into the method. This works like the C# params keyword.
Reply
  • You can do this in a procedural COBOL program by using the OPTIONAL phrase preceding the data-name. In the corresponding calling program you could then use the OMITTED phrase in the call statement if you did not wish to pass an actual parameter.

    In a method you may specify optional default parameters for which you assign a default value. You may also pass in parameters using the PARAMS keyword as the last parameter in the list and this will group all parameters passed into a one-dimensional array and pass this into the method. This works like the C# params keyword.
Children
No Data