Skip to Main Content
IBM Power 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:

Post your ideas

Start by posting ideas and requests to this portal to enhance a Power product or service. Take a look at ideas others have posted and upvote them if they matter to you,

  1. Post an idea

  2. Upvote ideas and add comments to ideas that matter most to you

  3. Get feedback from the IBM team to refine your idea

Help IBM prioritize your ideas and requests

The IBM team may need your help to refine the ideas so they may ask for more information or feedback. The Power teams will then decide if they can begin working on your idea. If they can start during the next development cycle, they will put the idea on the priority list. Each team at IBM works on a different schedule, where some ideas can be implemented right away, others may be placed on a different schedule.

Receive notification on the decision

Some ideas can be implemented at IBM, while others may not fit within the development plans for the product. In either case, the team will let you know as soon as possible. In some cases, we may be able to find alternatives for ideas which cannot be implemented in a reasonable time.


Specific link you will want to bookmark for future use

IBM Unified Ideas Portal - https://ideas.ibm.com/ - Use this site to create or search for existing Ideas across all IBM products that are outside of Power, and track all of your personal interactions with all 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
    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
    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
    Aug 26, 2021

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

  • Guest
    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
    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
    Jun 21, 2021

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

  • Guest
    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
    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
    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).