How to group up data in RPG ILE

2900 pts.
Tags:
AS/400
RPG ILE
Hi all,
How I can retrieve grouped data on basis of two database fields in RPG ILE? How I can track data which is already retrieved and skip those records in next iterations? (Logic should be like Group By clause in SQL) I just want some basic logic.
Thanks in advance,
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 6  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • philpl1jb

    Obviously, the first option is to use SQLRPGLE and use a Select with the Group on clause.

    54,090 pointsBadges:
    report
  • hunshabbir7
    Thanks for reply but sorry I am not allowed to use embedded SQL. 
    2,900 pointsBadges:
    report
  • philpl1jb
    Then the simplest approach would be to access the data from a logical with keys that match your "Group On" logic.
    54,090 pointsBadges:
    report
  • philpl1jb
    I would have said that the next best thing was to use a logical file with keys that match your group on clause.
    54,090 pointsBadges:
    report
  • ToddN2000
    If you cannot use embedded SQL then logical files are the way to go.
    Do a setll on you 3 field key and do a reade to read all for that group of matching keys.
    131,645 pointsBadges:
    report
  • philpl1jb

    And if logical files can't be used then we will push for an Open Query File.  It's the last option that will present the records to the program in the desired order. 

    Without any of these options the program gets interesting.

    54,090 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: