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 Not under consideration
Workspace IBM i
Categories Languages - RPG
Created by Guest
Created on May 14, 2021

FOR-EACH with record level access

The new FOR-EACH is today working on list, however it would be nice if - in the future - it could be extended to also handle record level access. ( and perhaps also user defined iterators)

The basic idea is to make tighter and more concise coding of loop around reading of file with less pitfalls.

The aim is for READ, READE and READPE


Use Case:

FOR-EACH READ MYFILE;
// do stuff
ENDFOR;

would be identical to the current way to do it:

READ MYFILE;
DOW NOT %EOF(MYFILE)
// do stuff;
READ MYFILE;
ENDDO;


Idea priority Medium
  • Guest
    Reply
    |
    Jun 6, 2022

    This idea would be much more usefull if control breaks would be added

    example


    FOR-EACH READ MYFILE;

    Total-DS(TTLDS);

    DTL-DS(DTLDS);


    CTLBREAKS;
    CUSTNO *L2;

    ORDERNO *L1;
    ENDCTLBREAKS;

    ON *TTL2;

    DSPLY 'total ='+ TTLDS.CUSTNO +':'+%EDITC(custamount:'J');
    ENDTTL1;



    ON *DTLL_L1;

    custamount += DTLDS.amount ;


    ENDDTL1;



    ENDFOREACH;

  • Guest
    Reply
    |
    Nov 30, 2021

    IBM does not intend to provide a solution to this request at this time, so it is being closed.

    Extending FOR-EACH to process the records in a file does not align with the strategy for IBM's future investment regarding I/O. RPG programmers are encouraged to use embedded SQL for I/O to database files.

  • Guest
    Reply
    |
    Aug 26, 2021

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

  • Guest
    Reply
    |
    Aug 16, 2021

    The CEAC has reviewed this requirement and recommends that IBM view this as a MEDIUM priority requirement that should be addressed. Adding this functionality would bring RPG in line with many other world leading languages. However, we have voted medium because you can code around the issue and we would like IBM to focus on other priorities at this time

    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 @ 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
    |
    Jul 27, 2021

    The CAAC has reviewed this requirement and recommends that IBM not implement this request. There is no value -- the alternatives are acceptable.

    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

    Nancy Uthke-Schmucki - CAAC Program Manager

  • Guest
    Reply
    |
    Jun 21, 2021

    I've posted something similar (i.e. idiomatic looping syntax). The request was declined.

  • Guest
    Reply
    |
    May 18, 2021

    @pnicolay - Fetching into an array gets you part of the way there, certainly. But if you are working with a large data set that could be larger than the array size, then you need to perform multiple fetches in a loop. The net result being that you have an outer loop for fetching from the cursor, and an inner loop for processing the array.

    My thought was that you could collapse both these loops into a single statement. Though now I think about it a bit, this would probably be messy syntax, as you'd have control flow statements within an EXEC SQL statement (presumably).

  • Guest
    Reply
    |
    May 17, 2021

    You can fetch an SQL resultset into an array and use that in a FOR-EACH... so it is already supported.

    For native IO I would rather suggest For-Each MyDS in %Read(MyFile) which more closely matches the idea of For-Each.

    But why still invest in native IO... put the developer resources/money in SQL.

  • Guest
    Reply
    |
    May 17, 2021

    This sounds great. I'd love it if it could also be extended to working with embedded SQL queries (but maybe that deserves its own RFE).