DDS (Data Description Specifications.)


  
1. What does DDS stand for?
Data Description Specifications.

2. What are the types of files?
·         Data base files
·         Device file
·         DDM files (Distributed Data Management files)
·         Save files

Database files
            This is the actual database for AS/400.
            It includes PF, LF, and Field Reference Files

Device files
A device file contains the description of how to use the physical devices such as display stations, printer and tape devices. E.g. Display file, printer file.

DDM files
The DDM files are employed when we tries to access a file from a remote system to our current system. The current system is called source system and the remote system is called target system. Just like other database files the DDM files are to be opened before they are used in program. After they are created an access path is created, thro’ which the target system is accessed.
DDM files serve as a medium, connecting the program running on source system and the file on the target system.
They are used to
     ·         Copy a file from one system to another.
     ·         Manage file on a remote system.
     ·         Access data from a remote system.

Save files
They are used to hold the data in a format for back up and recovery purposes.

3. What is Source Physical File?
Source physical file is also a file, which has one or more files included in it. It is just like a directory and it contains many members. The members are like a various programs residing in the directory. CRTSRCPF is used to create source physical file.

4. What is a member?
            A member is a subset of data within a file.
            All program, files within a source file are called member for that file.

5. What is a Physical File?
It is an object its type is PF, that physically occupies memory space for the purpose of store and retrieve data. It is a single record format. CRTPF command is used to create a physical file. Maximum number of fields included in a PF is 8000. Maximum no of key fields included is 120.

6. What are the four level entries of PF?
There is File level entries, Record level entries, Field level entry, and Key level entry.

File level entry keywords are UNIQUE, LIFO, FIFO, FCFO [First Change First Out], REF.
In record level entry, we can give the Record format name.
In the field level entry, we can define the field names, types and size.
In the Key level entry, we can define the key field.

7. UNIQUE – explain.
            It is a file level keyword specified not to allow a duplicate key in a keyed file.

8. Can a physical file contain more than one member, and how is it accessed?
            Yes, by using OVRDBF (___) MBR (___)

9.  When a PF is compiled and default values used how many members does it have?
One
10.  What does the DSPPFM command do?
Displays a list of records on the CRT from the physical file.

11.  Explain the use of DSPFFD.
To display a physical files record layout structure.

12. How would you change the attribute of file?
CHGPF command is used. By this we can change the length of field, wait time, field name, etc.

13. DSPDBR – Expalin.
Display Database Relation. It tells the no. of logical file that are built over a specified PF.

14.  What is the CPYF command used for?
a.) To print all records in a physical file,
b.) To transfer records from one PF object to another PF object.

15.  What is the purpose of the *MAP and *NOCHK in the CPYF command?
a.) To transfer data byte by byte.
b.) To transfer data field by field regardless of field names.

16. How to copy a ten specified records from one file to another file?
By using CPYF command we can copy record from one file to another file. If we want to copy from one position to another position, we have to give the starting position and ending position. If we want to copy based on condition, we have to give the criteria on the sql statement.

17. ADDPFCST – explain
ADDPFCST is a command that is used to define the Constraint on your physical file. The constraint has several types. These are REFCST, UNQCST and PRIKEY. By the by, this command is helps to define Update rules and Delete rules.

18. How you will establish Referential Integrity in AS/400?
Referential integrity is a relation between two files, the parent file and the dependent file. The relationship establishes that every record in the dependent file has to have a matching record in the parent file.

            By using ADDPFCST command, we can establish in AS/400.

Let we have two PF namely Master and Invoice the fields in Master are CustNo, CustName…. And Invoice PF has the fields are Custnum, Invno, Invdate…

            Now we are going to establish referential constraint to those files.

            File                            : Invoice
            Library                      : xxxxxx
            Constraint type           :*REFCST
            Constraint Key           :Custnum
            Constraint Name        :*GEN
            Parent file                  :Master
            Library                      :xxxxxx
            Parent Key                  :Custno
            Delete Rule                 :*cascade
            Update Rule                :*restrict

            Thus the referential constraint has been created

19. Explain DSPFD and DSPFFD.
Display file description is used to list the total number of records in the files remaining records to be added and other related information about the file.
            Display file field description is used to listing details about individual fields

20. What is Normalization?
Removing replication of data by applying integrity rules is known as Normalization. Suppose a table have empno, empname, age, address, dob, monthyear, salary fields and the table has the following data
101      raja      28        dsfsdfsdfsd     10-4-77            0102    54354
101      raja      28        dsfsdfsdfsd     10-4-77            0202    54354
101      raja      28        dsfsdfsdfsd     10-4-77            0302    54354
101      raja      28        dsfsdfsdfsd     10-4-77            0402    54354
101      raja      28        dsfsdfsdfsd     10-4-77            0502    54354
101      raja      28        dsfsdfsdfsd     10-4-77            0602    54354
101      raja      28        dsfsdfsdfsd     10-4-77            0702    54354

Here the name, age, address, DOB are fixed data. By feeding these data again and again the table size will be expand. So we can put these data another table by using integrity rules. So the table can be split by
PF01 => Empno, empname, age, address, DOB where empno is KEY
PF02 => Empno, Month year, salary

Now PF01 can has only one record and PF02 has 7 records.

21. How you list all LF of PF?
DSPDBR is used to display all the files, which are related to the physical file. It display all the logical files that are referring the physical file and also list the child table, if it has a relationship with that file.

22. What is a Logical File? And give its types?
It is used to access the data in a physical file.
It cannot exist with out a physical file. It can have multiple record formats. By using LF we can change the key field and attribute size. We can filter the data with criteria by using select and omit command. CRTLF command is used to create a LF. It accesses the data by the access path.
            There are two types of LF
            Join Logical files.
            Non Join Logical files.


23. What are the two types of logical files and its difference?
            There is Join Logical files and Non-Join Logical files.

Join Logical Files
Non Join Logical File
Impossible to insert, update and deleting records.
Able to insert, update and deleting records.
Up to 32 record format can be specified
Only one record format can be specified
Commitment control is possible
Commitment control can’t be used


24. What are the 6 level entries of LF?
They are
File level
Record level
Join level
Field level
Key level
Select/omit level entries.

25.  Does a logical file contain data?
No, it contains access path information only.

26. Explain Non-Join Logical file.
Logical files, which can be derived data from one or more than physical file. But not joining themselves is known as Non-join logical file. If it retrieves data from one physical file, then it is single record format and if it is retrieve data from multiple physical file it has multiple record formats.
There are five level entries in Non-Join Logical file.

File level entries
Record level entries
Field level entries
Key level entries
Select / Omit field level entries.

27. DYNSLT – explain.
Dynamic select. It is a file level keyword used to select records during execution time and the record will not be selected until the file is opened in program.

28. Explain Join Logical file.
A Join Logical file that combine, in one record format from two or more physical files. A PF can’t be changed through a JLF. We can’t insert, update and delete records. DFU can’t be used to display a JLF. Only one record format can be specify. Commitment control can’t be used.
Let PF01 has EmpNo, Empname fields and PF02 has EmpNo, Salary. If we join these files by EmpNo, the result will be EmpNo, EmpName, and Salary.



29. What are the mandatory keywords for join logical file?
            JFILE – Record level
            JOIN – Join level
            JFLD – Join level
            JREF – Join level

30. Explain Self-Join with an example.
            Join a file to itself is known as self-join

Let PF01 has the fields of EmpNo, EmpName, Salary, MGRID, Job.and has the following data

101      raja                  43545  10001  engr
102      mohan             34544  10002  manager
103      kannan             43546  10002  clerk   
10001  mani                54654  10002  MD
10002  ganesh             57656 

Suppose the LF has EmpNo, EmpName, and MGRName

101      raja      mani
102      mohan ganesh
103      kannan ganesh
10001  mani    ganesh
10002  ganesh xxxxxx

31. What is access path and what are the various ways to creating access path?
It is a imaginary path, thro’ which the data of a file is accessed for processing. It tells the order in which the record to be retrieved.

There are two types of access path.
Key Sequenced access path.
In case of key sequenced access path, the records accessed according with the key field.

Entry Sequenced access path
In case of Entry Sequenced access path, the records accessed which the order they entered.
Here the record will be accessed by either FIFO or LIFO or FCFO sequence, which is specified in the PF.

Select Omit criteria access path

32.  Name three types of access path maintenance?
There are three ways of building or maintaining the access path.
Immediate
For every operation made on a file, the access path, associated with it, is updated whether or not the path is opened

Rebuild
Access path is maintained when the file is open and various updates are recorded and the access path is rebuilt every time when the access path is closed.

Delay
Access path is maintained when file is opened and updates.

33. Why we need to maintain the access path?
Because more than one access path is associated with one data, changing data in one file might cause changes to be made in other files also.

34. Explain JDUPSEQ and JDFTVAL.
JDUPSEQ is used to specify the order in which records with duplicate join fields are presented when the JLF is read.

JDFTVAL is used the system provides default values for all fields, when a join to a secondary file does not produce any records. If this keyword is not specified a record in the primary file for which there is no corresponding record in secondary file is skipped.

35. Is it possible to insert a record in a JLF?
No. It is impossible to insert / update / delete record in a join logical file.

36.  What keyword is used to join several physical files into one logical file?
JFILE - Join File

37. What are the major differences between PF and LF?

Physical file
Logical file
It contains the actual data so it occupies memory space.
Can not occupy memory space
Single record format
Multiple record formats
Can be exist even with out LF
Can not exist with out PF
If you delete PF the LF also can be deleted.
If you delete a LF, the PF can not be deleted
The object type is PF
The object type is LF
CRTPF command is used to create such object
CRTLF command is used to create such type object

38.  What is the difference between a physical file and a logical file?
            Physical files contain the data, a logical file us an access path to the physical data

39. How many record formats in a LF ad a PF can have?
            PF – One only record format
 LF – 32 record formats
40. Can you copy data from a physical file to a logical file?
No.

41.  What keyword is used to reference the same field in another file?
            REF – Reference

42. What is a Field Reference File?
It is also a physical file, which doesn’t have any data. It has only field description and other physical files can refer these definitions by using ref or reffld keyword. Its type is *PF.

43.  What are two methods of creating a record that consists of fields from two or more files?
Join LF and OPNQRYF.


44.  What command can be used to clear a physical file?
            CLRPFM - Clear Physical File Member

45. What is the keyword VALUES used for?
To set records from a PF based on field values in storage.

46.  What is the keyword COMP used for?
To set records from a PF using a comparison between two field values.

47.  What is the keyword RANGE used for?
To set records from a PF based on a min/max value of a field.

48. How many record formats in a PF, LF, DSPF and SFL?
            PF        => 1
            LF       => minimum 1, maximum 32
            DSPF  => 1024
            SFL     => 512

49.  What is a display file?
A displayable screen file.

50. What are the keyword levels used in Display file?
            File level
            Record level
            Field level

51. What is Menu?
            Menu is a list of short cut commands. We can create Menu thro, STRSDA tool.

52. Define Menu and what is the command to create menu?
Menu is a set of shortcut-commands, which is used to choosing program or commands to execute. In the menu, the text and list of commands are stored in two different objects. The MNUDDS keeps the text and the MNUCMD keeps the list of commands. We are creating menu by using STRSDA command. The default menu name is MAIN. We can check the menu with help of GO command [Syntax GO <menu name>]

53.  In the DDS keyword WINDOW (___), what belongs inside of the parentheses?
Either the coordinates of the window or the name of the record format.

54.  What is the difference between CA and CF command keys?
CA means that screen validity checking is bypassed and no screen data is passed to the program. CF means that screen validity checking is performed and screen data is passed to the program.

55.  What is a printer file?
A print layout for a report that can be used by any program.

56.  Why would a DSPF program use a DSPSIZ keyword?
To select the screen display size used.

57.  What is the INDARA keyword used for?
To store all program indicators into a useable array.

58.  What is the purpose of the OVERLAY keyword?
To allow multiple screen records to display at one time.

59.  How can a programmer control how data on a screen will display?
By using the DSPATR keyword.

60. How you create a trigger?
Trigger is an event to be performed either before or after any change on your database. By using ADDPFTRG we can create a trigger. There are six triggers can be defined each physical file. These are Before-Insert, Before-Update, Before-Delete, After-Insert, After-Update and After-Delete. We can remove the trigger by using RMVPFTRG command.

Suppose that, if we are going to delete some records from primary file, assume that file has the referential constraint to a secondary file. In such case, we have to use the trigger [Delete-Before] for deleting the dependent record from secondary file.
The parameters to be given while creating the trigger are 1. The timing (before/after) 2.The trigger event (update etc) and 3. The PF name

61. What is a Journal?
Journal is an object of type *JRN which will records the activities of the physical file. The information recorded by the journal is stored in an object *JRNRCV called Journal Receiver.

62. Various steps of creating a Journal.

Steps to Start Journaling

            Create a Journal Receiver                               CRTJRNRCV
            (name, library)
            Create a Journal                                              CRTJRN
            (Journal name, library, journal receiver name, journal receiver library)
            Start Journaling of a physical file                   STRJRNPF
 (Journal name, library, physical file(s) name, physical file(s) library, journal receiver name, journal receiver library)
            Backup the physical file                                  SAVOBJ

Steps to end a Journaling

            End journaling a PF                                        ENDJRNPF
            Delete a Journal                                              DLTJRN
            Delete the last Journal Receiver                      DLTJRNRCV
            Save Journal Receivers                                   SAVOBJ

The commands are to be used in case of failure

            Display journal entries                                    DSPJRN
            Apply journal changes                                    APYJRNCHG
            Remove journal changes                                 RMVJRNCHG
            Restore a saved object                                                RSTOBJ

63. Explain Commitment Control.
It is the extension of journaling.
An Integrated transaction recovery function is known as commitment control. Let we are going to insert a record in some files. If system fails before the commit operation, all the database changes are rolled back to the previous commit operation. If the system issues the commit operation, the records are freeing.

Steps involving for a commitment control
§  First you have to create a journal for the physical file, which you want to apply commitment control.
§  You have to give commit keyword in F-Spec keyword.
§   
64. What is the difference in multiple formats LF and join LF?
In both the case we pick up fields from more than one PF, but the multiple format LF wont join the fields and have more than one record format and join LF actually joins the fields and can have only one record format.

65. How will you define the fields in display screen?
            +          To define
            3          Input - numeric
            6          Output - numeric
            9          Both - numeric
            I           Input – character
            O         Output - character
            B         Both – character

66. How will you move the fields in display screen?
            (-) sign in front end and rear end to mark the field.
            (=) to move the field after marked.
            (==) to copy fields after marked.
(<) shift to left.
(>) shift to right.
            (?) to get the field name and length.



67. How will you get the system values in display screen?
            *date   for date.
            *time   for time.         

68. What is the keyword must be used with PROTECT keyword?

            OVERLAY.

No comments