Record Selection

pts.
Tags:
Programming Languages
RPG
I have a requirement : Say on a display file screen if you enter a particular department, then the next screen should show employee details of that department only. Can I use OPNQRYF for selection of records based on department and then call the RPG prog. which will show the next screen..Will that be a good idea..Please advise. If there is an alternative to this which is better than this, please suggest. Thanks

Answer Wiki

Thanks. We'll let you know when a new response is added.

If I was doing this I would have a Department Code field (DEPTC) on the Employee Master file (EMPMAST), and then have a logical file (EMPLF01) over the Employee Master file, in Department Code (DEPTC) and Employee No (EMPNO) key order.

Your display file program would then prompt for the Department Code and read logical file EMPLF01 using the READE (Read Equal) operation code and build up your second screen (presumably a subfile) accordingly.

I wouldn’t go near OPNQRYF for this.

If you wanted to be more flexible and have screen 1 accept various parameters for record selection, e.g. Department Code, Name, Start Date Ranges, Salary Range, Marrital Status, etc, then I would use embedded SQL to provide the flexibility.

Hope this helps

Jonathan

Discuss This Question:  

 
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

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