Sei sulla pagina 1di 8

What is the maximum number of records you can specify in a display file?

Ans:1024

How can a screen field that has changed since the last output operation be detected ?
Ans:Attach the MDT (modified data tag) attribute to the field, to detect whether field has been
changed as a result of user input.

What would be the effect on the field where reverse image, underline and highlight display
attributes were active?
Ans:The result is same as if you had specified ND.

What is the use of DSPATR(MDT) keyword?
Ans:Sets on the modified Data Tag of the field. The Data Tag detect whether the field has been
changed as a result of user input.

If DSPATR(PC) and CSRLOC were specified for a format, which keyword would have
priority?
Ans:CSRLOC gains priority.

Can error messages as a result of a COMP, RANGE or VALUES keyword be overridden?
Ans:Yes, through CHKMSGID keyword.

What the purpose of OVRDTA, OVRATA keywords?
Ans:OVRDTA keyword (field or record level) can be used to override the existing data contents
of a field or record already on the display.
OVRATA keyword (field or record level) can be used to override the existing display attributes of
a field or record already on the display.

How can a message from a message file appear as a constant on the screen?
Ans:By using MSGCON (message constant) keyword.

In conjunction with what other keyword must OVRDTA and OVRATA be used?
Ans:PUTOVR keyword must used.

What is the purpose of the INDARA keyword?
Ans:This File-level keyword is used to remove option and response indicators from the buffer
and places them in 99-byte separate indicator area.

Explain the purpose of KEEP and ASSUME keywords?
Ans:KEEP: Keep the display from being deleted when the display file is closed.
ASSUME: It is used to specify that the OS/400 program is to assume that this record is already
shown on the display
when this file is opened.

Explain the use of DFTWRT display keyword?
Ans:No records will be displayed until there is any I/O operation.

What is the purpose of FRCDTA keyword ?
Ans:Immediately display a record format without waiting for the next I/O operation.

What keyword must be used with PROTECT keyword?
Ans:OVERLAY

What is Subfile?
Ans:Subfile is group of records of same record format and can be read from or write to the
display in a single operation.

What are all the contents of subfile?
Ans:Subfile Record Format, Subfile Control Record Format, Relative Record Number, Subfile
Record Number, Associated Subfile Keywords.

What are the two record formats a subfile contain ?
Ans:Subfile record forma (SFL), and subfile control record forma (SFLCTL).

What is SFLPAG and SFLSIZ ?
Ans:
SFLPAG : it is an attribute which specifies the number of records that can be displayed in a
screen.
SFLSIZ : it is an attribute which specifies the number of records can be stored in subfile.

What is the maximum number of subfiles that can be specified in a display file,
Ans:512

Maximum number of subfiles that can Defined in a RPG program for one display file is
Ans:24

Maximum number of subfiles that can be active for a single file is?
Ans:12

Can more than one subfile record be displayed on one line?
Ans:Yes, by using SFLLIN keyword.

How do you specify the number of records to roll in a subfile?
Ans:Use SFLROLVAL keyword in DDS along with number, which specifies the number of
records to scroll at a time.

How will you display a particular page in subfile?
Ans:Move a valid relative record number (RRN) in the field specified using SFLRCDNBR
keyword in DDS.

How to pick up the changed records every time in a subfile after the first change made?
Ans:Seton SFLNXTCHG keyword indicator and update the subfile record.

What is the use of SFLEND keyword?
Ans:By specifying this keyword, the Bottom/More message could be displayed at end of screen.

How to toggle between single line and Multi - line display of a particular record in a
subfile?
Ans:Using SFLDROP keyword.

Explain the difference between defining Subfile and Message-subfile?
Ans:Subfile record is defined by SFL keyword, where as Message subfile is defined by SFLMSG
keyword.

What are the different types of variables available in CL?
Ans:DEC, CHAR, LGL
How to define Global Parameter in ILE ?
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
%BOFetc.
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
A program variable coded in an Embedded SQL statement is referred to as?
Ans:Host Variable

Which of the CL command can be used to determine which logical files are dependent on
a specific file?
Ans:DSPDBR

What does DFU program you to do on a record?
Ans:Insert, Update Delete & File Enquiry.

When are the Unique Constraints executed?
Ans:During Insert.

When are the Referential Constraints executed?
Ans:Insert, Update & Delete.

How many triggers can be associated with a file?
Ans:6(Maximum)

Why is the Declare cursor statement is used for?
Ans:To define & name the cursor & specify rows to be fetched.

What do we can do with the Embedded SQL statements?
Ans:We can Insert/Update/Delete records, fetch records, fetch values from records into
variables.

Which CL command is used to trap error messages during program execution?
Ans:MONMSG

Which CL command can be used at program execution to redirect the file named in an
RPG program?
Ans:OVRDBF

What is the length of the variable in the given example?
Ans:DCL VAR (&Name) TYPE (*Char)? Default 32 & for Decimal 15,5
We can determine weather a record is in use bye another user with the help of status code
(*STATUS). If
*STATUS = 01218 i.e. record already locked.

How to write *PSSR ?
Ans:It just similar to any other subroutine.
*PSSR BEGSR


.
ENDSR

What is Procedure ?
Ans:A procedure is the set of self contained high level language statements that can perform a
particular task and then returns to a caller.

What is Procedure Prototype and Procedure Interface.
Ans:
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

How to define a procedure ?
Ans:
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

Potrebbero piacerti anche