Skip to Main Content
IBM Power Ideas Portal

This portal is to open public enhancement requests against IBM Power Systems products, including IBM i. To view all of your ideas submitted to IBM, create and manage groups of Ideas, or create an idea explicitly set to be either visible by all (public) or visible only to you and IBM (private), use the IBM Unified Ideas Portal (

Shape the future of IBM!

We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:

Search existing ideas

Start by searching and reviewing ideas and requests to enhance a product or service. Take a look at ideas others have posted, and add a comment, vote, or subscribe to updates on them if they matter to you. If you can't find what you are looking for,

Post your ideas
  1. Post an idea.

  2. Get feedback from the IBM team and other customers to refine your idea.

  3. Follow the idea through the IBM Ideas process.

Specific links you will want to bookmark for future use

Welcome to the IBM Ideas Portal ( - Use this site to find out additional information and details about the IBM Ideas process and statuses.

IBM Unified Ideas Portal ( - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM. - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.

Status Not under consideration
Workspace IBM i
Categories Languages - RPG
Created by Guest
Created on Jun 9, 2023

Variadic procedures in RPG

In RPG you can make prototypes for procedures where parameter can be omitted, however the datatype and an absolute number of parameters is required in the prototype.

For a more polymorphic approach I will suggest to implement variadic procedures where any parameter ( give by a pointer) in the calling program/procedure can be addressed by the called procedure by an array of pointers accessed by a BIF. ( or just a pointer array)

This feature is commonly use in type agnostic function in i.e. language like C. take printf as an example. Perhaps more direct to this idea - stdarg.h - where va_start , va_arg and va_end let you travers the parameters

An implementation idea is to declare a Variadic procedure in RPG could like this:

dcl-pr my_var_arg_procedure options(*VARARG);

one_required_parameters char(10) const;


And the implementations could look like this:

dcl-proc my_var_arg_procedure;

dcl-pi *n options(*VARARG);

one_required_parameters char(10) const;


dcl-s my_data char(10) based(p_my_data);

dcl-s p_my_data pointer;

// This will do the Variadic magic for RPG

p_my_data = %vararg(1);

// now my_data and one_required_parameters has the same value;

dsply my_data;

dsply one_required_parameters;

// Next up - we can also handle parameters like va_start , va_arg, va_end

for i 1 to %parms;

p_my_data = %vararg(i);

// do stuff



The above example let you pass any number and any type of parameter ( by reference presumably) however require the first parameter always to be a char(10) const; in this case.

This feature will also make migration of legacy code easier since it will allow to bypass validation for the prototype that in fact is equal to the classical call of a program. For the same reason it could potentially also lead to exceptions at execution time if this feature is not use as intended.

Read more here about Variadic functions :

Idea priority High
  • Admin
    Sabine Jordan
    Oct 18, 2023

    The CEAC has reviewed this requirement and recommends that IBM view this as a HIGH priority requirement that is important to address.

    Background: The COMMON Europe Advisory Council (CEAC) members have a broad range of experience in working with small and medium-sized IBM i customers. CEAC has a crucial role in working with IBM i development to help assess the value and impact of individual RFEs on the broader IBM i community and has therefore reviewed your RFE.

    To find out how CEAC help to shape the future of IBM i, see CEAC @ and the article "The Five Hottest IBM i RFEs Of The Quarter" at

    Sabine Jordan + Sara Andres – CEAC Program Manager, IBM

  • Guest
    Oct 12, 2023

    Also for the modernization perspective, legacy calls could be programmatically converted to free more easy:




    could programmatically be converted ( without knowledge of the datatypes previously defined) to:

    dcl-pr qcmdexc options(*VARARG) extpgm('QCMDEXC');


    dlycmd = 'DLYJOB 3';

    dlylen = 8;

    qcmdexc( dlycmd : dlylen);

    since dlycmd and dlylen is declare elsewhere - perhaps in a include. The *VARARG will just provide pointers to whatever types used.

  • Guest
    Oct 10, 2023

    A good examples could be using the printf from the C-library. It would be declare like this:

    dcl-pr printf options(*VARARG) extproc(*CWIDEN:'printf');

    format pointer value options(*string);


    where the first parameter is a string, and the an optional number of parameters and types.

    for type "EXTPGM" however it will always be a list of pointers send to to calle program.

    for an implementation in RPG of another example summing a list of integers:

    // the main usages:

    sum = sum_int ( 1:2:3:4);

    dcl-proc sum_int ;

    dcl-pi int(10) options(*VARARG);


    dcl-s based_int int(10) based(p_my_data);

    dcl-s p_based_int pointer;

    dcl-s result int(10);

    dcl-s i int(10);

    for i 1 to %parms;

    p_based_int = %vararg(i);

    result += based_int;


    return result;


  • Guest
    Aug 18, 2023
    IBM has previously requested more clarifying information. Because the additional information was not provided within 30 days, the request has been closed.

    - IBM Power Systems Development
  • Guest
    Jun 13, 2023
    IBM needs more information to further assess your Idea.

    1. The description in the Idea says "This feature will also make migration of legacy code easier since it will allow to bypass validation for the prototype that in fact is equal to the classical call of a program."

    Please show an example of legacy code that could be migrated using this feature.

    2. The description in the Idea says "do stuff" in the loop that is handling the parameters.

    Please show a more detailed example of how the procedure would actually use the parameter.

    - IBM Power Systems Development