AS400 Interview Questions and Answers part 35

AS400 Interview Questions and Answers part 35
AS400 Interview Questions and Answers part 35, module vs program, qtemp, sql cursor, cmtctl *NONE, closqlcr *endmod, sqlrpgle program, SQL call, stored procedure, types of cursor, serial cursor, scrollable cursor, serial vs scrollable cursor, SQL select, nested sql select, VALUE, RANGE, COMP, validity checked keyword in dspf, rstdsp parameter in dspf
AS400 Interview Questions and Answers part 35

Q1:What keyword is used when screen is re-display?

Answer: RSTDSP is a parameter to be specified at compile time for DSPF.

Q2:How to validate input values in dspf?

Answer: using the validity checker keywords such as VALUE, RANGE, COMP.

Q3:Write an SQL select statement for selecting records from two files using single statement and nested select statement?

Answer:

  • Using single select statement: select * from file1 a, file2 b where a.fld1 = b.fld1
  • Using nested select statement: select * from file1 awhere a.fld1 = (select b.fld1 fom file2 b)
  • Q4:Different types of cursor?

    Answer: SQL supports 2 types of cursor.

  • Serial Cursor: It is defined without SCROLL keyword and each row is fetched only once per open and when it is opened it is positioned before the first row in the table. To use serial cursor we have to re-issue OPEN
  • Scrollable cursor: This type of cursor defined with SCROLL keyword and rows of this cursor can be fetched many times and when it is opened it is positioned before the first row in the table. When the FETCHis issued, the cursor is positioned to the row of the table that is specified by the POSITION option. (FIRST, LAST, PREV, NEXT, RELATIVE)
  • Q5:how to call/invoke the stored procedure?

    Answer: Using CALL command.

    Q6:What are the 2 important parameters to consider while creating SQLRPGLE program?

    Answer:

  • CMTCTL - *NONE (commitment control)
  • CLOSQLCR - *ENDMOD (End of Module) by default is *ENDACTGRP
  • Q7:Can we update database file with the help of SQL cursor?

    Answer: if we specify FOR READ while declaring the cursor then we cannot update but if we spcify nothing or FOR UPDATE(default is FOR UPDATE) then we can update the database file.

    Q8:Does opening of cursor locks record?

    Answer: Yes, records selected into cursor gets locked when the cursor is open.

    Q9:How QTEMP is different fom other libraries?

    Answer: QTEMP is associated to each job and is unique to each job which means each job has its own qtemp and other jobs cannot access others qtemp. Qtemp is created when the job is started and deleted when the job is closed.

    Q10:What is the difference between module and program?

    Answer: Module is a non-runnable object where as program is runnable.

    Post a Comment

    © AS400 and SQL Tricks. All rights reserved. Developed by Jago Desain