50 pts.
 CLLE – Openqry Files
Using opnqry files, we create any key field for physical file for temporarily usage.Instead of creating another logical can i create opnqry? Please give code

Software/Hardware used:
ASKED: September 21, 2010  9:07 AM
UPDATED: September 22, 2010  12:23 AM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Yes, you can. The question becomes “Why do you want to do that?”

When you create a query-file, you are essentially creating a new LF at run-time. Every time you run the OPNQRYF command, you create a new LF and then delete it when the job finishes or the query-file is closed.

If you simply created a real LF, it would only be created once. (Index maintenance would be on-going as updates happened to the PF, unless the access path was shared.)

So, you would usually only use OPNQRYF in a program if the program was run very infrequently, perhaps less than once a month. You might also use OPNQRYF when the view and/or the keys are unpredictable, but those should be very rare choices. SQL is almost always a better choice for many cases.

As far as examples go, the Information Center has lots of examples. Just read the OPNQRYF topic — specifying a key field is in the very first example. Simply searching the Info Center for “opnqryf” brings up lots of discussion. There’s no reason to think that our examples will be any more helpful than the ones that are in the official documentation. (If you are a student, you need to show us what you have already tried; we can provide guidance but can’t do your work for you.)

Tom

 107,695 pts.