AS400 interview questions and answers-Part 4

1. What is the difference between non-join logical files and join logical files?


Non join logical file

Join logical file

We can insert or delete or update records using non-logical file.

Insertion, updating or deletion of records is not possible in join logical files.

DFU can be used to display non-join logical file.

DFU is not available

1-32 record format is specified

Only one record format can be specified

Commitment control is used

Commitment control cannot be used.


2. What is the difference between physical file and logical file?


Physical file

Logical file

1. Occupies the portion of memory. It’s containing data. 

Does not occupy any memory space. Does not contain any data.

2. A physical file contains one record format

 A logical file can contain up to 32 record formats.

3.Can be exist even without LF

Can’t exist without PF

4. The PF can’t be deleted, if dependent logical file exists in the system.

The LF can be deleted without deleting the PF.

5.CRTPF command is used to create such object

CRTLF command is used to create such type object



3. How to join more than two files in AS400?


Below is the example showing how to join 3 files (MASTER PARTYD TRANSACT)

Columns . . . :    1  71            Edit                           AMINEM/PRJ1
 SEU==>                                                                  LOGIC1
 FMT LF .....A..........T.Name++++++.Len++TDpB......Functions++++++++++++++++++
        *************** Beginning of data *************************************
0002.00      A          R LOG1                      JFILE( MASTER PARTYD TRANSACT)
0003.00      A          J                           JOIN( MASTER PARTYD)       
0004.00      A                                      JFLD( PARTY  PNUM)         
0005.00      A          J                           JOIN( MASTER TRANSACT)     
0006.00      A                                      JFLD( ACC ACCOUNT_NO)      
0007.00      A            ORG                                                  
0008.00      A            ACC                                                  
0009.00      A            CCY                                                  
0010.00      A            PNUM                                                 
0011.00      A            PNAME                                                
0012.00      A            PADDR                                                
0013.00      A            TRAN_NO                                              
0014.00      A            TRAN_TYPE                                            
0015.00      A            TRAN_AMT                                             
0016.00      A            TRAN_YEAR                                             
0017.00      A            TRAN_MONTH                                           
0018.00      A            TRAN_DAY                                             
0019.00      A          K ORG                                                   
0020.00      A          K ACC                                                  
0021.00      A          K CCY                                                  
        ****************** End of data ****************************************



4. What are the record format field mapping options in CPYF?



 Record format field mapping (FMT)


Fields with the same name in the from-file and to-file record formats are copied, and any fields in the to-file that do not exist in the from-file format are set to the default value specified on the DFT keyword for the data description specification (DDS) of the to-file or zero for numeric fields, blanks for character fields, current date/time for date/time fields, or null value for null-capable fields.

If *MAP is specified, *DROP can also be specified.



This value must be specified for field-level mapping if any of the field names in the from-file record format do not exist in the to-file format. If *DROP is specified, *MAP can also be specified. When *DROP is specified, all the field names that exist in both record formats must have the same attributes and relative positions in the from-file and to-file record formats, or *MAP must also be specified. Null values are copied.



 If the record formats of the database files are different, the copy operation continues despite the differences. Record data is copied directly (left to right) from one file to the other. FMTOPT (*NOCHK) is required when copying all record formats from a logical file with multiple formats (when RCDFMT (*ALL) is specified) to a physical file that is of the same type (source or data) as the from-file.



This value is used to copy between database files, from a source file to a data file, or from a data file to a source file. It is valid only when the from-file and to-file are different types (source and data).


5. What is the Difference between CRTDUPOBJ and COPYF?

Ans: In CRTDUPOBJ for a logical file the created duplicate file will be also logical file and for a physical file the created file will also be a physical file. Even the record format identifier will also be the same. While in case of COPYF, if we are copying a logical file then the created file be a physical file not a logical file.


6. What is access path in AS400?


Access path

ü  Access path describes the order in which records are to be read.

ü  Access paths can be kept on the system permanently (such as physical or logical file) or temporarily.

ü  OPNQRYF command may create a temporary access path for use one time, and then discard the access path.


7. What are the types of access path? How to change the access path of a file?


 Types of Access Path

· Arrival sequence access path

· Keyed sequence access path


· Arrival sequence access path

ü Sequentially, where each record is taken from the next sequential physical position in the file.

ü Directly by relative records number, where the record number is identified by its position from the start of the file.


· Keyed sequence access path

ü It is based on the contents of the key fields as defined in DDS. This type of access path is updated in the contents of a key field is changed.

ü There are three ways of bounding the access path:

o Immediate

o Rebuild

o Delayed


Ø  Change access path of a file: We use CHGPF to change the access path maintenance parameter as shown below.  

***Note: RGZPFM can also be used to change the access path of a file.


Access path maintenance (MAINT) parameter of a physical file


             Change Physical File (CHGPF)
Type choices, press Enter.
Physical file . . . . . . . . . Name
Library . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB
System . . . . . . . . . . . . . *LCL *LCL, *RMT, *FILETYPE
Source file . . . . . . . . . . *NONE Name, *NONE
Library . . . . . . . . . . . Name, *LIBL, *CURLIB
Expiration date for member . . . *SAME Date, *SAME, *NONE
Maximum members . . . . . . . . *SAME Number, *SAME, *NOMAX
Access path size . . . . . . . . *SAME *SAME, *MAX4GB, *MAX1TB
Access path maintenance . . . . *SAME *SAME, *IMMED, *REBLD, *DLY
Access path recovery . . . . . . *SAME *SAME, *NO, *AFTIPL, *IPL
F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display
F24=More keys

*** 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 (this data may be key field data of other file) in the file.

But the same data can have access path in multiple file. Some files may be open at that time and some file may be closed at that time. For open file, the access path for will change at the time related data is modified. But for closed file how the access path will change is being decided by this MAINT parameter.

e.g. The account no. field may be used by many a files as a part of composite key field. In such a case if a file is updating this account no. field or adding one more account no., in such a case what should be the effect of this change if the other file using this filed is not open at that time the change is made.

The three ways of maintaining access paths of closed files are:

ü *IMMED: 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.

ü *REBLD: 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.

ü *DLY: 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.


8. What is the default access path of a file?

Ans: If you do not specify the type of maintenance for a file, the default is immediate maintenance.




User Comments:



Copyright ©, 2013-2018. Copyright notice