db2 questions for as400

Upload: moulikpl

Post on 14-Apr-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 DB2 Questions for As400

    1/3

    DB2 Questions:

    1. How do you find physical file for a logical file?

    By using DSPFD command and PFILE

    2. What is use of RGZPFM? (Reorganize Physical File Member)

    Remove deleted records to make the space occupied by them available for

    more records.

    Reorganize the records of a file in the order in which you normally access

    them sequentially, there by minimizing the time required to retrieve records.

    This is done using the KEYFILE parameter.

    This may be advantageous for files that are primarily accessed in an order

    other than arrival sequence. A member

    can be reorganized using either of the following:

    Key fields of the physical file

    Key fields of a logical file based on the physical file

    Reorganize a source file member, insert new source sequence numbers, andreset the source date fields (using the SRCOPT and SRCSEQ parameters on

    the Reorganize Physical File Member command).

    Reclaim space in the variable portion of the file that was previously used by

    variable-length fields in the physical file format and that has now become

    fragmented

    3. What is ODP in AS/400?

    An open data path is the path through which all input/output operations

    for the file are performed. In a sense, it connects the program to a file. If you

    do not specify the SHARE(*YES) parameter, a new open data path is created

    every time a file is opened. If an active file is opened more than once in the

    Classification: GE Internal

  • 7/29/2019 DB2 Questions for As400

    2/3

    same job or activation group, you can use the active ODP for the file with the

    current open of the file. You do not have to create a new open data path

    4. Can you tell about the access path maintenance (*Immediate, *Rebuild,

    *Delay)?

    The MAINT parameter specifies how access paths are maintained for closed

    files. While a file is open, the system maintains the access paths as changes

    are made to the data in the file.

    Immediate maintenance of an access path means that the access path is

    maintained as changes are made to its associated data, regardless if the file

    is open. Access paths used by referential constraints will always be in

    immediate maintenance.

    Rebuild maintenance of an access path means that the access path is only

    maintained while the file is open, not when the file is closed; the access path

    is rebuilt when the file is opened the next time. When a file with rebuild

    maintenance is closed, the system stops maintaining the access path. When

    the file is opened again, the access path is totally rebuilt. If one or more

    programs has opened a specific file member with rebuild maintenance

    specified, the system maintains the access path for that member until

    the last user closes the file member.

    Delayed maintenance of an access path means that any maintenance for the

    access path is done after the file member is opened the next time and while

    it remains open. However, the access path is not rebuilt as it is with rebuild

    maintenance. Updates to the access path are collected from the time the

    member is closed until it is opened again. When it is opened, only the

    collected changes are merged into the access path.

    5. How do you update a file in a CL program?

    By using RUNSQLSTM Command

    6. How to lock a file in CL?

    Using ALCOBJ command

    7. Max number of fields in a PF

    Classification: GE Internal

  • 7/29/2019 DB2 Questions for As400

    3/3

    Number of bytes in a record 32,766 bytes

    Number of fields in a record format 8,000 fields

    Number of key fields in a file 120 fields

    Size of key for physical and logical files 2000 characters1

    Size of key for ORDER BY (SQL) and KEYFLD (OPNQRYF) 10,000 bytes

    Number of records contained in a file member 4,294,967,294 records2

    Number of bytes in a file member 266,757,734,400 bytes3Number of bytes in an access path 1,099,511,627,776 bytes3 5

    Number of keyed logical files built over a physical file member 3,686 files

    Number of physical file members in a logical file member 32 members

    Number of members that can be joined 32 members

    Size of a character or DBCS field 32,766 bytes4

    Size of a zoned decimal or packed decimal field 31 digits

    Maximum number of constraints per physical file 300 constraints

    Maximum number of triggers per physical file 6 triggers

    Maximum number of recursive insert and update trigger calls 200

    8. Difference between Access path and open data path?

    Open Data Paths (ODPs) provide a way for more than one program in the same job to share

    the same file status information (I/O feedback areas), file pointer positions, and storage area. ODP'sare quite useful as they can improve performance, reduce the amount of main storage needed by

    the job, and reduces file opens/closes.

    For native I/O access you can set up ODP's by specifying SHARE (*YES) on the CRTPF, CHGPF, or

    OVRDBF commands. However, SQL based I/O access is not influenced by the SHARE (*YES) setting.

    The DB2 SQL engine is solely responsible for creating and reusing ODP's for I/O performed from

    SQL-based interfaces (and does so automatically).

    An access path (also known as a keyed logical file or an index in SQL terms) is data structure that

    represents the order in which data will be retrieved from a file. It provides a quick way of locating

    data. Without an access path, a program would be forced to read every row in the table to find theparticular rows of interest. This technique (known as a full table scan), can be a lengthy process,

    depending on the size of the table and how many rows are being retrieved. A scan using an access

    path tends to be more efficient than a full table scan when a small percentage of rows are selected

    since the length of the access path key value is usually shorter than the length of the table row

    Classification: GE Internal