How to display total of all the records that contain the same primary key in RPG4?

55 pts.
Tags:
RPG
RPG Code
How to display total of all the records that contain the same primary key in RPG4?
e.g...
                                                            Transaction number :4458
product no:      name        QTYonHand      quantity on order                 23333             milk           12                          6
30404             sugar         100                         55
                                                    Transaction number :4457
product no:      name        QTYonHand      quantity on order                 23333          cheese           201                        198
74854             tea                  100                         55


Software/Hardware used:
as400, rpgle

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 4  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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • philpl1jb
    either with an SQL - Select count(*) or with a native loop
    countOfRows = 0;
    Setll  (mykey ) Myfile
    
    reade (mykey ) Myfile;
    
    Dow not %eof(MyFile);
        countOfrows  += 1;
       reade (myKey) myFile;
    EndDo;
    50,425 pointsBadges:
    report
  • TomLiotta
    I would have said to read each record that has the key and increment the counter for each one. It looks like an academic assignment to me. -- Tom
    125,585 pointsBadges:
    report
  • BigKat
    We don't like to just give a solution to what appears to be an academic (or self-learning) assignment, as that really just cheats you out of the knowledge you aquire by solving the problem.  That being said, if you were to show us what you have tried, and what is still going wrong, we will gladly give you tips, advice, and help to solve your problem.:) BigKat
    8,330 pointsBadges:
    report
  • ToddN2000
    How is this to be done ? SQL, VB, Query or programatically ?? What tools are at your disposal for producing the requested results?
    12,825 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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following