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.

121 VOTE
Status Delivered
Workspace IBM i
Categories Db2 for i
Created by Guest
Created on Mar 16, 2018

Allow use of RPG constants in embedded SQL

When a constant is defined in RPG, allow that constant to be used in embedded SQL statements so that the value of the constant does not have to be hard coded in the SQL statement.

Allow the constant to be referenced as if it were a program variable with a colon prefix.

Instead of doing ...

dcl-c MY_NAMED_CONSTANT const('X');

if someVar = MY_NAMED_CONSTANT;
// do something
endif;

exec sql
select * from myfile
where myfield = 'X';

... developers could do something like ...

exec sql
select * from myfile
where myfield = :MY_NAMED_CONSTANT;


Use Case:

General programming where constants are defined, often in copy source members, so that they do not have to be refined in programs using embedded SQL.

Allowing constants to be used can reduce application errors if the constant is changed but the embedded SQL statement is not.


Idea priority Medium
  • Guest
    Reply
    |
    Feb 26, 2020

    This enhancement has been delivered at IBM i 7.3 and IBM i 7.4.
    Get the latest Db2 PTF Group (SF99703 or SF99704) and use RPG constants in your Embedded SQL.

  • Guest
    Reply
    |
    Feb 17, 2020

    The COMMON Europe Advisory Council (CEAC) has reviewed this requirement and recommends that IBM view this as a MEDIUM priority requirement that should be addressed.

    Most modern application is modular and programmer defines the constant global source file once and then includes it in various programs. To make it possible to utilise definitions in RPG both in RPG logic and embedded SQL logic/definitions this enhancement will make it easier to maintain applications.

    Background: The 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 @ ibm.biz/BdYSYj and the article "The Five Hottest IBM i RFEs Of The Quarter" at ibm.biz/BdYSZT

    Therese Eaton – CEAC Program Manager, IBM

  • Guest
    Reply
    |
    Sep 18, 2018

    The CAAC has reviewed this requirement and recommends that IBM view this as a “nice to have” low priority feature. The work-around exists -- but cleaner code would be good.

    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 RFEs on the broader IBM i community, and has therefore reviewed your RFE.

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

    For more details about CAAC's role with RFEs, see http://www.ibmsystemsmag.com/Blogs/i-Can/May-2017/COMMON-Americas-Advisory-Council-%28CAAC%29-and-RFEs/

    Nancy Uthke-Schmucki - CAAC Program Manager

  • Guest
    Reply
    |
    Mar 20, 2018

    Due to processing by IBM, this request was reassigned to have the following updated attributes:
    Brand - Servers and Systems Software
    Product family - Power Systems
    Product - IBM i
    Component - Db2 for i
    Operating system - IBM i
    Source - None

    For recording keeping, the previous attributes were:
    Brand - Servers and Systems Software
    Product family - Power Systems
    Product - IBM i
    Component - Languages - RPG
    Operating system - IBM i
    Source - None

  • Guest
    Reply
    |
    Mar 19, 2018

    Especially agree with this - "Allow the constant to be referenced as if it were a program variable with a colon prefix."

  • Guest
    Reply
    |
    Mar 16, 2018

    I concur, @NielsLiisberg.

    I'll update the request.

  • Guest
    Reply
    |
    Mar 16, 2018

    However I don't like the const() syntax since it might be a UDFT. I suggest that the precompiler just allow :myconstant and do the math behind.

0 MERGED

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 ...
about 6 years ago in IBM i / Languages - RPG 5 Delivered