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 Delivered
Workspace IBM i
Categories Languages - RPG
Created by Guest
Created on Oct 1, 2018
Merged idea
This idea has been merged into another idea. To comment or vote on this idea, please visit IBMI-I-1361 Allow use of RPG constants in embedded SQL.

Allow named RPGLE constants in embedded SQL Merged

Currently you cannot use named RPGLE constants in embedded SQL within RPGLE programs. This would be most useful as part of the WHERE clause so the same constant could be used in both the RPG program and the embedded SQL. The current workaround is to redefine the constant as a variable set to Const and Initialized with the constant variable. This is tedious and time consuming to do for every constant we want to use and some developers skip using SQL for some solutions because of it to the detriment of the proper solution.


Use Case:

One such example would be to do something like this:

...
Dcl-C RPGCONST1 '1';
Dcl-C RPGCONST2 '2';

Dcl-S MyResult Like(MySqlField) Inz;

exec sql declare mycursor cursor for
select result from mytable
where myfield in (:RPGCONST1, :RPGCONST2);

// Iterate through cursor
exec sql open mycursor;

exec sql fetch mycursor into :MyResult;

If MyResult = RPGCONST1;
// Do something here
ElseIf MyResult = RPGCONST2;
// Do something else here
EndIf;
...


Idea priority Medium
  • Guest
    Reply
    |
    Nov 13, 2018

    Maybe we should read the comments before posting a new one? :)

  • Guest
    Reply
    |
    Nov 13, 2018

    This is a duplicate of http://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=117748

  • Guest
    Reply
    |
    Oct 4, 2018

    Your request is a duplicate of RFE 117748. Please use that RFE to cast a vote or add a comment.

  • Guest
    Reply
    |
    Oct 2, 2018

    Isn't this an almost exact duplicate of the following RFE?
    http://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=117748

  • Guest
    Reply
    |
    Oct 2, 2018

    I understand the issue but

    Dcl-C RPGCONST1 '1';
    Dcl-C RPGCONST2 '2';

    or

    Dcl-S RPGCONST1 Char(1) Inz('1');
    Dcl-S RPGCONST1 Char(1) Inz('2');

    ... isn't such a big issue. BTW, this is a subset of my request which would allow any expression as SQL host variable, see and vote https://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=122620