Reading logical with different key fields scenario

635 pts.
Tags:
AS400 physical file
Logical Files
OS/400
Physical Files
Hi, I have a physical file FILE with fields A, B and C. I am using these fields as KEY fields in logical file FILELF. But in my program, i have scenarios like:- a. Read FILE on the basis of key fields A ,B and C, if not found then b. Read FILE on the basis of key fields A,B or A,C or B,C, if not found then c. Read FILE on the basis of key fields A, B, C I have made the steps like this. FILELF with key fields will handle, ABC, AB and A but for scenarios like B,C and AC and C, i am bound to create three more logical files. If anyone out here to sort this out with the minimum number of logical. Thanks, Siddharth

Software/Hardware used:
os400

Answer Wiki

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

Yes, to use native i/o you will need additional logical files.
Phil

=================================================

Phil is generally right. If you must use native I/O, you might need a number of additional logical files.

This is one reason that SQL might be used instead of native I/O. You can use a dynamic statement to specify an ORDER BY clause for any columns you need. This is also a possible place where OPNQRYF might be used.

With either SQL or OPNQRYF, no keyed logical files, nor INDEXes, are actually required. They would be used to reduce response times and to reduce the chance of temporary index builds at run-time.

Tom

Discuss This Question: 2  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
    I think you're right, three more logicals B,C and AC. As Tom pointed out, there are alternatives such as SQL, although depending on file size and performance requirments you may need to create indexes.. Phil
    49,850 pointsBadges:
    report
  • Sangay
    [...] Reading logical witf different key fields scenario [...]
    0 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