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 (https://ideas.ibm.com).


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 (https://www.ibm.com/ideas) - Use this site to find out additional information and details about the IBM Ideas process and statuses.

IBM Unified Ideas Portal (https://ideas.ibm.com) - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM.

ideasibm@us.ibm.com - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.

Status Future consideration
Workspace IBM i
Created by Guest
Created on Jul 26, 2019

DCL variable length variables or CALLPRC passing *BYVAL2 or *BYVAL4

I would like the ability to declare a varying length character variable in CL. Just like in RPG.

For example:
DCL VAR(&VAR) TYPE(*CHAR) LEN(100)
DCL VAR(&VAR) TYPE(*VARCHAR) LEN(100)
DCL VAR(&VAR) TYPE(*VARCHAR) LEN(100000)
DCL VAR(&VAR) TYPE(*VARCHAR2) LEN(100)
DCL VAR(&VAR) TYPE(*VARCHAR4) LEN(100)

The first is a standard fixed length character variable.
The second is a variable length character variable with 2 bytes to store the current length of the variable-length item.
The third is identical to the second but with 4 bytes.
The fourth and fifth defines a variable with 2 or 4 bytes for the length.


Use Case:

I ran into problems when calling a procedure (CALLPRC) from a CL program that required a parameter that was defined as a varying character.
Of course I could have programmed it from a fixed length variable but it should be possible to do it directly.

An alternative and perhaps even easier could be a minor change in the CALLPRC command how a variable is passed. Now we have *BYVAL but the possibility to use *BYVAL2 and *BYVAL4 for 2 or 4 byte length might be even better and more flexible.

CALLPRC PARM((&VAR *BYVAL2))
CALLPRC PARM((&VAR *BYVAL4))


Idea priority Medium
  • Guest
    Reply
    |
    Nov 29, 2022

    The CAAC has reviewed this IBM Idea and recommends that IBM view this as a high priority Idea that is important to be addressed. Although the suggested solution is complex and therefore not preferred as a solution for providing variable length parameters, we believe having variable length parameters in CL would be highly desirable for the IBM i Community. In addition, CL programs can be used to process commands that already have the capability of declaring variable length parameters. To make the handling of those parameters easier in CL, variable length declarations in CL would be very helpful.


    Background: The COMMON Americas Advisory Council (CAAC) members have a broad range of experience in working with small and medium-sized IBM i customers. CAAC has a key role in working with IBM i development to help assess the value and impact of individual IBM Ideas on the broader IBM i community, and has therefore reviewed your Idea.


    For more information about CAAC, see www.common.org/caac


    Nancy Uthke-Schmucki - CAAC Program Manager

  • Guest
    Reply
    |
    Nov 30, 2021

    IBM agrees with the request and a solution appears to be desirable and feasible. IBM intends to provide a solution. However, IBM's plans may change and no commitment is made that a solution will be provided.

  • Guest
    Reply
    |
    Sep 23, 2021

    .When passing a parameter as variable by CALLPRC, the variable type should be the same in the caller and callee. As the following simple program:

    ========= CL =========
    PGM
    DCL VAR(&NAME) TYPE(*CHAR) LEN(14)
    DCL VAR(&LEN) TYPE(*INT) STG(*DEFINED) LEN(4) +
    DEFVAR(&NAME)

    CHGVAR VAR(%SST(&NAME 5 10)) VALUE('Danmark')
    CHGVAR VAR(&LEN) VALUE(7)

    CALLPRC PRC(SUBPRC1) PARM((&NAME *BYVAL))

    ENDPGM
    =====================

    ========= RPG =========
    **free
    ctl-opt nomain;
    dcl-proc SUBPRC1 export;
    dcl-pi *n;
    name varchar(10:4) VALUE;
    end-pi;

    dsply ('hello ' + name);
    return;
    end-proc SUBPRC1;
    ======================

    It works well.

    I don't think *BYVAL2 or *BYVAL4 is necessary when passing variables as parameter.

    For the part of providing a new data type of varying length character string, I prefer the following format.
    DCL VAR(&VAR) TYPE(*VARCHAR2) LEN(100)
    DCL VAR(&VAR) TYPE(*VARCHAR4) LEN(100)

  • Guest
    Reply
    |
    Apr 28, 2020

    IBM has received this requirement and is evaluating it. IBM will provide a response after evaluation is complete.

  • Guest
    Reply
    |
    Aug 27, 2019

    I can see that you have planned "Allow expressions in CL CALL and CALLPRC commands"
    http://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=125376
    for future release.

    Thus it would be an idea to implement *BYVAL2 and *BYVAL4 in CALLPRC.
    The resulting copy of the parameter could then automatically have the length set up.