.
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
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.
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 %BOFetc.
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
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.
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 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 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 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.
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 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.
693. Can we have records (with fields from more than one file) from multiple files
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
(SELECT 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)
<!--
google_ad_client = "pub-4684889708406489";
/* 336x280, created 9/22/08 */
google_ad_slot = "6067802779";
google_ad_width = 336;
google_ad_height = 280;
//-->google_protectAndRun("ads_core.google_render_ad", google_handleError,
google_render_ad);
Powered by Adsense Deamon WordPress Plugin,