Beruflich Dokumente
Kultur Dokumente
.
ENDSR
669. What is Procedure ?
A procedure is the set of self contained high level language statements that can
perform a particular task and then returns to a caller.
670. How to define a procedure ?
First we have define Procedure Prototype along with all parameter. And PR.
D PROC1 PR
Then define Procedure with Begin/End
Procedure Name Begin/End
P PROC1 B Export
Then define Procedure Interface along with parameter and PI
D PROC1 PI 5 0
D PARMA 5 0
D PARMB 5 0
Define all the parameters as a variable to the procedure
D PARMA S 5 0
D PARMB S 5 0
In not returnable procedure, the procedure should end with
C PROC1 E
In returnable procedure, it should end with
C RETURN PARMA + PARMB
671. What is Procedure Prototype and Procedure Interface.
Procedure Prototype
In this section we specify the name of the procedure along with PR.
D PROC1 PR
Procedure Interface
It is section where we define all the parameter which are receiving or returning
some values.
D PROC1 PI 5 0
D PARMA 5 0
D PARMB 5 0
672. How to define Global Parameter in ILE ?
Declare a variable with key word EXPORT and while using this variable in anther
program declare with
IMPORT keyword.
673. What is the disadvantage of using Global variable?
We can not trace out at which point the value of variable is changed.
674. What is Service Program?
A Service Program is a collection of runnable procedures and available data item
s
easily accessible by other ILE programs. In many respects it is similar to a
subroutine library and procedure library.
A service program differs from a program in two ways:
It does not contain a program entry procedure. This means that you cannot call a
service program using the CALL operation.
A service program is bound into a program or other service programs using bindin
g
by reference.
675. What is the structure of Service Program ? What is signature?
?????????????????????????????
676. What is *ISO date format?
YYYY-MM-DD for other formats refer to IBM manual or ERIS document.
677. If we tried to move year part of *ISO date into a field of length 3, what
will happen ?
Program crashes, as in case of *ISO format it required fields of 4,2,2.
678. How to avoid using indicators in ILE ?
By using the standard Built In Expressions like %FOUND,%EOF, NOT %EOF, %BOF, NOT
%BOF etc.
Display / Printer File
679. EDTCDE & EDTWRD
EDTCDE & EDTWRD are key words used for formatting purpose. EDTCDE cannot be
applied to Character filed. And EDTCDE has some Codes pre-defined for example,
EDTCDE(Z) for suppressing the leading zero Y for date field.
EDTWRD can be used to define user defined formatting for a fields.
680. OVERLAY
It allows a record format to be displayed on screen retaining the previous
displayed record formats.
681. What key word is used when screen is re-display?
RSTDSP is a parameter to be specified at compile time for display file.
682. Command Attention key and Command Function Key ?
With the help of Command attention key we can pass only the indicator status to
program not the data from screen. While command function key passes indicator
status as well as a data from screen to program.
683. How to validate input values in Display file ?
with the help of Validity check key words VALUE, RANGE, COMP
684. Disadvantage of using Validity Check keyword? How to overcome these
disadvantages ?
If invalid values are entered,
The option filed is displayed in reverse image.
System defined message is displayed which may not be user friendly.
Keyboard is locked, we have to reset it.
To overcome above disadvantage validations is done within program and user
friendly/defined message is displayed.
685. What are the important factors in Error message subfile ?
We must define error message record format (SFLMSG). And a Program Queue. (PGMQ)
and Record format is associated to a line number.
686. How to define to define a Hidden filed in DSPF ?
Define a filed in a DSPF of use HIDDEN.(H)
687. How To get the cursor position?
With the help of RTNCSRLOC keyword, here we need to define a field to get row an
d
column. Length of variable should be 5,0 fixed We can specify *FILED for filed
*REC for Record on which a key is pressed.
SQL / 400 Structured Query Language
688. What is the stored procedure and how do you define a stored procedure.
A stored procedure is a program that can be called to perform operations that ca
n
include both host language statements and SQL statements. Procedures in SQL
provide the same benefits as procedures in a hot language. That is, a common pie
ce
of code need only be written and maintained once and can be called from several
programs. Stored procedures can be used in both distributed and non-distributed
applicaitons.
It is defined using DECLARE PROCEDURE statement, syntax is as below
EXEC SQL
DELCARE P1 PROCEDURE
(:PARM1 INOUT CHAR(10))
(EXTERNAL NAME MYLIB/PROC1
LANGUAGE RPGLE
SIMPLE CALL WITH NULLS);
END-SQL
We can have parameters as IN , OUT , INOUT type. Language can be RPGLE, C, CL,
etc.. MYLIB/PROC1 this PROC1 is a program written and compiled separately and it
is of language which you are specifying in section LANGUAGE.
689. Writing an SQL statement from selecting records from TWO files using single
statement and Nested select statement.
Using Single statement.
SELECT * FROM FILE1, FILE2
WHERE FILE1.FLD1 = FILE2.FLD1
Using Nested Select statement
SELECT * FROM FILE1
WHERE FILE1.FLD1 EQ (SELECT FILE2.FLD1 FROM FILE2)
690. How do you achieve referential integrity?
By adding Referential Integrity Constraints to a Physical file or Logical file.
Constraints like PRIMARY KEY, FOREGIN KEY, DELETE RULE, UPDATE RULE. ETC.
Commands are ADDPFCST for Physical file and ADDLFCST for Logical file.
Type of constraints
*REFCST - A referential constraint is being added
*UNQCST - A unique constraint is being added.
*PRIKEY - A primary key constraint is being added
*CHKCST - A check constraint is being added
Type of Delete rule (DLTRULE)
*NOACTION
1. Deleting a record in parent file is permitted (not restricted) if data for a
non-null parent key does not match data for a foreign key.
Deleting a record in a parent file is restricted (does not occur) if data for a
non-null parent key matches data for a foreign key.
*RESTRICT
Deleting a record in a parent file is permitted if data for a non-null parent ke
y
does not match data for a foreign key.
Deleting a record in a parent file is restricted if data for a non-null parent k
ey
matches data for a foreign key.
*CASCADE
The cascade delete rule is used. Deleting a record in a parent file causes
matching records in the dependent file to be deleted when data for a non-null
parent key matches data for a foreign key.
Type of Update rule (UPDRULE)
*NOACTION No Action
*RESTRICT
Updating a record in a parent file is permitted if data for a non-null parent ke
y
does not match data for a foreign key.
Updating a record in a parent file is restricted if data for a non-null parent k
ey
matches data for a foreign key.
691. Where Stored procedure lies in the system.
If we want to have a look where the stored procedure, we can have a look through
SQL.
Select * from?????????????????????
692. Difference between View and Index ?
View will not any data.. It only shows a data from table while Index has a
Indexing Data for a sequence on which Index is created. View is similar to Logic
al
file without having Key and Index is similar to Logical File having Key (as keye
d
logical file has access path data) Table is similar to PF.
693. Can we have records (with fields from more than one file) from multiple fil
es
and Nested / sub query in SQL ?
Yes, we can have record from multiple file with join condition and we also can
have nested query or subquery like SELECT * FROM FILE1 WHERE FILE1.FLD1 IN (SELE
CT
FILE2.FLD1 FROM FILE2)
694. What is the sequence when using CURSOR?
Define Cursor
Declare Cursor
Open Cursor
Fetch record
Processing
Close Cursor
695. Different type of Cursor?
Two types of Cursor
Simple / Serial Cursor
A serial cursor is one defined without SCROLL key word
For serial cursor each row is fetched only once per OPEN
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 which is defined with SCROLL key word.
Cursor defined with SCROLL key word
Rows of cursor can be fetched many times
When it is opened it is positioned before the first row in the table.
When the FETCH is issued , the cursor is positioned to the row of the table that
is specified by the POSITION option. (FIRST, LAST, PREV, NEXT, RELATIVE)
696. How to call / invoke the stored procedure ?
Using CALL command .
697. What are the two important parameter while creating a SQLRPGLE program ?
1) CMTCTL - *NONE (Commitment Control)
CLOSQLCR - *ENDMOD (End of Module) by default is *ENDACTGRP
698. Can we update database file with the help SQL Cursor ?
While declaring the cursor if we specify FOR READ then we cannot update but if w
e
specify FOR UPDATE or nothing (by default is FOR UPDATE) then we can update
database file.
699. Does Opening of cursor locks records ?
Yes, Records selected into cursor are locked when the cursor is opened.
700. What will happen if we call stored procedure again and again ?
It the creation of procedure is included in the called program, then we can have
different set of output depending upon the parameter passed to it. And If creati
on
is outside the called program then we will be available with only one set of
output.
Miscellaneous
701. What is Library?
Library is an AS/400 object of type *LIB. It can contain all types of objects
except another object of
type *LIB
702. What is Library List?
It is sequence of objects of type *LIB, from which we would retrieve or save the
required object.
703. What is Sub-system in as/400?
It is Run-time environment, which provides all the resources required for the
execution of program along with necessary memory space required.
704. What is Trigger?
Trigger are the programs which are activated upon certain event. AS/400 triggers
are file level triggers.
???????????????????/ needs to elaborated more .?????????????????
705. What is difference between Interactive and Batch Job ?
job where user interaction is present is called an interactive job. A job where
user interaction is not required is called a batch job.
706. What is library list ?
list that indicate libraries used for the process and the order in which it has
to
be searched. For example to find an object system will search in the in the
ascending order of libraries mention in library list.
707. What is JOBQ and PRINTQ ?
Jobs go into the job queue in order to run in a subsystem. Print queue where the
printer files (report) reside and wait for their turn to get printed.
708. How to handle run time error in CL Program ?
By using command MONMSG with suitable message identifier
709. What is Data area and how it is used in RPG program ?
Data area is a type of an object which is used for storing data. It is defined
using opcode *NAMVAR. The data is read by "IN" and written by "OUT" opcode.
710. Which program RPG or CL is efficent to update a transaction onto a database
file and why ?
CL program cannot update/write onto a data base file and hence, choice is RPG
program.
711. How QTEMP is different from other libraries ?
It is associated to each job (Other Jobs can't access the other's QTEMP). QTEMP
is
created when the Job is started and deleted when Job is closed.
712. What is OVRDBF and where it is used ?
OVRDBF is a command to temprorarly over ride the parameters of a Data base file.
It is used in association with OPNQRYF, to use different file with same record
format in a program.
713. What kind of job is it --- you have signed on AS400 and then typed Call XYZ
and pgm XYZ is an RPG program which simply reads a database file and generates
report.
It is not a job.
714. What is single level storage ?
Main storage and disk stroage appears contiguous. An object is stored and
retrieved via a device-independent addressing mechanism.
715. What is the difference between OPNQRYF & Logical file ?
OPNQRYF is temporary Logical file. OPNQRYF is used for dynamic selection,
situation where frequency to run the programs is less & very large number of
records are present in data base file.
716. Why can't a database file be used in place of data area ?
Using database file will reduce the performance of application.
717. What does STRSRVJOB command used for ?
It is used to debug the batch programs or debug the interactive program of anoth
er
job.
718. What is difference between Physical file and Logical File ?
Physical file contain data where as logical file serve as access path.
719. How many record formats can you have in a Physical & Logical file?
Physical file can contain only one record format where as Logical file can have
more than one record format.
720. Which is the better option to write a transaction (order header and detail
transaction) using two physical files or one join logical file(on those two
physical files) in a program and why ?
Using two physical files is the better option because records can't be written
through join logical file.
721. Can we have a multi record format join and non join logical file based on o
ne
physical file ?
We can only have Join logical file based on one physical file.
722. What is difference between Journaling and commitment control ?
Journaling record all transactions and is used for restoring or reverting back t
he
transactions onto the database file for a particular time span. Committment
control ensures that a transaction is updated successfully onto the data base (a
ll
relevant files).
723. What is difference between Multi record format Join and Non- Join logical
file ?
Multi record format logical file contain more than one record format( based on o
ne
or more physical file) With join logical file only read operation can be done
whereas in non-join logical file all operations can be done.
724. What is the difference between triggers and referential integrity ?
Triggers are programs (which carry out a particular business function) invoked
either before or after manipulation of the records in a database. Referential
integrity maintain the integrity of a database using key fields.
725. Can a file be journaled without using it under commitment control ?
Yes
726. Can a file be used under commitment control without being jorunaled ?
No
727. What is difference between module and program ?
Module is a non-runnable object where as program is runnable.
728. What is difference between ILE RPG and RPG/400 ?
Difference is in program development (specification), program creation (create
module, bind module to create program), program running (activation group,
resource sharing).
729. What are different types of Arrays and what is the difference between them
?
There are 3 types of arrays Compile time, Pre-Run time and Run time. Compile tim
e
array gets value at the time of compilation of the source of a program. Pre-run
time array gets value from a file at the beginning of a program execution (befor
e
any statement of a program is executed). Run time array gets value during the
program execution.
730. What is a data structure ? What are its uses ?
A data structure is a variable field which is partitioned by defining variable
fields (call as Sub fields). Various uses are converting character value into
numeric, splitting date field into day, month and year, combining various key
fields to make one key field and so on.
731. What is Multi occurence data structure ?
It is an array of a Data structure.
732. Can an indexed file (File with key fields) be accessed in arrival sequence
in
an RPG program ?
Yes, don't specify "K" in F specification in the program for this file.
733. What is the difference between *LIKE and *NAMVAR opcode?
*LIKE defines program variable same as that of another pre defined variable.
*NAMVAR is used to define variable as Data area.
734. What is the difference between SKIPA & SPACEA ?
In a printer file the printing control goes to the line (of the page) mention in
SKIPB where as it leaves number of lines mention in SPACEB
735. How to handle run time error in RPG Program ?
by using indicator on statement, subroutine *PSSR
736. How will you display a particular page (or record) in a Sub file?
Move a valid relative record number(RRN) in the field specified using SFLRCDNBR
keyword in DDS
737. What is difference between Command Function and Command Attention key?
Command function key returns variable value along with response indicator
(associated with CF key) where as Command attention returns only the response
indicator value.
738. What are different type of Sub files ?
There are three types of Subfile (1) Load all Subfile (Page Size =9999) (2)
Extendable Sub file (Sub file size > Sub file page), (3) Load by Page (Sub file
size = Sub file page)
739. What is SFLNXTCHG keyword used for ?
To read the change records for 2nd, 3rd,...times from sub file after reading the
m
once.
740. What is SFLROLVAL keyword used for ?
It specify the number of records to roll in a subfile.
741. What is difference between keyword SFLCSRRRN & RTNCSRLOC ?
RTNCSRLOC returns the location of cursor into the variable (associated with this
keyword) and SFLCSRRRN returns the relative record number where the cursor is
positioned.
742.What's the difference between CHAIN and SETLL? Is there a performance
advantage?
There are two important differences between CHAIN and SETLL.
The CHAIN operation applies a record lock to files that are open or update. The
SETLL operation does not apply the lock.
The CHAIN operation copies the record's data to the input buffer for the program
.
The SETLL operation does not.
IBM AS\400 Interview Question