midrange.com code scratchpad |
Name:
RTVSQLDUMP - Dan Bale
|
Scriptlanguage:
Plain Text
|
Tabwidth:
4
|
Date:
01/20/2017 02:45:26 am
|
IP:
Logged
|
|
Description:
This utility takes an ugly DSPSYSOBJ dump output of SQL session history and formats it into a readable format. This program could be vastly improved upon. It was developed when I was in a big hurry to get something I needed, 'nuff said. If your DMPSYSOBJ output is less than 345 pages, this program will do the job. This was compiled at v7r1. If your compiler chokes at the size of the data structure, you'll have to decrease it accordingly to get this to work.
|
Code:
- * Problem: SQL session history "disappears" and you're missing a lot of good "stuff".
- * Solution: Run a DMPSYSOBJ on a special "internal space" that keeps this history,
- * and parse the ugly printed output into usable statements.
- * Details: Suggested by Elvis Budimlic of Centerfield Technologies, in their
- * February 2006 newsletter (pg 5).
- * DMPSYSOBJ OBJ(ISQLST<usrprf>*) CONTEXT(QRECOVERY) TYPE(19) SUBTYPE(EE)
- * where <usrprf> is your user profile name.
- * Copy this spool file to $DMPSYSOBJ, a 132-byte record length flatfile,
- * and process that file here to produce readable printed output.
- h Option( *SrcStmt : *NoDebugIO )
- f$DmpSysObjif f 132 disk
- fqPrint o f 132 printer OflInd( *inOF )
-
- * There are up 58 "Dump32" records per page, so 20000 should be good for about 344 pages.
- d ds
- d Dump32 1 640128 Dim( 20004 )
- d Dump82 17 640108 Dim( 7806 )
- d d s 9 0
- d d82High s 9 0
- d Capture s n Inz( *off )
-
- i$DmpSysObjns
- i 1 6 SPACEdash
- i 1 5 NAMEdash
- i 1 10 POINTERSdash
- i 87 87 Star1
- i 88 119 pDump32
- i 120 120 Star2
- i 1 132 Line132
- i 122 125 Page#
-
- /free
- *inLR = *on ;
- Dou %eof( $DmpSysObj ) ;
- Read $DmpSysObj ;
- If not %eof( $DmpSysObj ) ;
-
- If POINTERSdash = '.POINTERS-' ;
- Capture = *off ;
- Exsr ConvertDump ;
- Endif ;
- // The stuff between "SPACE-" & ".POINTERS-" is the stuff we want to parse
- // (Capture is *on)
- If Capture and Star1 = '*' and Star2 = '*' ;
- d += 1 ;
- Dump32( d ) = pDump32 ;
- Endif ;
-
- If SPACEdash = 'SPACE-' ;
- Capture = *on ;
- Endif ;
-
- Endif ;
- Enddo ;
-
- Begsr ConvertDump ;
- *inOF = *On ;
- d82High = ( d * 32 / 82 ) + 1 ;
- For d = 1 to d82High ;
- *in82 = *on ;
- Except Print82 ;
- *in82 = *off ;
- Endfor ;
-
- Clear Dump32 ;
- Clear d ;
- Endsr ;
-
- /end-free
-
- oqPrint ef Print82 1
- o Dump82( d )
|
|
|