AS400 interview questions and answers-Part 3
1. What is logical file in AS400? What are the types of logical file?
Ans:
Logical file
·
Logical file does not occupy any memory.
·
One or more logical file can be derived from a
single physical file.
·
It simply contains the record selection
definition and when accessed retrieves the records from the physical file to
which it refers.
·
A logical file can contain up to 32 record
formats.
·
It selects records dynamically. It cannot exist
without a physical file.
·
We can filter the data with criteria by using select
and omit command.
·
A logical
file does not contain any data but provides the ‘VIEWS’ of the data to satisfy
end-user’s needs.
Ü Types of
Logical file
There are two types:
1)
Non-join logical file
2)
Join logical file
1) Non-join
logical file
Non-join logical files can either be a simple logical file, which
contains only one record format or a multiple record format logical file, which
contains more than one Record format.
Logical files can be derived from 1 to 32 physical files and so a logical
file can have a maximum of 32 record formats.
ü Single record format Non-join logical file:
If a logical file is derived from single physical file
it is called simple logical file.
Columns . . . : 1 71 Browse AMINEM/DDSSRC
SEU==> MULTIFRMT
FMT LF .....A..........T.Name++++++.Len++TDpB......Functions++++++++++++++++++
*************** Beginning of data *************************************
0002.00 A R ACCOUNT PFILE(AMINEM/ACCOUNT)
0003.00 A K ACCOUNTNUM
0005.00 A K ACCURRENCY
ü Multiple record format Non-join logical file:
·
Multiple record non-join logical files will
select records from 2 or more physical files by referring to only one logical
file.
·
Each record format is always associated with one
or more physical file.
·
The same PF can be used in more than one record
format.
Columns . . . : 1 71 Browse AMINEM/DDSSRC
SEU==> MULTIFRMT
FMT LF .....A..........T.Name++++++.Len++TDpB......Functions++++++++++++++++++
*************** Beginning of data *************************************
0002.00 A R ACCOUNT PFILE(AMINEM/ACCOUNT)
0003.00 A K ACCOUNTNUM
0005.00 A K ACCURRENCY
0006.00 A R TRANS PFILE(AMINEM/TRANS)
0007.00 A K TACCOUNT
0008.00 A K TCURRENCY
****************** End of data ****************************************
2. What is DYNSLT?
Ans:
DYNSLT:
Use this file-level keyword to indicate that the selection and omission tests
specified in the file (using select/omit specifications) are done at processing
time. This keyword specifies dynamic select/omit rather than access path
select/omit.
Only a Physical file contains data. Logical
files just contain pointers for processing the data in a specific sequence
and/or subset of data.
When a record is added/changed/deleted in a physical file, the system has to
put a lock on it and then go out to check and update any logical files before
it can release the lock. While the amount of time to do this is hardly
measurable, it can be significant if massive batch updates are done to a file.
If you are using the Select/Omit option in your DDS and using DYNSLT, the above
process does not need to be done at record
update time.
Where this is beneficial is when your selection process includes almost all the
records in the file. Now when you process using DYNSLT, it will read all the
records in the file, but do the selection of which records to process at that time rather than having done all the maintenance
ahead of time.
3. What is the Difference between access path and Dynamic select?
Ans:
Dynamic select occurs whenever the program reads file. But access path occurs
before the file is read (but not
necessarily).
4. What is the use of JDUPSEQ in AS400?
Ans:
JDUPSEQ
This join–level keyword is used to
specify the order in which records with duplicate join fields are presented
when the JLF is read.
The format
for this keyword is:
JDUPSEQ (Sequencing field-name [*DESCEND])
ü
This keyword has no effect on the ordering of
records with unique keys.
ü
If *DESCEND is not specified then the default is
sequencing in ascending order.
Example: JDUPSEQ (Sequencing Duplicate Objects)
Columns . . . 1 71 Edit AMINEM/EXAMPLE
SEU==> SEQ1
FMT PF.
*************** Beginning of data ***********************
0001.00 R SEQREC1
0002.00 EMPNO 5P 0
0003.00 EMPNAME1 20A
0004.00 ADDRESS 20A
0005.00 K EMPNO
****************** End of data **************************
EMPNO EMPNAME1 ADDRESS
000001 10,001 BOB 23,OLD MADIWALA
000002 10,002 DANNY 50,LONG ISLAND
000003 10,003 PRINC 90,ATTUR
****** ******** End of report ********
Columns . . . 1 71 Edit AMINEM/EXAMPLE
SEU==> SEQ2
FMT PF
*************** Beginning of data****************
0001.00 R SEQREC2
0002.00 EMPNO 5P 0
0003.00 EMPNAME 20A
0004.00 TEL 10P 0
****************** End of data ******************
EMPNO EMPNAME TEL
000001 10,001 BOB 825,777
000002 10,001 BOB 825,999
000003 10,001 BOB 825,888
000004 10,002 DANNY 4,222,600
****** ******** End of report ********
Columns . . . 1 71 Edit AMINEM/EXAMPLE
SEU==> JDFTSEQ
FMT LF
*************** Beginning of data ******************
0001.00 R RECSEQ JFILE (SEQ1 SEQ2)
0002.00 J JOIN (1 2)
0003.00 JFLD (EMPNAME1 EMPNAME)
0004.00 JDUPSEQ (TEL)
0005.00 EMPNO JREF (2)
0006.00 EMPNAME1
0007.00 ADDRESS
0008.00 TEL
****************** End of data************************
EMPNO EMPNAME1 ADDRESS TEL
000001 10,001 BOB 23,OLD MADIWALA 825,777
000002 10,001 BOB 23,OLD MADIWALA 825,888
000003 10,001 BOB 23,OLD MADIWALA 825,999
000004 10,002 DANNY 50,LONG ISLAND 4,222,600
****** ******** End of report ********
5. What is the use of JDFTVAL in AS400?
Ans:
JDFTVAL
·
When this file-level keyword is used the system
provides default values for all for 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 the secondary file
is skipped.