Monday 6 August 2012

ibm as400 interview questions and answers

IBM AS-400 Interview Questions-->1



1.   Define a shared access path?
To share the open data path by various programs in a same job.

2. What is the difference between array and a multiple occurrence data structure?
The values stored in array don’t vary.  In the other hand, we can store the
Different values in same variables at various stages.

3.  What is *INZSR used for?
It is special type of RPG/400 subroutine, which is executed automatically
at the beginning of the program. It is a good place to code initializes the variables.

4.  How can you execute a command from within an RPG program without calling a CLP program?
By calling QCMDEXC application program interface we can execute a CL command with in an RPG program.

5.   What is the purpose of the "N" in the following calculation specification?
C     KEY         CHAIN FILE        N           99

If you specify ‘N’ in 53rd position, the record will not be locked if you try to read the locked record.  It is a way of avoiding the record lock.
         
6.    Which of the following operations does NOT zero the field FLDA defined as 4,0?

                   C                 MOVE  *ZEROS      FLDA
            C                 Z-ADD *ZEROS      FLDA
            C                 Z-ADD 0           FLDA
            C                 MOVE  *ALL'0'     FLDA
            C                 SUB   FLDA        FLDA
            C                 MOVE  '0000'      FLDA
            C                 CLEAR FLDA
            C                 MOVE  *BLANKS     FLDA

          The last instruction does NOT zero the field FLDA.

7.      How can you check for a records existence without causing and I/O (CHAIN/READ)?
With the help of File Information Data Structure, we can check existence of records in a physical file. The code is described below:
In File description continuation line (IPFK),
                                                     
                                                               KINFDS RCDS
            IRCDS DS
            I                                        *RECORD        #RCDS

With the above code we can check the existence of records in a file without causing I/O operation.

8.  Define what a data area is along with a brief example of what it may be used for?

Data area is a storage area to store limited information. 
Example: a new and unique customer number is generated whenever a new customer is added to customer master file. Data area keeps track of last record added and adds 1 to it. Through program we can access new customer number. 

9.  Define what a data queue is along with a brief example of what it may be used for?

Data queues provides communication between programs by calling API's QSNDDTAQ and QRCVDTAQ along with parameters like data queue name, library in which data queue exists, variable to store the number of characters to be sent, variable to store the information to be sent. We can send the same data queue to the many programs.

10.   What is the purpose of the following?

I     'CLOSED'    C     STAT01
I     'OPEN'      C     STAT02

It is a type of initializing the variables in I-spec.  And these are further used in C-spec.

11.   What is the difference between UDATE and the system date?
UDATE supports two-digit year. The format is *MDY (MMDDYY).
*DATE (system date) supports four digit year. The format is *MDYY (MMDDYYYY).

12.   List some of the commonly used commands for debugging
STRDBG (for batch jobs), STRISDB
.

13.   Define the RCVF command?
RCVF command used to receive the records either from the data base file or device file.

14.   Define the purpose of the %SST function?
To extract the information from the specified string.

15.   Define the purpose of the *CAT function?
To concatenate the two strings into a one string.

16.   Define the purpose of the *BCAT function?
To concatenate the two strings by placing a single blank in a resultant.

17.   Describe the difference between the DOWxx and DOUxx operations?

DOWxx :  If the condition becomes true, then only the group of instructions allowed executing.
DOUxx  :  Irrespective of condition, it will execute at least one time.
         
18.   Define the purpose of the LEAVE operation?
         
If you specify LEAVE, the control transfers to the statement below the ENDDO.

19.   Define the purpose of the ITER operation?

If you specify the ITER, the groups of statements are allowed to execute repeatedly.

20.   List the steps/commands necessary to accomplish the following:

a.       Copy data from the file ORDHDR into file ORDHIST
b.       The file ORDHIST may or may not exist
c.       If the file ORDHDR does exist, it may or may not contain data
d.       The file ORDHIST may or may not contain data, if the file does                             contain data the old data should be erased

          Commands:             a.      CPYF FILE (ORDHDR) TOFILE (ORDHIST)
                        b.      CPYF FILE (ORDHDR) TOFILE (ORDHIST)      CRTFILE (*YES)
c.      CPYF FILE (ORDHDR) TOFILE (ORDHIST)  *ADD
d.      CPYF FILE (ORDHDR) TOFILE (ORDHIST)  *REPLACE

21.   What is the purpose of the following?

          FORDHDR1    IF    E           K           DISK
            ORDHDRF                       KRENAMEORDHDRF1

In order to rename the record format of a data base file in a program,
 we can use the above steps.  Purpose of renaming is: If the record format name is similar in two files and if both are used in a same program, the program will not compile.  Hence we have to rename either of the file.  
  
22.   What is the purpose of the following

      C/COPY      QRPGSRC, ORDERR

          During the compilation the source code of ORDERR copy book is copied into the                                                        existing program.   Where as /COPY is compiler directive statement.

23.   What is the purpose of the following

      FORDHDR1    CF    E                       WORKSTN
                                    $2SFN SFILE FMT2

The above line indicates that, $2SFN is a relative record number and FMT2 is   name of the subfile record format.

24.   What is the purpose of the following

I     UDS
      I                 1     60ORDER#
      I                 7     90LINE#

The purpose is to define the variables in I-Spec and these are further used in C-spec.  Where as ‘U’ indicates data area data structure? The above code is used to update       the data area value through the program.   The letter "U" indicates that the defined data structure is a data area data structure.  

25.   What is the purpose of the following?

A     CSRLOC (F1ROW     F1COL)

Using this record level keyword, you can specify cursor location on an output operation to the record format you are defining.   The program sends output after        setting the cursor location.

26.   What is the difference between SFLCLR and SFLINZ?

          SFLCLR:  It clears the subfile.
          SFLINZ: First it clears the subfile and initializing the numeric variables with zeros and alphanumeric variables with characters.

27.   Define the purpose/use for SFLRNA?
Using this, we can make specified subfile record format inactive.

28.   Define what the operation will do, the purpose of the result field and the purpose of *IN66?
                                                 HI LO EQ
      C                 CALL 'CVTDAT'     DTPRM          66
     
          The above statement causes, call the program and pass the parameter.

29.   Define each of the following operation codes

a.       READ  To read the records sequentially.
b.       READE To read the equal key records
c.       READP To read the previous records
d.       READC To read the records from the workstation file (Subfile).
e.       REDEP To read the equal key previous records.


30.   Define the purpose of the following code (If you know, how would this be written in RPG ILE)
                               HI LO EQ
      C           *IN66       DOUEQ *OFF
      C           KEY1        CHAIN       FILEA     90 66
      C           66                CALL        PGM1        PRM
      C                       ENDDO

Whenever the indicator *IN66 becomes *OFF, the control transfers after ENDDO statement.   Otherwise, it reads the records from the data base file based on indicator specified on HI position.  If the specified indicator on LO position becomes *OFF, then only CALL statement will execute. 

0 comments:

Post a Comment