Ans:Declare a variable with key word EXPORT and while using this variable in anther program declare with
IMPORT keyword.
What is the disadvantage of using Global variable?
Ans:We can not trace out at which point the value of variable is changed.
What is Service Program?
Ans:A Service Program is a collection of runnable procedures and available data items 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 binding by reference.
What is the structure of Service Program ? What is signature ?
What is *ISO date format?
Ans:YYYY-MM-DD for other formats refer to IBM manual or ERIS document.
If we tried to move year part of *ISO date into a field of length 3, what will happen ?
Ans:Program crashes, as in case of *ISO format it required fields of 4,2,2.
How to avoid using indicators in ILE ?
Ans:By using the standard Built In Expressions like %FOUND,%EOF, NOT %EOF, %BOF, NOT %BOF…etc.
Display / Printer File
Explain the keywords EDTCDE & EDTWRD
Ans:
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.
Disadvantage of using Validity Check keyword? How to overcome these disadvantages ?
Ans: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.
What are the important factors in Error message subfile ?
Ans:We must define error message record format (SFLMSG). And a Program Queue. (PGMQ) and Record format is associated to a line number.
How to define to define a Hidden filed in DSPF ?
Ans:Define a filed in a DSPF of use HIDDEN.(H)
How To get the cursor position?
Ans:With the help of RTNCSRLOC keyword, here we need to define a field to get row and column. Length of variable should be 5,0 fixed We can specify *FILED for filed *REC for Record on which a key is pressed.
What is OVERLAY?
Ans:It allows a record format to be displayed on screen retaining the previous displayed record formats.
What key word is used when screen is re-display?
Ans:RSTDSP is a parameter to be specified at compile time for display file.
Command Attention key and Command Function Key ?
Ans: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.
How to validate input values in Display file ?
Ans:With the help of Validity check key words VALUE, RANGE, COMP
What is the stored procedure and how do you define a stored procedure.
Ans:A stored procedure is a program that can be called to perform operations that can 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 piece 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 applications.
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.
Using Nested Select statement
SELECT * FROM FILE1
WHERE FILE1.FLD1 EQ (SELECT FILE2.FLD1 FROM FILE2)
How do you achieve referential integrity?
Ans: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 key does not match data for a foreign key.
Deleting a record in a parent file is restricted if data for a non-null parent key 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 key does not match data for a foreign key.
Updating a record in a parent file is restricted if data for a non-null parent key matches data for a foreign key.
Where Stored procedure lies in the system.
Ans:If we want to have a look where the stored procedure, we can have a look through SQL.
Select * from
Different type of Cursor?
Ans: 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)
Writing an SQL statement from selecting records from TWO files using single statement and Nested select statement.
Ans: Using Single statement.
SELECT * FROM FILE1, FILE2
WHERE FILE1.FLD1 = FILE2.FLD1
Difference between View and Index ?
Ans: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 Logical file without having Key and Index is similar to Logical File having Key (as keyed logical file has access path data) Table is similar to PF.
Can we have records (with fields from more than one file) from multiple files and Nested / sub query in SQL ?
Ans: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
(SELECT FILE2.FLD1 FROM FILE2)
What is the sequence when using CURSOR?
Ans: Define Cursor ,Declare Cursor ,Open Cursor ,Fetch record ,Processing ,Close Cursor
Source: aired.in
No comments:
Post a Comment