Open Query File

Open Query File

1. What is an Open Query File?
Open query file is a dynamic selection of records. It retrieves records thro’ open data path. So it’s processing time is slow.
Functions supplied by OPNQRYF are:

§  Dynamic keyed sequence access path
§  Dynamic keyed sequence access path over a join.
§  Dynamic join
§  Handling missing records in secondary join files
§  Unique-key processing
§  Mapped field definitions
§  Group processing

2. What does the Open Query file do?
Creates an open data path to physical file data.

3.  Notify the wrong steps in the following.
a. OVRDBF     b. OPNQRYF    c. OVRDBF    d . OPNQRYF
    OPNQRYF      OVRDBF           OPNQRYF       OVRDBF
    CALL PGM     CALL PGM       CALL PGM     CALL PGM
    CLOF               DLTOVR           DLTOVR         CLOF
    DLTOVR         CLOF                 CLOF               DLTOVR
a and b are correct steps.

4. What are the various steps involve creating an Open Query File? (Or) What are the mandatory steps for Open Query File?

OVRDBF
If a physical file having 100 records and if we want to override the PF. So that it contains only the specific number of records we are using OVRDBF

OPNQRYF
If you want to perform a SQL operation, we have to declare in OPNQRYF command only.
OPNQRYF (FILE PF) QRYSLT (‘EMPNO *EQ’ *BCAT &A) will retrieve empno equals &A  QRYSLT (‘EMPNAME *EQ % WLDCRD (“S*”)’) will retrieve empname which starting with s QRYSLT (‘EMPNAME *CT “S”’) will retrieve empname contain     SQRYSLT (‘EMPNO *EQ %RANGE (100 200)’) will retrieve empno between 100 to 200.

CALL / PROCESSING/CPYFRMQRYF
To see the records being selected we have to copy from the source file to a temporary file for this action CPYFRMQRYF will be used.

DLTOVR        
As we see early the main file is logically overridden and after performing the necessary operation, we have to delete the logical file. So that the main file contain the actual records. For this action DLTOVR will be used

CLOF
            Finally we have to close the file, which is opened.

5. What do you mean by Open data path?
It is an imaginary pointer and it will move from one record to another while the file is being read.

6. How to share the ODP?
By using OVRDBF command and make sure of the parameter SHARE (*YES).

7. What is the purpose of OVRDBF SHARE (*YES)?
By sharing the path *YES, the data is passed to the subsequent usage of that file, until the override is deleted.

8. What is the main purpose of overriding any file?
This command is mainly used to override the file’s attribute(s).

9. Override DBF - Explain.
It is used to share the open data path.
It is used to redirect the file name.
It used over the file by its member.

10. How to use all the members in a P.F
Use OVRDBF with member option *all

11. Is it possible to create a new field dynamically?
Yes. By using OPNQRYF command you can create a new field dynamically by defining the new field in MAPFLD parameter.

12. Can we over ride other files apart from DBF?
Yes. We can use OVRPRTF, OVRDSPF, OVRTAPF, and OVRDKTF

13. What is the purpose of OVRPRTF [Over ride Printer file]?
To change the no. of copy dynamically, one can use the OVRPRTF command.

14. What is the CPF9899 error?
It is the CL program message ID for Open query file error.

15. What are the advantages for using Open Query File?

·         Dynamic selection of records.
·         Can create a join logical file.
·         Dynamic join.
·         Virtual field can be used.
·         Accessing by open data path
·         Group processing

[Virtual field does not exist in PF. But it is the combination of PF fields. Let PF01 has empno, salary, allow. and OpnQryF has empno, net=salary+allow. Here net is virtual field]


16. How are the records accessed in Open Query File?
            By creating an Open Data Path, it will access the records from the PF/LF.

17. What are the differences between SQLRPG, Open query File and Logical File?
           

Open query file

Logical file

SQLRPG

1. Selection is throgh’ Open Data Path
2. Dynamic selection
3. Slow process
4. Virtual field can be used
5. Dynamic join
6. We can use more selection criteria
1. Selection is thro’
Access Path.
2. Static selection
3. Fast process
4. Can not be used
5. Static join
6. Can not use more selection criteria
1. Selection thro’ Access path
2. Dynamic selection
3. Slow than OPNQRYF
4. Can not be used.
5. Dynamic join.
6. Can use more selection  criteria.

/**************************************************/

No comments