IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

DB2 STATEMENT_TABLE


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
srinut123

New User


Joined: 11 Oct 2005
Posts: 62
Location: India

PostPosted: Fri Apr 29, 2011 4:17 pm
Reply with quote

Hi
When I look for the entries related to my program in DSN_STATEMNT_TABLE, I could see that one of my query has high PROCMS value. High can I trace which query is yielding this? I've many queries in the program on the same table.

Please advice.

Thaks
Sri
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Apr 29, 2011 4:25 pm
Reply with quote

There is a statement number associated with the row,
this statement number refers to your db2 precompiler output.

alternatively,
you can go to the dbrm for your module
and search for the statement number (it is in binary)

this link is a REXX ISPF Macro that I wrote that will find the sql in your dbrm.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Fri Apr 29, 2011 7:30 pm
Reply with quote

via dsn_query_table & XML
Code:
select
a."QUERYNO", a."COLLID", a.PROGNAME, a.EXPLAIN_TIME
,cast(xml2clob(xmlquery('$c/QUERY//text()' passing xmlparse(q.node_data) as "c")) as varchar(10000))
from
DSN_STATEMNT_TABLE A
, DSN_QUERY_TABLE Q
where a."COLLID" = ,
and a.EXPLAIN_TIME = q.EXPLAIN_TIME
and a."QUERYNO" = q."QUERYNO"
and q.QUERY_STAGE = 'BEFORE'
and q."TYPE" = 'SELECT'


the other way is via syspackstmt;
stmt is in "for bit data , but most of it is readable unicode"
Code:
select
a."QUERYNO", a."COLLID", a.PROGNAME, a.EXPLAIN_TIME
,p.version
,i.stmt
from DSN_STATEMNT_TABLE A
   , plan_table P
   , sysibm.syspackstmt I
where a."COLLID" = ?
and a."COLLID" = p."COLLID"
and a.PROGNAME = p.PROGNAME
and a.EXPLAIN_TIME = p.BIND_TIME
and I.LOCATION = ''
and i."COLLID" = p."COLLID"
and i.NAME = p.PROGNAME
and i."QUERYNO" = p."QUERYNO"
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Search our Forums:

Back to Top