Professional Documents
Culture Documents
1 DB 2
1 DB 2
1 DB 2
Stored procedures can access tables at other DB2 locations using 3-part object names or
CONNECT statements.
If you use CONNECT statements, you use DRDA access to access tables. If you use 3-part
object names or aliases
for 3-part object names, the distributed access method depends on the value of
DBPROTOCOL you specified when you bound
the stored procedure package. If you did not specify the DBPROTOCOL bind parameter,
the distributed access method depends on the value of field DATABASE PROTOCOL on
installation panel DSNTIP5.
A value of PRIVATE tells DB2 to use DB2 private protocol access to access remote data for
the stored procedure.
DRDA tells DB2 to use DRDA access.
Store procedure Definition Specifies the name of the stored procedure program.
Define the stored procedure to DB2 by preprocessing a CREATE PROCEDURE statement,
then executing the CREATE PROCEDURE statement statically or dynamically
Define stored procedure to DB2 by executing the CREATE PROCEDURE statement.
none of the above
An external stored procedure and an SQL procedure differ in the way that they specify the
code for the stored procedure.
An external stored procedure definition specifies the name of the stored procedure
program.
An SQL procedure definition contains the source code for the stored procedure.
For an external stored procedure, you define the stored procedure to DB2 by executing
the CREATE PROCEDURE statement.
You change the definition of the stored procedure by executing the ALTER PROCEDURE
statement.
For an SQL procedure, you define the stored procedure to DB2 by preprocessing a
CREATE PROCEDURE statement,
then executing the CREATE PROCEDURE statement statically or dynamically. As with an
external stored procedure,
you change the definition by executing the ALTER PROCEDURE statement but
cannot change the procedure body with the ALTER PROCEDURE statement.
Creating an SQL procedure involves writing the source statements for the SQL procedure,
creating the executable form of the SQL procedure, and defining the SQL procedure to
DB2.
8. Which of the following should be taken into consideration while coding an SQL?
1. Use of ORDER BY GROUP BY Clause
2. Fetching unused rows and columns
3. Minimizing Lock duration
4. Redundant Predicates
a) 2 & 3 alone
b) 1 & 4 alone
c) 2, 3, & 4 alone
d) all of the above
9. Aggregate functions performs best ____________.
1. When evaluated after data has been accessed
2. When evaluated during data access
3. When evaluated during DB2 sort
Order of performance (Best first) should be ?
a) 1, 2, 3
b) 2, 3, 1
c) 1, 3, 2
d) 3, 2, 1
If a query involves aggregate functions, make sure that they are coded as simply as
possible, this increases the chances that they will be evaluated when the data is retrieved,
rather than afterward. In general, a aggregate function performs best when evaluated
during data access and next best when evaluated during DB2 sort. Least preferable is to
have an aggregate function evaluated after the data has been retrieved.
10. How many JOIN conditions are needed in JOIN query to avoid a cartesian product?
No of tables + 1
No of columns – 1
No of columns + 1
No of tables – 1
11. Which of the following SQL source code are stored in system catalog?
Views
Tables
Triggers
Constraints
12. What determines when checkpoints are taken for DB2 subsystem restart?
ARCHIVE LOG FREQ
LOGLOAD
UPDATE RATE
CHECKPOINT FREQ
14. Which of the following statement is true while selecting access path?
1. Predicates in the having clause is not used
2. Predicates in the Where clause alone is used
3. Predicates in the On Clause alone is used
a) 1 and 2
b) 1 and 3
c) 2 and 3
all of the above
Predicates in a HAVING clause are not used when selecting access paths. hence, the term
'predicate‘ means a predicate after WHERE or ON.
Hybrid join is used often when a non-clustered index available on join column of the
inner table and there are duplicate qualifying rows on outer table.
Hybrid join handles are duplicates in the outer table as inner table is
scanned only once for each set of duplicate values.
17. Which of the following options will help release locks more quickly and contribute
to maximum concurrency?
SYSIBM.SYSPLAN
SYSIBM.PLANTABLE
SYSIBM.PLAN
SYSIBM.COPY
23. If a fetch encounters an update or delete hole, what is the SQLCODE returned to
the program?
+100
+222
+212
+112
24. SQL needs COBOL/PL1's help to do ONE of the tasks listed below.
From what you know of SQL, which task do you think is best done by embedding SQL in
a COBOL/PL1 program?
Create a table
Produce a one-time listing of all rows from one or more tables
Update a table based on values contained in a transaction file
Grant another user authority to access a table you created
Ans: Load module is purged from the address space and reloaded when invoked again
(doubt)
Creating an SQL procedure involves writing the source statements for the SQL
procedure, creating the executable form of the SQL procedure, and defining the SQL
procedure to DB2.
27. How many TCB can have in each Stored Procedures address space?
One
More than one TCB
two only
three only
If you use 3-part object names or aliases for 3-part object names, the distributed access
method
depends on the value of DBPROTOCOL you specified when you bound the stored
procedure package.
If you did not specify the DBPROTOCOL bind parameter, the distributed access method
depends on the
value of field DATABASE PROTOCOL on installation panel DSNTIP5.
29. If the stored procedure runs in WLM established address space, your AMODE can
be ______.
24 bits
24 or 31 bits
31 bits
Any
32. Which of the following statement regarding predicate is true for better
performance?
1. Predicates should be on either leading or all index key columns
2. At least one predicates should be in the list of indexed columns
3. Predicates need not be indexed
a) 1 and 2
b) 1 and 3
c) 2 and 3
d) all of the above
42. Stored Procedure running in WLM established address space can have __________.
Explicit CAF
Implicit CAF calls
RRSAF calls implicitly
RRSAF calls explicitly
When a query returns needed row in one step of data page access
When a query returns needed row in one step of index page access
none of the above
ONE FETCH - When a query returns needed row in one step of page access
Only one table in the query MIN or MAX column functions No GROUP BY
48. What field in the SQLCA can you check to determine if your SQL statement
executed successfully?
SQLCODE field
SQLSTATE field
Both a and b
None of the above
51. What is the most convenient way to get a DECLARE TABLE statement into your
program?
INCLUDE a member created by DCLGEN
Simply code it yourself Use a text editor to copy an existing DECLARE TABLE statement
into your program.
none of the above
53. If the stored procedure runs in WLM established address space, you should use.
DSNALI
DSNRLI
Both a and b
none of the above
DSNALI -The language interface module for the call attachment facility. Link-edit or load
this module if your stored procedure runs in a DB2-established address space.
DSNRLI - The language interface module for the Recoverable Resource Manager Services
attachment facility.
Link-edit or load this module if your stored procedure runs in a WLM-established address
space.
If the stored procedure references LOBs or distinct types, you must link-edit or load
DSNRLI.
54. Which of the following statement regarding Materialized Query tables is correct?
Used to store the results of query in advance in the case of dynamic queries
DB2 may not use the materialized query tables if they do not have any performance
advantage
They need special registers to be used by DB2
All of the above
Dynamic queries that operate on very large amounts of data and involve multiple joins
might take a long time to run.
One way to improve the performance of these queries is to generate the results of all or
parts of the queries in advance, and store the results in materialized query tables.
59. Which of the following is not a valid Cursor positioning technique in CICS
Static Cursor Positioning
Symbolic Positioning
Standard Positioning
Relative Positioning
60. Once a HANDLE CONDITION command is issued for a specific condition, how long
does it remain in effect?
Until another HANDLE CONDITION executes for the same condition
Until an IGNORE CONDITION command executes for the same condition
Until the program terminates
All of the above
What is the best reason for providing extra WHERE clause conditions when you
are joining tables?
a) Better documentation
b) The more qualified your condition, the safer it is
c) To enable DB2 to decide on the best way to access the data
d) all of the above
How many JOIN conditions are needed in JOIN query to avoid a cartesian
product?
a) No of tables + 1
b) No of tables - 1
c) No of columns + 1
d) No of columns 1
Stored Procedure running in WLM established address space can have __________.
a) Explicit CAF
b) Implicit CAF calls
c) RRSAF calls implicitly
d) RRSAF calls explicitly
Which of the following should be taken into consideration while coding an SQL?
1. Use of ORDER BY GROUP BY Clause
2. Fetching un used rows and columns
3. Minimizing Lock duration
4. Redundant Predicates
a) a) 2 & 3 alone
b) b) 1 & 4 alone
c) c) 2, 3, & 4 alone
d) d) all of the above
DSNALI is a ___________.
a) Language interface module for call attachment facility
b) Language interface module for recoverable resource manager services
attachment facility
c) Both a and b
d) none of the above
Which data structures uses FIFO technique where the first element added to the data
structure is the first removed
a) QUEUE
b) STACK
c) BOTH
d) None of these
In REXX comment starts with?
a) /*REXX
b) // REXX
c) //* REXX
d) None
Which instruction stops execution from within the loop and passes control to the DO
instruction at the top of the loop.
a) Leave
b) Nop
c) Exit
d) Iterate
Which instruction causes an exec to unconditionally end and return to where the exec
was invoked
a) LEAVE
b) EXIT
c) BOTH
d) None
acquire(all)
meterialized query