Monday 6 August 2012

ibm as400 interview questions



IBM AS-400 Interview Questions-->2


31. How do you set the keywords SFLSIZ and SFLPAG if you want the subfile to dynamically expand?
SFLSIZ > SFLPAG.  

32. When would you use or not use this approach?
It is the most desirable method in building real time applications.  We can use at all the times.

33.      How can you detect and handle a record lock situation?
If you try to read the locked record, we can get system defined message i.e. the program will ended abnormally.With the help of File Information Data Structure we can handle record lock situation.Generally it will happen, when the same file of type “U" used in different programs.

34. How can you detect overflow for a print program that prints multiple lines per cycle?
You specify the indicators OA through OG and OV in 33 - 34 columns in a printer file.   This indicator automatically set on whenever overflow occurs on a type of   page.

35. How would you design the process for a nightly, high volume check producing process that needs to select only records that are flagged to be processed?
With the help of OPNQRYF Clp command, we can select the records from the data base file.   The process involves following steps:

          Steps:1.   OVRDBF with SHARE (*YES)
                   2.    OPNQRYF
                   3.    CALL the program
                   4.    DLTOVR
                   5.    CLOF

36. How would you join 3 separate fields, a first name, middle initial and last name    together as 1 field with proper spacing?  You can describe in either RPG and/or RPG ILE   (Integrated Language Environment)
   
                MOVE 'Dr. '            FNAME 3               
            MOVE            'JOHN'        MNAME 4
            MOVE 'WATSON'    LNAME 6
FNAME       CAT         MNAME: 1    VAR1              8
VAR1        CAT         LNAME: 1    VAR2             15
            DSPLY             VAR2       
            MOVE             *ON                *INLR

37. When PGMA calls PGMB for the first time PGMB executes the *INZSR.   PGMB  uses the RETRN operation to return to PGMA. When PGMA call PGMB the second time is the *INZSR executed?
If you specify RETRN in called program, the *INZSR will not execute again.

38. Show 2 ways to convert a date from YYMMDD to MMDDYY (MULT operation not acceptable)
           
1) CVTDAT DATE ()    RTNVAR (  )    FROMFMT (  )   TOFMT ( )
Source code is required to convert from one date format to another date format.
       The source code in CLP is given below:

                  PGM
                  DCL    VAR (&VAR1) LENGTH (6) TYPE (*CHAR) VALUE ('YYMMDD')
                  DCL    VAR (&RCVD) LENGTH (6) TYPE (*CHAR)
                  DCL    VAR (&VAR2) LENGTH (4) TYPE (*CHAR)
                  DCL    VAR (&VAR3) LENGTH (2) TYPE (*CHAR)
                  CHGVAR VAR(&VAR2)  VALUE(%SST(&VAR1 3 4))
                  CHGVAR VAR(&VAR3)  VALUE(%SST(&VAR1 1 2))
                  CHGVAR VAR(&RCVD) VALUE(&VAR2 *CAT &VAR3)
                  SNDMSG MSG (&RCVD) TOUSR (*USRPRF)
                  ENDPGM
                 
39. Determine the value of the result field
                  
          a.       Cost = $110. 00
          b.       Tax = 20%
          c.       MarkUp= 05%
          d.       Sale = 10%
          C        Eval    TotalCost = ((Cost * MarkUp) * Tax)) - Sale =  1. 0$


40. Define the purpose of Factor 1 the Operation Code and *IN15 in following code
                                                                      HI LO EQ
   C      *YMD     Test (D)    yymmddDate        15     
                                                                     
If the factor 1 value matches with factor2 value, the indicator specified in EQ comes *ON.

41. Describe the function of SETLL operation in RPG language?
The SETLL operation positions a file at the next record with a key or relative record  number that is greater than or equal to key or relative record number specified in   factor1. 

42. Describe the function of SETGT operation in RPG language?
The SETGT operation positions a file at the next record with a key or relative record number that is greater than key or relative record number specified in factor 1.

43.  What is the purpose of Level Check parameter in a Physical file?
Specifies whether the level identifiers of the record formats in the physical file are checked when the file is opened by the program.

44. Define a Job Queue?
Job queues are queues of batch jobs waiting to be processed.

45. Define a Output Queue?
Output queues are queues of jobs waiting to be printed.

46. What is the function of CPYSPLF command?
It copies the spooled file to the data base file.

47. What is the function of CPYF command?
To copy the data from the one file to another.

48. What is the function of CRTDUPOBJ command?
To create the replica from the original object.

49. Define Subsystem?
Subsystem is nothing but it provides specialized environment to complete the execution of jobs.

50. What are different types of Subsystems?
QBATCH, QINTER, QSPL, QCMN, QCTL, QBASE.
                                              
51. Define a Batch Job?
 * A user request the job.
 * The job is created (job name is assigned, job attributes are allocated)
 * The job is placed on a job queue
 * The sub system QBATCH takes the job from job queue and starts it.
 * Output generated by the batch job is placed on an output queue.
 * The spool sub system prints the output on the output queue.

52. Describe about Query/400?
Query/400 is a licensed program that uses a query to analyze and select the information contained in the data base files and create a query report.  
A query report can be:
 * displayed on a workstation (screen)
 * printed
 * stored in another database file.

53. What is the CLP command to access a Query/400?                                        
WRKQRY

54. Purpose of Overrides?
The basic purpose of Overrides is to temporarily change the attributes of a file.   So you don’t have to create permanent files for every combination of attributes your application might need.   Override gives you the flexibility to use existing model files and   dynamically change their attributes.

55. Define Data Structure?
Data structures are specified in the Input specifications of an RPG/400 program to define an area in storage and layouts of related sub fields.

56. What is the purpose of Data structure?
          * Divide a field in to sub fields
          * Change the format of a field
          * Group non-contiguous data in a contiguous format
          * Define an area of storage in more than one format
          * Define Multiple occurrences of data structures.

57. List and explain the different type of data structures?
          * Data area data structure
When the data area is defined in an RPG/400 program as a data area data structure, its data is implicitly retrieved for processing and written back at the end of the program.  In the data area data structure, letter "U" must be entered to define the data structure as a data area data structure.

          * File information data structure
A file information data structure provides exception/error information that may be occurred when processing a file during program execution.   This type of data structure contains pre defined sub fields that identify
                   * The name of the file for which the error occurred
                   * The record processed when the error occurred
                   * The operation being processed when the error occurred
                   * The status code number
        
          * The RPG/400 routine in which the error occurred.
Exception errors may be controlled by testing for an error code in the *STATUS field which is included in a file information data structure.   Specifically, keywords including *FILE, *RECORD, *OPCODE, *STATUS, *ROUTINE provide the previously named information.

       * Program status data structure
Program status data structure however identity exception/errors that are generated in the program by RPG/400 operations and not by a file.   Note that any code greater than 00099 is flagged as an exception/error.   Four keywords - *STATUS, *ROUTINE, *PROGRAM, *PARMS are supported by a program status data structure.

58. What is the purpose of DYNSLT keyword?
This is a file level keyword used in a logical file.   If you specify this in a file level, the system doesn't perform record selection until the program reads file.   Then on the Select/Omit criteria, it selects the records from the specified file.

59. What is the difference between access path and Dynamic select?
Dynamic select occurs whenever the program reads file.   But access path occurs before the file is read (but not necessarily), because access path maintenance performed on the file.

60. Why would you prefer OPNQRYF than logical file?
The main difference is: Logical file creates permanent object on the system.  OPNQRYF creates temporary access path. 


1 comments: