Figure 1. Job DSNTIJPM for migration to DB2 10 //********************************************************************* 00010000
//* NAME = DSNTIJPM 00210000
//* 00580000
//* DESCRIPTIVE NAME = DB2 INSTALL JOB 00580200
//* 00580400
//* Licensed Materials - Property of IBM 00580600
//* 5605-DB2 00580800
//* (C) COPYRIGHT 1982, 2010 IBM Corp. All Rights Reserved. 00581000
//* 00581200
//* STATUS = Version 10 00581400
//* 00581600
//* FUNCTION = RUN THIS JOB ON DB2 VERSION 8 OR DB2 VERSION 9 PRIOR 00581800
//* TO MIGRATION TO DB2 VERSION 10. IT QUERIES THE DB2 00582000
//* CATALOG TO IDENTIFY CONDITIONS THAT WILL NEED TO BE 00582200
//* REMEDIED BEFORE YOU ATTEMPT TO MIGRATE TO DB2 VERSION 00582400
//* 10 OR THAT NEED TO BE ATTENDED TO AFTER YOU HAVE 00582600
//* MIGRATED TO DB2 VERSION 10. 00582800
//* 00583000
//* THIS JOB GENERATES REPORTS THAT IDENTIFY CONDITIONS 00583200
//* ON DB2 V8 OR V9 THAT NEED TO BE REMEDIED BEFORE YOU 00583400
//* COMMENCE MIGRATION TO VERSION 10, OR THAT NEED TO BE 00583600
//* ATTENDED TO AFTER YOU HAVE MIGRATED TO DB2 VERSION 10. 00583800
//* 00584000
//* PSEUDOCODE = 00584200
//* DSNTIJR5 STEP BIND A PACKAGE FOR DB2 REXX IN COLLECTION ID 00584260
//* DSNREXX_500 (SEE NOTES BELOW) 00584320
//* DSNTGEN STEP COPY DSNTPMQ EXEC TO A TEMP PDS 00584400
//* DSNTPMQ STEP CALL DSNTPMQ TO GENERATE PREMIGRATION REPORTS 00584700
//* 00585000
//* NOTES = THE JCL REQUIRES DB2 REXX IN THE DB2 ENVIRONMENT YOU 00585200
//* ARE MIGRATING FROM. 00585400
//* 00585440
//* SOME REPORTS, PARTICULARLY REPORT29, MAY REQUIRE 00585480
//* SEVERAL HOURS TO COMPLETE ON DB2 SUBSYSTEMS THAT 00585520
//* HAVE LARGE NUMBERS OF PACKAGES AND PLANS. 00585560
//* 00585600
//* CERTAIN PROCESSING PERFORMED BY THIS JOB REQUIRES USE 00585620
//* OF A SPECIAL PACKAGE FOR DB2 REXX IN COLLECTION ID 00585640
//* DSNREXX_500. USE JOB STEP DSNTIRX5 TO BIND THIS 00585660
//* PACKAGE AND INCLUDE IT IN THE DSNREXX PLAN. BEFORE 00585680
//* RUNNING THIS JOB STEP, ENSURE THAT YOU ARE AUTHORIZED 00585700
//* TO CREATE PACKAGES IN THE DSNREXX_500 COLLECTION ID 00585720
//* AND TO BIND THE DSNREXX PLAN. 00585740
//* 00585760
//* THE FOLLOWING MANUAL TAILORING IS REQUIRED: 00585800
//* 1. ADD A VALID JOB CARD. 00586000
//* 2. LOCATE AND CHANGE ALL OCCURRENCES OF THE FOLLOWING 00586200
//* STRINGS AS INDICATED: 00586400
//* A. '!DSN!' TO THE NAME OF THE DB2 SUBSYSTEM YOU ARE 00586700
//* PREPARING TO MIGRATE. 00587000
//* B. 'DSN!!0' TO THE PREFIX OF THE DB2 TARGET 00587490
//* LIBRARIES FOR THE DB2 SUBSYSTEM YOU ARE 00587680
//* PREPARING TO MIGRATE. 00587900
//* C. 'DSNTIA!!' TO THE PLAN NAME FOR DSNTIAD 00588290
//* D. '!SYSADM!' TO THE AUTHORIZATION ID TO BE USED 00588380
//* BY DB2 QUERIES IN THIS JOB. 00588500
//* E. '!ISA1!' TO THE FIRST INSTALLATION SYSTEM 00588560
//* ADMINISTRATOR (DSN6SPRM.SYSADM) ID 00588620
//* F. '!ISA2!' TO THE SECOND INSTALLATION SYSTEM 00588680
//* ADMINISTRATOR (DSN6SPRM.SYSADM2) ID 00588740
//* 00588800
//* CHANGE ACTIVITY = 00589100
//* 07/12/2011 Fix REPORT4 and REPORT10 PM3399100589200
//* 07/28/2011 Add REPORT29 DM1077/PM3074800589300
//* 09/19/2011 Add REPORT30 and REPORT31 DM1548/PM4845100589350
//* 11/19/2011 Add REPORT32 and fix REPORT25 PM4724600589370
//* 12/20/2011 Mod REPORT11 (exclude V8/9 sample plans) PM5469900589372
//* Mod REPORT13 (clarify explicit rebind reqd) PM5469900589374
//* Fix REPORT29 (recognize delimited SQL idents) PM5469900589376
//* (prevent SQLCODE -104 from S6) PM5469900589378
//* (prevent rc=1 output error) PM5469900589380
//* (add progress monitor) PM5469900589382
//* (reject SECTNOI < 0) PM5469900589384
//* Fix REPORT30, REPORT31, REPORT32 (fix typos) PM5469900589386
//* Add REPORT33 (instances of simple table spaces) PM5469900589388
//* Add REPORT34 (stale trigger packages) PM5469900589390
//* Add REPORT35 (trigger pkgs having SECTNOI < 0) PM5469900589392
//* 04/17/2012 Fix REPORT25 (handle MBCS in collID and pk nam) PM6604300589394
//* Fix REPORT29 (further exclusions) PM6604300589396
//* 01/15/2013 Add REPORT36 (bad version numbers) PM7091400589398
//* 02/09/2013 Fix REPORT16 (additional table to check) PM8210000589420
//* and REPORT17 (3 additional tables to check) PM8210000589440
//* and speed up reports 20, 21, and 29 PM8210000589460
//* and close report 25 output data set PM8210000589480
//* and add optional check for DBADM to report 29 PM8210000589500
//* and clarify and correct report 33 PM8210000589520
//* 03/25/2013 Add REPORT37 (pkg dependencies on SYSPKAGE) PM8118900589530
//* 08/30/2013 Fix SQLCODE -104 for REPORT 36 00589533
//* Remove specific SQLCODE for report 16 & 17 PM9156500589536
//* 01/27/2014 Add REPORT38 (extraneous text in PI0904100589537
//* SYSIBM.SYSTRIGGERS TEXT column) 00589538
//* 03/01/2014 Mod REPORT13 (clarify use of IFCID 360) PI1123600589570
//* Mod REPORT37 (exlude packages with DTYPE O & P) PI1123600589600
//* 03/18/2014 Add REPORT39 PI1325200589610
//* 2014/02/22 Convert REPORT02 (user-defined indexes PI11316 DM1800 00589612
//* on the DB2 catalog that reside on user-managed 00589614
//* storage) to report all user-defined indexes on 00589616
//* the DB2 catalog that are not in the DB2 catalog 00589618
//* space. Discontinue REPORT03 (user-defined 00589620
//* indexes on the DB2 catalog that reside on DB2 - 00589622
//* managed storage). 00589624
//* 2015/04/10 No del to include part PI3622200589627
//* 2015/06/11 Restrict report 35 to trigger packages PI3703800589628
//* 2015/07/20 Update REPORT39 to avoid false alarms PI3786900589629
//**********************************************************************00589630
//* 00589700
//JOBLIB DD DSN=DSN!!0.SDSNLOAD,DISP=SHR 00590000
//* 00600000
//* 00600600
//********************************************************************* 00601200
//* Bind a package for DB2 REXX in collection ID DSNREXX_500 00601800
//********************************************************************* 00602400
//DSNTIRX5 EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(4,LT) 00603000
//SYSTSPRT DD SYSOUT=* 00603600
//SYSPRINT DD SYSOUT=* 00604200
//SYSUDUMP DD SYSOUT=* 00604800
//SYSTSIN DD * 00605400
DSN SYSTEM(!DSN!) 00606290
BIND PACKAGE(DSNREXX_500) MEMBER(DSNREXX) ACTION(REP) - 00606890
LIBRARY('DSN!!0.SDSNDBRM') ISOLATION(CS) - 00607200
VALIDATE(BIND) CURRENTDATA(NO) ENCODING(500) 00607800
BIND PLAN(DSNREXX) - 00608400
PKLIST(*.DSNREXX.DSNREXX, - 00609000
*.DSNREXUR.DSNREXX, - 00609600
*.DSNREXCS.DSNREXX, - 00610200
*.DSNREXRS.DSNREXX, - 00610800
*.DSNREXRR.DSNREXX, - 00611400
*.DSNREXX_500.DSNREXX) - 00612000
ACT(REP) RETAIN ISO(CS) CURRENTDATA(YES) SQLRULES(DB2) - 00612600
ENCODING(EBCDIC) 00613200
RUN PROGRAM(DSNTIAD) PLAN(DSNTIA!!) - 00613800
LIB('DSN!!0.RUNLIB.LOAD') 00614400
END 00615000
//SYSIN DD * 00615600
GRANT EXECUTE ON PACKAGE DSNREXX_500.DSNREXX TO PUBLIC; 00616200
/* 00616800
//* 00620000
//DSNTGEN EXEC PGM=IEBGENER,COND=(4,LT) 00630000
//SYSIN DD DUMMY 00700000
//SYSPRINT DD SYSOUT=* 00780000
//SYSUT2 DD DSN=&&TEMPPDS(DSNTPMQ), 00860000
// DISP=(,PASS), 00940000
// UNIT=SYSDA,SPACE=(TRK,(1,1,1),RLSE), 01020000
// DCB=(RECFM=FB,LRECL=80) 01100000
//SYSUT1 DD * 01180000
/** REXX ** DSNTPMQ ************************************************/ 01260000
PARSE UPPER ARG ssid authid 01340000
01420000
ssid = STRIP(ssid) 01423000
authid = STRIP(authid) 01426000
high_rc = 0 01430000
01520000
CALL validateArgs ssid, 01520050
authid 01524050
01530000
ADDRESS TSO "SUBCOM DSNREXX" /* HOST CMD ENV AVAILABLE? */01580000
IF rc THEN /* NO, LET'S MAKE ONE */01680000
S_rc = RXSUBCOM('ADD','DSNREXX','DSNREXX') /* ADD HOST CMD ENV */01780000
01880000
ADDRESS DSNREXX "CONNECT" ssid 01930000
IF SQLCODE \= 0 THEN CALL errsqlca 'CONNECT' 02030000
02280000
CALL setAuthId authid 02330000
02330600
CALL generateReport1 02331200
02331800
CALL generateReport2 02332400
02333000
CALL generateReport3 02333600
02334200
CALL generateReport4 02334800
02335400
CALL generateReport5 02336000
02336600
CALL generateReport6 02337200
02337800
CALL generateReport7 02338400
02339000
CALL generateReport8 02339600
02340200
CALL generateReport9 02340800
02341400
CALL generateReport10 02342000
02342600
CALL generateReport11 02343200
02343800
CALL generateReport12 02344400
02345000
CALL generateReport13 02345600
02346200
CALL generateReport14 02346800
02347400
CALL generateReport15 02347460
02347520
CALL generateReport16 02347580
02347650
CALL generateReport17 02347720
02347790
CALL generateReport18 02347810
02347830
CALL generateReport19 02347850
02347870
CALL generateReport20 02347890
02347910
CALL generateReport21 02347940
02347970
CALL generateReport22 02347980
02347990
CALL generateReport23 02347993
02347996
CALL generateReport24 02347997
02347998
CALL generateReport25 02348090
02348180
CALL generateReport26 02348210
02348240
CALL generateReport27 02348246
02348252
CALL generateReport28 02348258
02348264
CALL generateReport29 02348266
02348298
CALL generateReport30 02348328
02348358
CALL generateReport31 02348388
02348418
CALL generateReport32 02348428
02348429
CALL generateReport33 02348430
02348431
CALL generateReport34 02348432
02348433
CALL generateReport35 02348434
02348438
CALL generateReport36 02348441
02348444
CALL generateReport37 02348445
02348446
CALL generateReport38 02348468
02348488
CALL generateReport39 02348494
02348500
ADDRESS DSNREXX "EXECSQL COMMIT" 02348508
ADDRESS DSNREXX "DISCONNECT" 02348600
02349200
EXIT Finis() /* end DSNTPMQ */ 02349800
02350400
/*==================================================================*/02351000
/* Begin subroutines */02351600
/*==================================================================*/02352200
validateArgs: PROCEDURE 02352800
/*****************************************************************/ 02353400
/* Print a welcome message and then validate the parameters */ 02354000
/*****************************************************************/ 02354600
PARSE ARG ssid /* DB2 Subsystem ID */,02355200
authid /* Authorization ID for work */ 02355800
02356400
CALL IntMsg, 02357000
'DSNTPMQ entry:' 02357600
CALL IntMsg, 02358200
' Subsystem ID ............................................. ',02358800
ssid 02359400
CALL IntMsg, 02360000
' Authorization ID ......................................... ',02360600
authid 02361200
CALL IntMsg '' 02361800
02362400
digits = "0123456789" 02363000
dquote = '"' 02363600
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 02364200
nationals = "@#$" 02364800
quote = "'" 02365400
underscore = "_" 02366000
02366600
/****************************************************************** 02367200
* Validate the argument for parameter 1, ssid * 02367800
* Rules: 1-4 characters starting with A-Z or @, #, or $. * 02368400
* Remaining characters must be A-Z, 0-9, @, #, or $ * 02369000
******************************************************************/ 02369600
IF (LENGTH(ssid) < 1 | LENGTH(ssid) > 4), 02370200
| (VERIFY(ssid, letters||nationals) = 1), 02370800
| (VERIFY(ssid, letters||digits||nationals) > 0) THEN 02371400
DO 02372000
CALL IntMsg, 02372600
'Error: The argument for parameter 1, SUBSYSTEM ', 02373200
'ID, must be 1 to 4 char-' 02373800
CALL IntMsg, 02374400
' acters and begin with A-Z, @, #, or $. ', 02375000
'The other characters must' 02375600
CALL IntMsg, 02376200
' be A-Z, 0-9, @, #, or $.' 02376800
CALL abort 54 02377400
END 02378000
02378600
/****************************************************************** 02379200
* Validate the argument for parameter 2, authid * 02379800
* Rules: 1-8 characters starting with A-Z or @, #, or $. * 02380400
* Remaining characters must be A-Z, 0-9, @, #, or $ * 02381000
******************************************************************/ 02381600
IF (LENGTH(authid) < 1 | LENGTH(authid) > 8), 02382200
| (VERIFY(authid, letters||nationals) = 1), 02382800
| (VERIFY(authid, letters||digits||nationals) > 0) THEN 02383400
DO 02384000
CALL IntMsg, 02384600
'Error: The argument for parameter 2, AUTHORIZA', 02385200
'TION ID, must be 1 to 8' 02385800
CALL IntMsg, 02386400
' characters and begin with A-Z, @, #, or $.',02387000
' The other characters' 02387600
CALL IntMsg, 02388300
' must be A-Z, 0-9, @, #, or $.' 02389000
CALL abort 54 02389700
END 02390400
RETURN /* end validateArgs */ 02391100
02391800
setAuthId: PROCEDURE 02392500
/*****************************************************************/ 02393200
/* Set the current authorization id */ 02393900
/*****************************************************************/ 02394600
PARSE ARG authid /* Authorization id to use */ 02395300
02396000
SQLSTMT = "SET CURRENT SQLID = '" || authid || "'" 02396700
ADDRESS DSNREXX EXECSQL SQLSTMT 02397400
IF sqlcode <> 0 THEN 02398100
CALL errsqlca "SET CURRENT SQLID" 02398800
02399500
RETURN /* end setAuthId */ 02400200
02400900
02401600
generateReport1: PROCEDURE 02402300
/*****************************************************************/ 02403000
/* Generate premigration report 1: */ 02403700
/* Reports existence of the previous-release sample database */ 02404400
/*****************************************************************/ 02405100
"EXECIO 0 DISKW REPORT01 (OPEN" 02405800
if rc<>0 then call Dsn_Error 'Write_source_dsn', 02406500
, 'EXECIO DISKW REPORT01 OPEN rc=' rc 02407200
02407900
TEMP.1 = "=== REPORT 1" COPIES('=',59) 02408890
TEMP.2 = "= The following lists the DB2 V8 or V9 sample", 02409300
"database, DSN8D81A or =" 02410000
TEMP.3 = "= DSN8D91A. This database is needed for verifying", 02410700
"migration to DB2 V10 =" 02411400
TEMP.4 = "= Conversion Mode. If DSN8D81A or DSN9D91A is not", 02412100
"listed below, you =" 02412800
TEMP.5 = "= are recommended to recreate it before commencing", 02413500
"migration to DB2 =" 02414200
TEMP.6 = "= V10. Run V8 or V9 IVP job DSNTEJ1 to recreate it. ", 02414900
"You should also =" 02415600
TEMP.7 = "= run one or more of the phase 2 and phase 3 IVP jobs", 02416300
"in V8 or V9. =" 02417000
TEMP.8 = "= See the DB2 V8 or V9 Installation Guide, the chapter", 02417700
"on Verifying =" 02418400
TEMP.9 = "= with Sample Applications for more", 02419100
"information. =" 02419800
TEMP.10 = COPIES('=',72) 02420500
TEMP.11 = "NAME" 02421200
TEMP.12 = "----------" 02421900
02422600
'EXECIO' 12 'DISKW REPORT01 (STEM TEMP.' 02423300
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02424000
, 'EXECIO DISKW REPORT01 rc=' rc 02424700
02425400
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 02426100
address DSNREXX EXECSQL SQLSTMT 02426800
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 02427500
02428200
SQLSTMT= "SELECT '""' || NAME || '""'", 02428900
"FROM SYSIBM.SYSDATABASE", 02429600
"WHERE NAME IN( 'DSN8D81A','DSN8D91A' )" 02430300
02431000
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 02431700
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 02432400
02433100
address DSNREXX "EXECSQL OPEN C1" 02433800
if sqlcode<>0 then call errsqlca "OPEN C1" 02434500
02435200
address DSNREXX "EXECSQL FETCH C1 INTO :TEMP" 02435900
DO WHILE SQLCODE = 0 02436600
TEMP.1 = TEMP 02437300
'EXECIO' 1 'DISKW REPORT01 (STEM TEMP.' 02438000
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02438700
, 'EXECIO DISKW REPORT01 rc=' rc 02439400
address DSNREXX "EXECSQL FETCH C1 INTO :TEMP" 02440100
END 02440800
02441500
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 02442200
02442900
drop TEMP. 02443600
'EXECIO 0 DISKW REPORT01 (FINIS' 02444300
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02445000
, 'EXECIO DISKW REPORT01 CLOSE rc=' rc 02445700
02446400
address DSNREXX "EXECSQL CLOSE C1" 02447100
if sqlcode<>0 then call errsqlca "CLOSE C1" 02447800
02448500
CALL IntMsg, 02448600
' Report 1 completed' 02448800
02449000
RETURN /* end generateReport1 */ 02449200
02449900
02450600
generateReport2: PROCEDURE 02451300
/*****************************************************************/ 02452000
/* Generates premigration report 2: */ 02453190
/* Reports user-defined indexes on the DB2 catalog that */ 02453680
/* do not reside in the DB2 catalog space. DM1800*/ 02454170
/*****************************************************************/ 02454800
"EXECIO 0 DISKW REPORT02 (OPEN" 02455500
if rc<>0 then call Dsn_Error 'Write_source_dsn', 02456200
, 'EXECIO DISKW REPORT02 OPEN rc=' rc 02456900
02457600
TEMP.1 = "=== REPORT 2" COPIES('=',59) 02458590
TEMP.2 = "= User indexes on the DB2 catalog are moved", 02459890
"into the DB2 catalog space =" 02460780
TEMP.3 = COPIES('=',72) 02461670
TEMP.4 = "= The indexes listed below are user-defined", 02462560
"indexes on the DB2 catalog.=" 02463450
TEMP.5 = "= Beginning in DB2 10 new-function mode, all", 02464340
"such indexes should reside=" 02465230
TEMP.6 = "= in the data space used by the DB2 catalog", 02466120
"and directory. Therefore, =" 02467010
TEMP.7 = "= after completing migration to DB2 10 NFM,", 02467900
"drop and recreate these =" 02468790
TEMP.8 = "= indexes to move them into the DB2 catalog", 02469680
"space. =" 02470570
TEMP.9 = COPIES('=',72) 02471460
TEMP.10 = "CREATOR.NAME" 02472350
TEMP.11 = COPIES('-',257) 02473240
02475100
'EXECIO' 11 'DISKW REPORT02 (STEM TEMP.' 02476090
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02476500
, 'EXECIO DISKW REPORT02 rc=' rc 02477200
02477900
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 02478600
address DSNREXX EXECSQL SQLSTMT 02479300
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 02480000
02480700
SQLSTMT =, 02481400
"SELECT RTRIM(IX.CREATOR)", 02482990
", RTRIM(IX.NAME)", 02483880
"FROM SYSIBM.SYSINDEXES IX", 02484770
", SYSIBM.SYSINDEXPART IXP", 02485660
"WHERE IX.CREATOR = IXP.IXCREATOR", 02486550
"AND IX.NAME = IXP.IXNAME", 02487440
"AND IX.DBID = 6", 02488330
"AND ( IX.OBID BETWEEN 400 AND 599", 02489220
"OR IX.OBID BETWEEN 900 AND 1699", 02490110
")", 02491000
"AND IXP.STORNAME <> '00000001'", 02491890
"ORDER BY IX.CREATOR, IX.NAME" 02492780
02494000
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 02494700
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 02495400
02496100
address DSNREXX "EXECSQL OPEN C1" 02496800
if sqlcode<>0 then call errsqlca "OPEN C1" 02497500
02498200
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2" 02499190
DO WHILE SQLCODE = 0 02499600
TEMP.1 = HV1 || "." || HV2 02500590
'EXECIO' 1 'DISKW REPORT02 (STEM TEMP.' 02501000
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02501700
, 'EXECIO DISKW REPORT02 rc=' rc 02502400
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2" 02503390
END 02503800
02504500
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 02505200
02505900
drop TEMP. HV1 HV2 02506890
'EXECIO 0 DISKW REPORT02 (FINIS' 02507300
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02508000
, 'EXECIO DISKW REPORT02 CLOSE rc=' rc 02508700
02509400
address DSNREXX "EXECSQL CLOSE C1" 02510100
if sqlcode<>0 then call errsqlca "CLOSE C1" 02510800
02511500
CALL IntMsg, 02511600
' Report 2 completed' 02511800
02512000
RETURN /* end generateReport2 */ 02512200
02512900
02513600
generateReport3: PROCEDURE 02514300
/*****************************************************************/ 02515000
/* Generates premigration report 3 (obsolete) DM1800*/ 02516690
/*****************************************************************/ 02517800
"EXECIO 0 DISKW REPORT03 (OPEN" 02518500
if rc<>0 then call Dsn_Error 'Write_source_dsn', 02519200
, 'EXECIO DISKW REPORT03 OPEN rc=' rc 02519900
02520600
TEMP.1 = "=== REPORT 3" COPIES('=',59) 02521590
TEMP.2 = "= This report has been eliminated ",02524990
" ", 02527980
"=" 02530970
TEMP.3 = COPIES('=',72) 02533960
02539500
'EXECIO' 3 'DISKW REPORT03 (STEM TEMP.' 02540490
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02540900
, 'EXECIO DISKW REPORT03 rc=' rc 02541600
02542300
'EXECIO 0 DISKW REPORT03 (FINIS' 02571700
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02572400
, 'EXECIO DISKW REPORT03 CLOSE rc=' rc 02573100
02575900
CALL IntMsg, 02576000
' Report 3 completed' 02576200
02576400
RETURN /* end generateReport3 */ 02576600
02577300
02578000
generateReport4: PROCEDURE 02578700
/*****************************************************************/ 02579400
/* Generates premigration report 4 */ 02580100
/* Reports stored procedures that use the DB2 SPAS */ 02580800
/*****************************************************************/ 02581500
"EXECIO 0 DISKW REPORT04 (OPEN" 02582200
if rc<>0 then call Dsn_Error 'Write_source_dsn', 02582900
, 'EXECIO DISKW REPORT04 OPEN rc=' rc 02583600
02584300
TEMP.1 = "=== REPORT 4" COPIES('=',59) 02585290
TEMP.2 = "= The following stored procedures run in the DB2", 02585700
"Stored Procedures =" 02586400
TEMP.3 = "= Address Space (DB2 SPAS), which was deprecated in", 02587100
"DB2 V8 and has =" 02587800
TEMP.4 = "= been eliminated in DB2 V9. Before migration to", 02588500
"DB2 V10, review =" 02589200
TEMP.5 = "= the procedures listed below, drop any that are", 02589900
"obsolete, and con- =" 02590600
TEMP.6 = "= vert all that are still required to run in a", 02591300
"WLM-established =" 02592000
TEMP.7 = "= address space for stored", 02592700
"procedures. =" 02593400
TEMP.8 = COPIES('=',72) 02594100
TEMP.9 = "SCHEMA NAME" 02594800
TEMP.10 = "---------- --------------------" 02595500
02596200
'EXECIO' 10 'DISKW REPORT04 (STEM TEMP.' 02596900
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02597600
, 'EXECIO DISKW REPORT04 rc=' rc 02598300
02599000
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 02599700
address DSNREXX EXECSQL SQLSTMT 02600400
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 02601100
02601800
SQLSTMT =, 02602500
" SELECT CHAR( '""' || RTRIM(SUBSTR(SCHEMA, 1, 8)) || '""' ) ", 02603200
" ,CHAR( '""' || RTRIM(SUBSTR(NAME, 1, 18)) || '""' ) ", 02603900
" FROM SYSIBM.SYSROUTINES ", 02604600
" WHERE ROUTINETYPE = 'P' ", 02605300
" AND WLM_ENVIRONMENT = ' ' ", 02606000
" AND ORIGIN <> 'N' ", 02606300
"ORDER BY SCHEMA, NAME " 02606700
02607400
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 02608100
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 02608800
02609500
address DSNREXX "EXECSQL OPEN C1" 02610200
if sqlcode<>0 then call errsqlca "OPEN C1" 02610900
02611600
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2" 02612300
DO WHILE SQLCODE = 0 02613000
TEMP.1 = HV1 HV2 02613700
'EXECIO' 1 'DISKW REPORT04 (STEM TEMP.' 02614400
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02615100
, 'EXECIO DISKW REPORT04 rc=' rc 02615800
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2" 02616500
END 02617200
02617900
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 02618600
02619300
drop TEMP. HV1 HV2 02620000
'EXECIO 0 DISKW REPORT04 (FINIS' 02620700
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02621400
, 'EXECIO DISKW REPORT04 CLOSE rc=' rc 02622100
02622800
address DSNREXX "EXECSQL CLOSE C1" 02623500
if sqlcode<>0 then call errsqlca "CLOSE C1" 02624200
02624900
CALL IntMsg, 02625000
' Report 4 completed' 02625200
02625400
RETURN /* end generateReport4 */ 02625600
02626300
02627000
generateReport5: PROCEDURE 02627700
/*****************************************************************/ 02628400
/* Generates premigration report 5 */ 02629100
/* Reports plans that are autobind candidates in V10 */ 02629800
/*****************************************************************/ 02630500
"EXECIO 0 DISKW REPORT05 (OPEN" 02631200
if rc<>0 then call Dsn_Error 'Write_source_dsn', 02631900
, 'EXECIO DISKW REPORT05 OPEN rc=' rc 02632600
02633300
TEMP.1 = "=== REPORT 5" COPIES('=',59) 02634290
TEMP.2 = "==== THE FOLLOWING REPORT IS RELEVANT ONLY FOR", 02634700
"DB2 SUBSYSTEMS THAT ====" 02635400
TEMP.3 = "==== ORIGINATED PRIOR TO DB2 FOR", 02636100
"OS/390 VERSION 6 ====" 02637090
TEMP.4 = COPIES('=',72) 02637500
TEMP.5 = "= Following is a list of plans that were bound", 02638200
"prior to DB2 Version =" 02638900
TEMP.6 = "= 7. Those having a BOUNDTS value prior to the", 02639600
"date this DB2 was =" 02640300
TEMP.7 = "= migrated to V6 must be rebound in order to run", 02641290
"on DB2 V10. DB2 V10 =" 02641700
TEMP.8 = "= will automatically rebind such a plan the first", 02642400
"time it is used =" 02643100
TEMP.9 = "= if the ABIND subsystem parameter is set to 'YES'", 02643800
"or 'COEXIST'. =" 02644500
TEMP.10 = "= If ABIND is set to 'NO', DB2 V10 will return", 02645200
"SQLCODE -908, SQLSTATE =" 02645900
TEMP.11 = "= 23510 for all attempts to use such a plan until", 02646600
"it is rebound. =" 02647300
TEMP.12 = "= Note that plans that have a BOUNDTS after the", 02648000
"date that this DB2 =" 02648700
TEMP.13 = "= was migrated to V6 do not need to be rebound for", 02649690
"use on V10. =" 02650100
TEMP.14 = COPIES('=',72) 02650800
TEMP.15 = "NAME CREATOR BOUNDTS ", 02651500
"VALID OPERATIVE" 02652200
TEMP.16 = "---------- ---------- --------------------------", 02652900
"----- ---------" 02653600
02654300
'EXECIO' 16 'DISKW REPORT05 (STEM TEMP.' 02655000
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02655700
, 'EXECIO DISKW REPORT05 rc=' rc 02656400
02657100
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 02657800
address DSNREXX EXECSQL SQLSTMT 02658500
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 02659200
02659900
SQLSTMT =, 02660600
" SELECT CHAR( '""' || RTRIM(SUBSTR(NAME, 1, 8)) || '""' ) ", 02661300
" ,CHAR( '""' || RTRIM(SUBSTR(CREATOR, 1, 8)) || '""' ) ", 02662000
" ,BOUNDTS ", 02662700
" ,VALID ", 02663400
" ,OPERATIVE ", 02664100
" FROM SYSIBM.SYSPLAN ", 02664800
" WHERE RELBOUND = ' ' ", 02665500
"ORDER BY BOUNDTS " 02666200
02666900
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 02667600
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 02668300
02669000
address DSNREXX "EXECSQL OPEN C1" 02669700
if sqlcode<>0 then call errsqlca "OPEN C1" 02670400
02671100
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2, :HV3", 02671800
",:HV4, :HV5" 02672500
DO WHILE SQLCODE = 0 02673200
TEMP.1 = HV1 HV2 HV3 HV4 HV5 02673900
'EXECIO' 1 'DISKW REPORT05 (STEM TEMP.' 02674600
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02675300
, 'EXECIO DISKW REPORT05 rc=' rc 02676000
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2, :HV3", 02676700
",:HV4, :HV5" 02677400
END 02678100
02678800
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 02679500
02680200
drop TEMP. HV1 HV2 HV3 HV4 HV5 02680900
'EXECIO 0 DISKW REPORT05 (FINIS' 02681600
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02682300
, 'EXECIO DISKW REPORT05 CLOSE rc=' rc 02683000
02683700
address DSNREXX "EXECSQL CLOSE C1" 02684400
if sqlcode<>0 then call errsqlca "CLOSE C1" 02685100
02685800
CALL IntMsg, 02685900
' Report 4 completed' 02686100
02686300
RETURN /* end generateReport5 */ 02686500
02687200
02687900
generateReport6: PROCEDURE 02688600
/*****************************************************************/ 02689300
/* Generates premigration report 6 */ 02690000
/* Reports packages that are autobind candidates in V10 */ 02690700
/*****************************************************************/ 02691400
"EXECIO 0 DISKW REPORT06 (OPEN" 02692100
if rc<>0 then call Dsn_Error 'Write_source_dsn', 02692800
, 'EXECIO DISKW REPORT06 OPEN rc=' rc 02693500
02694200
TEMP.1 = "=== REPORT 6" COPIES('=',59) 02695190
TEMP.2 = "==== THE FOLLOWING REPORT IS RELEVANT ONLY FOR", 02695600
"DB2 SUBSYSTEMS THAT ====" 02696300
TEMP.3 = "==== ORIGINATED PRIOR TO DB2 FOR", 02697000
"OS/390 VERSION 6 ====" 02697990
TEMP.4 = COPIES('=',72) 02698400
TEMP.5 = "= Following is a list of packages that", 02699100
"were bound prior to DB2 Ver- =" 02699800
TEMP.6 = "= sion 7. Those having a BINDTIME value", 02700500
"prior to the date this DB2 =" 02701200
TEMP.7 = "= was migrated to V6 must be rebound in", 02702190
"order to run on DB2 V10. DB2 =" 02702600
TEMP.8 = "= V10 will automatically rebind such a", 02703300
"package the first time it is =" 02704000
TEMP.9 = "= used if the ABIND subsystem parameter", 02704700
"is set to 'YES' or 'COEXIST'. =" 02705690
TEMP.10 = "= If ABIND is set to 'NO', DB2 V10 will", 02706100
"return SQLCODE -908, SQLSTATE =" 02706800
TEMP.11 = "= 23510 for all attempts to use such a", 02707500
"package until it is rebound. =" 02708200
TEMP.12 = "= Note that packages that have a BINDTIME", 02708900
"after the date that this =" 02709600
TEMP.13 = "= DB2 was migrated to V6 do not need to", 02710590
"be rebound for use on V10. =" 02711000
TEMP.14 = COPIES('=',72) 02711700
TEMP.15 = "LOCATION ", 02712400
"COLLID ", 02713100
"NAME ", 02713800
"CREATOR ", 02714500
"VERSION", 02715200
COPIES(' ',114), 02715900
"BINDTIME ", 02716600
"VALID", 02717300
"OPERATIVE" 02718000
TEMP.16 = "----------------", 02718700
"--------------------", 02719400
"----------", 02720100
"----------", 02720800
COPIES('-',122), 02721500
"--------------------------", 02722200
"-----", 02722900
"---------" 02723600
02724300
'EXECIO' 16 'DISKW REPORT06 (STEM TEMP.' 02725000
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02725700
, 'EXECIO DISKW REPORT06 rc=' rc 02726400
02727100
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 02727800
address DSNREXX EXECSQL SQLSTMT 02728500
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 02729200
02729900
SQLSTMT =, 02730600
" SELECT SUBSTR(LOCATION, 1, 16) ", 02731300
" ,CHAR( '""' || RTRIM(SUBSTR(COLLID, 1, 18)) || '""' ) ", 02732000
" ,CHAR( '""' || RTRIM(SUBSTR(NAME, 1, 8)) || '""' ) ", 02732700
" ,CHAR( '""' || RTRIM(SUBSTR(CREATOR, 1, 8)) || '""' ) ", 02733400
" ,SUBSTR(VERSION ", 02734100
" || ' ' ", 02734800
" || ' ' ", 02735500
" , 1, 122) ", 02736200
" ,BINDTIME ", 02736900
" ,VALID || ' ' ", 02737600
" ,OPERATIVE ", 02738300
" FROM SYSIBM.SYSPACKAGE ", 02739000
" WHERE RELBOUND = ' ' ", 02739700
"ORDER BY BINDTIME " 02740400
02741100
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 02741800
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 02742500
02743200
address DSNREXX "EXECSQL OPEN C1" 02743900
if sqlcode<>0 then call errsqlca "OPEN C1" 02744600
02745300
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2, :HV3", 02746000
",:HV4, :HV5, :HV6", 02746700
",:HV7, :HV8" 02747400
DO WHILE SQLCODE = 0 02748100
TEMP.1 = HV1 HV2 HV3 HV4 HV5 HV6 HV7 HV8 02748800
'EXECIO' 1 'DISKW REPORT06 (STEM TEMP.' 02749500
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02750200
, 'EXECIO DISKW REPORT06 rc=' rc 02750900
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2, :HV3", 02751600
",:HV4, :HV5, :HV6", 02752300
",:HV7, :HV8" 02753000
END 02753700
02754400
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 02755100
02755800
drop TEMP. HV1 HV2 HV3 HV4 HV5 HV6 HV7 HV8 02756500
'EXECIO 0 DISKW REPORT06 (FINIS' 02757200
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02757900
, 'EXECIO DISKW REPORT06 CLOSE rc=' rc 02758600
02759300
address DSNREXX "EXECSQL CLOSE C1" 02760000
if sqlcode<>0 then call errsqlca "CLOSE C1" 02760700
02761400
CALL IntMsg, 02761500
' Report 6 completed' 02761700
02761900
RETURN /* end generateReport6 */ 02762100
02762800
02763500
generateReport7: PROCEDURE 02764200
/*****************************************************************/ 02764900
/* Generates premigration report 7 */ 02765600
/* Reports use of external module DSNWZPR in V10 */ 02766300
/*****************************************************************/ 02767000
"EXECIO 0 DISKW REPORT07 (OPEN" 02767700
if rc<>0 then call Dsn_Error 'Write_source_dsn', 02768400
, 'EXECIO DISKW REPORT07 OPEN rc=' rc 02769100
02769800
TEMP.1 = "=== REPORT 7" COPIES('=',59) 02770790
TEMP.2 = "= The following routines are currently", 02771200
"defined to use an external =" 02771900
TEMP.3 = "= module called DSNWZPR. In V8, DSNWZPR", 02772600
"is an alias of a module =" 02773300
TEMP.4 = "= called DSNWZP. In V9, the DSNWZPR", 02774000
"alias is eliminated. Thus, =" 02774700
TEMP.5 = "= before beginning migration to V10, you", 02775400
"need to alter the routines =" 02776100
TEMP.6 = "= listed below to use an external module", 02776800
"name of DSNWZP rather than =" 02777500
TEMP.7 = "= DSNWZPR. ", 02778200
" =" 02778900
TEMP.8 = COPIES('=',72) 02779600
TEMP.9 = "SCHEMA NAME" 02780300
TEMP.10 = "---------- --------------------" 02781000
02781700
'EXECIO' 10 'DISKW REPORT07 (STEM TEMP.' 02782400
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02783100
, 'EXECIO DISKW REPORT07 rc=' rc 02783800
02784500
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 02785200
address DSNREXX EXECSQL SQLSTMT 02785900
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 02786600
02787300
SQLSTMT =, 02788000
" SELECT CHAR( '""' || RTRIM(SUBSTR(SCHEMA, 1, 8)) || '""' ) ", 02788700
" ,CHAR( '""' || RTRIM(SUBSTR(NAME, 1, 18)) || '""' ) ", 02789400
" FROM SYSIBM.SYSROUTINES ", 02790100
" WHERE EXTERNAL_NAME = 'DSNWZPR' ", 02790800
"ORDER BY SCHEMA, NAME " 02791500
02792200
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 02792900
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 02793600
02794300
address DSNREXX "EXECSQL OPEN C1" 02795000
if sqlcode<>0 then call errsqlca "OPEN C1" 02795700
02796400
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2" 02797100
DO WHILE SQLCODE = 0 02797800
TEMP.1 = HV1 HV2 02798500
'EXECIO' 1 'DISKW REPORT07 (STEM TEMP.' 02799200
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02799900
, 'EXECIO DISKW REPORT07 rc=' rc 02800600
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2" 02801300
END 02802000
02802700
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 02803400
02804100
drop TEMP. HV1 HV2 02804800
'EXECIO 0 DISKW REPORT07 (FINIS' 02805500
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02806200
, 'EXECIO DISKW REPORT07 CLOSE rc=' rc 02806900
02807600
address DSNREXX "EXECSQL CLOSE C1" 02808300
if sqlcode<>0 then call errsqlca "CLOSE C1" 02809000
02809700
CALL IntMsg, 02809800
' Report 7 completed' 02810000
02810200
RETURN /* end generateReport7 */ 02810400
02811100
02811800
generateReport8: PROCEDURE 02812500
/*****************************************************************/ 02813200
/* Generates premigration report 8 */ 02813900
/* Reports incomplete table definitions */ 02814600
/*****************************************************************/ 02815300
"EXECIO 0 DISKW REPORT08 (OPEN" 02816000
if rc<>0 then call Dsn_Error 'Write_source_dsn', 02816700
, 'EXECIO DISKW REPORT08 OPEN rc=' rc 02817400
02818100
TEMP.1 = "=== REPORT 8" COPIES('=',59) 02819090
TEMP.2 = "= The following tables have an incomplete", 02819500
"definition as noted by =" 02820200
TEMP.3 = "= TABLESTATUS: ", 02820900
" =" 02821600
TEMP.4 = "= L = An auxiliary table or auxiliary", 02822300
"index has not been defined =" 02823000
TEMP.5 = "= for a LOB column. ", 02823700
" =" 02824400
TEMP.6 = "= P = The table lacks a required primary", 02825100
"index =" 02825800
TEMP.7 = "= R = The table lacks a required index", 02826500
"on a row ID. =" 02827200
TEMP.8 = "= U = The table lacks a required index", 02827900
"on a unique key. =" 02828600
TEMP.9 = "= V = An error occurred when an attempt", 02829300
"was made to =" 02830000
TEMP.10 = "= regenerate the internal representation", 02830700
"of the view. =" 02831400
TEMP.11 = "= ", 02832100
" =" 02832170
TEMP.12 = "= *** Tables created prior to DB2 V5 are reported", 02832240
"here with a =" 02832320
TEMP.13 = "= blank TABLESTATUS if a required primary index", 02832400
"is missing. =" 02832480
TEMP.14 = "= ", 02832560
" =" 02832640
TEMP.15 = "= You need to complete or drop all such tables", 02832720
"before you begin =" 02832800
TEMP.16 = "= migration because their behavior will be", 02833500
"different in DB2 Version =" 02834200
TEMP.17 = "= 10. ", 02834900
" =" 02835600
TEMP.18 = COPIES('=',72) 02836300
TEMP.19 = "TABLE NAME (SHORT) ", 02837000
"CREATOR (SHORT) ", 02837700
"TABLESTATUS ", 02838400
"TABLE NAME (LONG)", 02839100
COPIES(' ',110), 02839800
"CREATOR (LONG)" 02840500
TEMP.20 = "------------------------------", 02841200
"------------------------------", 02841900
"-----------------", 02842600
COPIES('-',128), 02843300
COPIES('-',128) 02844000
02844700
'EXECIO' 20 'DISKW REPORT08 (STEM TEMP.' 02845400
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02846100
, 'EXECIO DISKW REPORT08 rc=' rc 02846800
02847500
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 02848200
address DSNREXX EXECSQL SQLSTMT 02848900
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 02849600
02850300
SQLSTMT =, 02851000
" SELECT SUBSTR(NAME, 1, 30) ", 02851700
" ,SUBSTR(CREATOR, 1, 30) ", 02852400
" ,SUBSTR(TABLESTATUS, 1, 17)", 02853100
" ,SUBSTR(NAME, 1, 128) ", 02853800
" ,SUBSTR(CREATOR, 1, 128) ", 02854500
" FROM SYSIBM.SYSTABLES ", 02855200
" WHERE STATUS = 'I' " 02855900
02856600
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 02857300
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 02858000
02858700
address DSNREXX "EXECSQL OPEN C1" 02859400
if sqlcode<>0 then call errsqlca "OPEN C1" 02860100
02860800
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2, :HV3,", 02861500
":HV4, :HV5" 02862200
DO WHILE SQLCODE = 0 02862900
TEMP.1 = HV1 HV2 HV3 HV4 HV5 02863600
'EXECIO' 1 'DISKW REPORT08 (STEM TEMP.' 02864300
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02865000
, 'EXECIO DISKW REPORT08 rc=' rc 02865700
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2, :HV3,", 02866400
":HV4, :HV5" 02867100
END 02867800
02868500
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 02869200
02869900
drop TEMP. HV1 HV2 HV3 HV4 HV5 02870600
'EXECIO 0 DISKW REPORT08 (FINIS' 02871300
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02872000
, 'EXECIO DISKW REPORT08 CLOSE rc=' rc 02872700
02873400
address DSNREXX "EXECSQL CLOSE C1" 02874100
if sqlcode<>0 then call errsqlca "CLOSE C1" 02874800
02875500
CALL IntMsg, 02875600
' Report 8 completed' 02875800
02876000
RETURN /* end generateReport8 */ 02876200
02876900
02877600
generateReport9: PROCEDURE 02878300
/*****************************************************************/ 02879000
/* Generates premigration report 9 */ 02879700
/* Reports incomplete column definitions */ 02880400
/*****************************************************************/ 02881100
"EXECIO 0 DISKW REPORT09 (OPEN" 02881800
if rc<>0 then call Dsn_Error 'Write_source_dsn', 02882500
, 'EXECIO DISKW REPORT09 OPEN rc=' rc 02883200
02883900
TEMP.1 = "=== REPORT 9" COPIES('=',59) 02884890
TEMP.2 = "= The following columns in the indicated", 02885300
"tables have an incomplete =" 02886000
TEMP.3 = "= definition because a LOB table space,", 02886700
"auxiliary table, or index on =" 02887400
TEMP.4 = "= an auxiliary table has not been created", 02888100
"for the column. You need =" 02888800
TEMP.5 = "= to complete all such columns or drop the", 02889500
"tables before you begin =" 02890200
TEMP.6 = "= migration because their behavior will be", 02890900
"different in DB2 Version =" 02891600
TEMP.7 = "= 10. ", 02892300
" =" 02893000
TEMP.8 = COPIES('=',72) 02893700
TEMP.9 = "COLUMN NAME ", 02894400
"TABLE NAME (SHORT) ", 02895100
"CREATOR (SHORT) ", 02895800
"TABLE NAME (LONG)", 02896500
COPIES(' ',110), 02897200
"CREATOR (LONG)" 02897900
TEMP.10 = "------------------------------", 02898600
"------------------------------", 02899300
"-----------------", 02900000
COPIES('-',128), 02900700
COPIES('-',128) 02901400
02902100
'EXECIO' 10 'DISKW REPORT09 (STEM TEMP.' 02902800
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02903500
, 'EXECIO DISKW REPORT09 rc=' rc 02904200
02904900
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 02905600
address DSNREXX EXECSQL SQLSTMT 02906300
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 02907000
02907700
SQLSTMT =, 02908400
" SELECT SUBSTR(NAME, 1, 30) ", 02909100
" ,SUBSTR(TBNAME, 1, 30) ", 02909800
" ,SUBSTR(TBCREATOR, 1, 17)", 02910500
" ,SUBSTR(TBNAME, 1, 128) ", 02911200
" ,SUBSTR(TBCREATOR, 1, 128) ", 02911900
" FROM SYSIBM.SYSCOLUMNS ", 02912600
" WHERE COLSTATUS = 'I' " 02913300
02914000
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 02914700
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 02915400
02916100
address DSNREXX "EXECSQL OPEN C1" 02916800
if sqlcode<>0 then call errsqlca "OPEN C1" 02917500
02918200
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2, :HV3", 02918900
",:HV4, :HV5" 02919600
DO WHILE SQLCODE = 0 02920300
TEMP.1 = HV1 HV2 HV3 HV4 HV5 02921000
'EXECIO' 1 'DISKW REPORT09 (STEM TEMP.' 02921700
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02922400
, 'EXECIO DISKW REPORT09 rc=' rc 02923100
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2, :HV3", 02923800
",:HV4, :HV5" 02924500
END 02925200
02925900
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 02926600
02927300
drop TEMP. HV1 HV2 HV3 HV4 HV5 02928000
'EXECIO 0 DISKW REPORT09 (FINIS' 02928700
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 02929400
, 'EXECIO DISKW REPORT09 CLOSE rc=' rc 02930100
02930800
address DSNREXX "EXECSQL CLOSE C1" 02931500
if sqlcode<>0 then call errsqlca "CLOSE C1" 02932200
02932900
CALL IntMsg, 02933000
' Report 9 completed' 02933200
02933400
RETURN /* end generateReport9 */ 02933600
02934300
02935000
generateReport10: PROCEDURE 02935700
/*****************************************************************/ 02936400
/* Generates premigration report 10 */ 02937100
/* Reports DSN_PTASK_TABLEs with column names that contain a */ 02937800
/* hashmark character */ 02938100
/*****************************************************************/ 02938500
"EXECIO 0 DISKW REPORT10 (OPEN" 02939200
if rc<>0 then call Dsn_Error 'Write_source_dsn', 02939900
, 'EXECIO DISKW REPORT10 OPEN rc=' rc 02940600
02941300
TEMP.1 = "=== REPORT 10" COPIES('=',58) 02942290
TEMP.2 = "= The following report lists occurrences of the", 02942700
"DB2 explain table =" 02944700
TEMP.3 = "= DSN_PTASK_TABLE that have one or more column", 02946700
"names containing a =" 02948700
TEMP.4 = "= variant EBCDIC character such as the hashmark", 02950700
"(#) symbol (code point =" 02952700
TEMP.5 = "= x'7b' in code page 37). DSN_PTASK_TABLEs in", 02954700
"this format are not =" 02956700
TEMP.6 = "= supported in V10 because the columns names may", 02958700
"not be acceptable =" 02960700
TEMP.7 = "= when DB2 uses a default EBCDIC code page in", 02962700
"which code point x'7B' =" 02964700
TEMP.8 = "= is not the hashmark. Before migrating to V10,", 02966700
"each table listed =" 02968700
TEMP.9 = "= below either needs to be dropped or converted", 02971700
"to the new format for =" 02974700
TEMP.10 = "= DSN_PTASK_TABLE introduced in DB2 V8 and V9 by", 02977700
"APAR PK65772. See =" 02980700
TEMP.11 = "= the PK65772 cover letter for guidance.", 02983700
" =" 02986700
TEMP.12 = COPIES('=',72) 02989700
TEMP.13 = "TABLE NAME DATABASE TBLSPACE TABLE CREATOR" 02992700
TEMP.14 = "--------------- -------- --------" COPIES('-',128) 02995700
02998700
'EXECIO' 14 'DISKW REPORT10 (STEM TEMP.' 02999400
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03000100
, 'EXECIO DISKW REPORT10 rc=' rc 03000800
03001500
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03002200
address DSNREXX EXECSQL SQLSTMT 03002900
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03003600
03004300
SQLSTMT =, 03005000
" SELECT SUBSTR(TB.NAME, 1, 15) AS TBNAME ", 03005700
" , SUBSTR(TB.DBNAME, 1, 8)", 03006790
" , SUBSTR(TB.TSNAME, 1, 8)", 03007180
" , TB.CREATOR ", 03007800
" FROM SYSIBM.SYSTABLES TB ", 03008500
" , SYSIBM.SYSCOLUMNS CO ", 03009200
" WHERE TB.NAME = 'DSN_PTASK_TABLE' ", 03009900
" AND TB.CREATOR = CO.TBCREATOR ", 03010600
" AND TB.NAME = CO.TBNAME ", 03011300
" AND CO.COLNO IN( 13, 14, 15, 16 ) ", 03012000
" AND LENGTH(CO.NAME) > 7 ", 03012700
"GROUP BY TB.CREATOR, TB.DBNAME, TB.TSNAME, TB.NAME " 03013400
03014100
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03014800
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03015500
03016200
address DSNREXX "EXECSQL OPEN C1" 03016900
if sqlcode<>0 then call errsqlca "OPEN C1" 03017600
03018300
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2, :HV3", 03019000
",:HV4" 03019700
DO WHILE SQLCODE = 0 03020400
TEMP.1 = HV1 HV2 HV3 HV4 03021100
'EXECIO' 1 'DISKW REPORT10 (STEM TEMP.' 03021800
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03022500
, 'EXECIO DISKW REPORT10 rc=' rc 03023200
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2, :HV3", 03023900
",:HV4" 03024600
END 03025300
03026000
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03026700
03027400
drop TEMP. HV1 HV2 HV3 HV4 03028100
'EXECIO 0 DISKW REPORT10 (FINIS' 03028800
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03029500
, 'EXECIO DISKW REPORT10 CLOSE rc=' rc 03030200
03030900
address DSNREXX "EXECSQL CLOSE C1" 03031600
if sqlcode<>0 then call errsqlca "CLOSE C1" 03032300
03033000
CALL IntMsg, 03033100
' Report 10 completed' 03033300
03033500
RETURN /* end generateReport10 */ 03033700
03034400
03035100
generateReport11: PROCEDURE 03035800
/*****************************************************************/ 03036500
/* Generates premigration report 11 */ 03037200
/* Reports plans that contain DBRMs */ 03037900
/*****************************************************************/ 03038600
"EXECIO 0 DISKW REPORT11 (OPEN" 03039300
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03040000
, 'EXECIO DISKW REPORT11 OPEN rc=' rc 03040700
03041400
TEMP.1 = "=== REPORT 11" COPIES('=',58) 03042390
TEMP.2 = "= Following is a list of plans that", 03042800
"contain DBRMS, in other words =" 03043800
TEMP.3 = "= plans that were created using the", 03044800
"MEMBER clause of the BIND PLAN =" 03045800
TEMP.4 = "= command. Support for such plans is", 03046800
"being removed in DB2 V10. To =" 03047800
TEMP.5 = "= convert these plans, use the REBIND", 03048800
"PLAN statement with the COLLID =" 03049800
TEMP.6 = "= option. You also need to convert the", 03050800
"BIND statements for these =" 03051800
TEMP.7 = "= plans to use packages. See the DB2", 03052800
"V10 Release Guide for more =" 03054800
TEMP.8 = "= information. ", 03056800
" =" 03058800
TEMP.9 = "= ", 03061190
" =" 03061580
TEMP.10 = "= Notice: No action is required for prior-release", 03061970
"DB2 sample plans =" 03062360
TEMP.11 = "= such as DSN8BH81, DSN8BD81, DSN8BE81,", 03062750
"DSN8BP81, DSN8SC81, =" 03063140
TEMP.12 = "= DSN8SP81, DSN8BH91, DSN8BD91, DSN8BE91,", 03063530
"DSN8BP91, DSN8SC91, =" 03063920
TEMP.13 = "= DSN8SP91, DSN8CP0, DSN8CQ0, and DSN8CH0.", 03064310
" =" 03064700
TEMP.14 = COPIES('=',72) 03065090
TEMP.15 = "NAME" 03065480
TEMP.16 = "--------" 03065870
03067300
'EXECIO' 16 'DISKW REPORT11 (STEM TEMP.' 03068290
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03068700
, 'EXECIO DISKW REPORT11 rc=' rc 03069400
03070100
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03070800
address DSNREXX EXECSQL SQLSTMT 03071500
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03072200
03072900
SQLSTMT =, 03073600
"SELECT DISTINCT PLNAME FROM SYSIBM.SYSDBRM", 03075290
"WHERE PLNAME NOT IN( 'DSNTIA81', 'DSNTIA91'", 03076280
", 'DSNHSP81', 'DSNHSP91'", 03077270
", 'DSNTIB81', 'DSNTIB91' )", 03078260
"AND PLNAME NOT LIKE 'DSN8%'" 03079250
03081300
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03082000
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03082700
03083400
address DSNREXX "EXECSQL OPEN C1" 03084100
if sqlcode<>0 then call errsqlca "OPEN C1" 03084800
03085500
address DSNREXX "EXECSQL FETCH C1 INTO :HV1" 03086200
DO WHILE SQLCODE = 0 03086900
TEMP.1 = HV1 03087600
'EXECIO' 1 'DISKW REPORT11 (STEM TEMP.' 03088300
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03089000
, 'EXECIO DISKW REPORT11 rc=' rc 03089700
address DSNREXX "EXECSQL FETCH C1 INTO :HV1" 03090400
END 03091100
03091800
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03092500
03093200
drop TEMP. HV1 03093900
'EXECIO 0 DISKW REPORT11 (FINIS' 03094600
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03095300
, 'EXECIO DISKW REPORT11 CLOSE rc=' rc 03096000
03096700
address DSNREXX "EXECSQL CLOSE C1" 03097400
if sqlcode<>0 then call errsqlca "CLOSE C1" 03098100
03098800
CALL IntMsg, 03098900
' Report 11 completed' 03099100
03099300
RETURN /* end generateReport11 */ 03099500
03100200
03100900
generateReport12: PROCEDURE 03101600
/*****************************************************************/ 03102300
/* Generates premigration report 12 */ 03103000
/* Reports plans bound with ACQUIRE(ALLOCATE) */ 03103700
/*****************************************************************/ 03104400
"EXECIO 0 DISKW REPORT12 (OPEN" 03105100
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03105800
, 'EXECIO DISKW REPORT12 OPEN rc=' rc 03106500
03107200
TEMP.1 = "=== REPORT 12" COPIES('=',58) 03108190
TEMP.2 = "= Following is a list of plans bound", 03108600
"with ACQUIRE(ALLOCATE). Support =" 03109500
TEMP.3 = "= for ACQUIRE(ALLOCATE) is being removed", 03110500
"in DB2 V10, and the syntax of =" 03111500
TEMP.4 = "= this option is deprecated. Use the", 03112500
"REBIND PLAN statement with =" 03113500
TEMP.5 = "= ACQUIRE(USE) to change this option in", 03114500
"existing plans. =" 03115500
TEMP.6 = COPIES('=',72) 03116500
TEMP.7 = "NAME" 03117500
TEMP.8 = "--------" 03118500
03120500
'EXECIO' 8 'DISKW REPORT12 (STEM TEMP.' 03121200
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03121900
, 'EXECIO DISKW REPORT12 rc=' rc 03122600
03123300
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03124000
address DSNREXX EXECSQL SQLSTMT 03124700
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03125400
03126100
SQLSTMT =, 03126800
"SELECT NAME FROM SYSIBM.SYSPLAN", 03127500
" WHERE ACQUIRE = 'A'" 03127800
03128200
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03128900
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03129600
03130300
address DSNREXX "EXECSQL OPEN C1" 03131000
if sqlcode<>0 then call errsqlca "OPEN C1" 03131700
03132400
address DSNREXX "EXECSQL FETCH C1 INTO :HV1" 03133100
DO WHILE SQLCODE = 0 03133800
TEMP.1 = HV1 03134500
'EXECIO' 1 'DISKW REPORT12 (STEM TEMP.' 03135200
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03135900
, 'EXECIO DISKW REPORT12 rc=' rc 03136600
address DSNREXX "EXECSQL FETCH C1 INTO :HV1" 03137300
END 03138000
03138700
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03139400
03140100
drop TEMP. HV1 03140800
'EXECIO 0 DISKW REPORT12 (FINIS' 03141500
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03142200
, 'EXECIO DISKW REPORT12 CLOSE rc=' rc 03142900
03143600
address DSNREXX "EXECSQL CLOSE C1" 03144300
if sqlcode<>0 then call errsqlca "CLOSE C1" 03145000
03145700
CALL IntMsg, 03145800
' Report 12 completed' 03146000
03146200
RETURN /* end generateReport12 */ 03146400
03147100
03147800
generateReport13: PROCEDURE 03148500
/*****************************************************************/ 03149200
/* Generates premigration report 13 */ 03149900
/* Reports static queries bound with query parallelism */ 03150600
/*****************************************************************/ 03151300
"EXECIO 0 DISKW REPORT13 (OPEN" 03152000
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03152700
, 'EXECIO DISKW REPORT13 OPEN rc=' rc 03153400
03154100
TEMP.1 = "=== REPORT 13" COPIES('=',58) 03174790
TEMP.2 = "= Each package listed below is bound with", 03201180
"DEGREE(ANY). There may exist =" 03201570
TEMP.3 = "= queries in these packages that have been", 03201960
"built to use parallelism. =" 03202350
TEMP.4 = "= If a query was built to use parallelism,", 03202740
"it will be incrementally =" 03203130
TEMP.5 = "= rebound each time it is executed on DB2 V10.", 03203520
" This report will only =" 03203910
TEMP.6 = "= identify which packages were bound with", 03204300
"DEGREE(ANY). Therefore, =" 03204690
TEMP.7 = "= after migrating to V10 Conversion Mode, you", 03205080
"can monitor incremental =" 03205470
TEMP.8 = "= rebinds on the DB2 accounting and statistic", 03205860
"reports and issue =" 03206250
TEMP.9 = "= explicit rebinds for packages reported on", 03206640
"IFCID 360 to avoid the =" 03207030
TEMP.10 = "= cost of incremental rebinds at execution", 03207420
"time. When rebinding, it =" 03207810
TEMP.11 = "= is necessary to specify the DEGREE(ANY)", 03208200
"option in order to maintain =" 03208590
TEMP.12 = "= parallelism. ", 03208980
" =" 03209370
TEMP.13 = COPIES('=',72) 03209760
TEMP.14 = "Collection ID and package name" COPIES(' ',226), 03210150
"CONTOKEN" 03211500
TEMP.15 = COPIES('-',257), 03212680
COPIES('-',16) 03212900
03213600
'EXECIO' 15 'DISKW REPORT13 (STEM TEMP.' 03214780
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03215000
, 'EXECIO DISKW REPORT13 rc=' rc 03215700
03216400
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03217100
address DSNREXX EXECSQL SQLSTMT 03217800
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03218500
03219200
SQLSTMT =, 03219900
"SELECT SUBSTR(COLLID || '.' || NAME, 1, 257)", 03220600
" ,HEX(CONTOKEN) ", 03221300
" FROM SYSIBM.SYSPACKAGE ", 03222000
" WHERE DEGREE = 'ANY'", 03222890
" AND RELBOUND <> 'O'" 03223080
03223400
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03224100
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03224800
03225500
address DSNREXX "EXECSQL OPEN C1" 03226200
if sqlcode<>0 then call errsqlca "OPEN C1" 03226900
03227600
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2" 03228300
DO WHILE SQLCODE = 0 03229000
TEMP.1 = HV1 HV2 03229700
'EXECIO' 1 'DISKW REPORT13 (STEM TEMP.' 03230400
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03231100
, 'EXECIO DISKW REPORT13 rc=' rc 03231800
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2" 03232500
END 03233200
03233900
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03234600
03235300
drop TEMP. HV1 HV2 03236000
'EXECIO 0 DISKW REPORT13 (FINIS' 03236700
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03237400
, 'EXECIO DISKW REPORT13 CLOSE rc=' rc 03238100
03238800
address DSNREXX "EXECSQL CLOSE C1" 03239500
if sqlcode<>0 then call errsqlca "CLOSE C1" 03240200
03240900
CALL IntMsg, 03241000
' Report 13 completed' 03241200
03241400
RETURN /* end generateReport13 */ 03241600
03242300
03243000
generateReport14: PROCEDURE 03243001
/*****************************************************************/ 03243002
/* Generates premigration report 14 */ 03243003
/* Reports EBDDIC explain tables */ 03243004
/*****************************************************************/ 03243005
"EXECIO 0 DISKW REPORT14 (OPEN" 03243006
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03243007
, 'EXECIO DISKW REPORT14 OPEN rc=' rc 03243008
03243009
TEMP.1 = "=== REPORT 14" COPIES('=',58) 03243011
TEMP.2 = "= EBCDIC-encoded EXPLAIN tables that need to be", 03243012
"migrated to Unicode ", 03243013
"=" 03243014
TEMP.3 = COPIES('=',72) 03243015
TEMP.4 = "= The EXPLAIN tables listed below are EBCDIC-encoded. ", 03243016
"Unicode-encoded", 03243017
"=" 03243018
TEMP.5 = "= EXPLAIN tables are recommended because the DB2", 03243019
"catalog is Unicode. ", 03243020
"=" 03243021
TEMP.6 = "= Also, support for EBCDIC-encoded EXPLAIN tables", 03243022
"is deprecated and ", 03243023
"=" 03243024
TEMP.7 = "= may be eliminated in a future release of DB2. ", 03243025
"Use the following to ", 03243026
"=" 03243027
TEMP.8 = "= help migrate these tables to Unicode: ", 03243028
" ", 03243029
"=" 03243030
TEMP.9 = "= (*) DB2 sample job DSNTIJXB provides a REXX exec", 03243031
"that generates two ", 03243032
"=" 03243033
TEMP.10 = "= types of statements you can use to migrate", 03243034
"the EBCDIC-encoded ", 03243035
"=" 03243036
TEMP.11 = "= EXPLAIN tables for a specified creator to", 03243037
"Unicode. In addition ", 03243038
"=" 03243039
TEMP.12 = "= to the creator name, you must specify the", 03243040
"names of new or ", 03243041
"=" 03243042
TEMP.13 = "= existing Unicode table spaces in which to", 03243043
"create the new EXPLAIN", 03243044
"=" 03243045
TEMP.14 = "= tables. Use the cross loader statements", 03243046
"generated by this exec ", 03243047
"=" 03243048
TEMP.15 = "= if you are licensed to use the DB2 Utilities", 03243049
"Suite. Otherwise, ", 03243050
"=" 03243051
TEMP.16 = "= use the DDL statements generated by the ", 03243052
"exec. ", 03243053
"=" 03243054
TEMP.17 = "= (*) DB2 sample job DSNTIJXC shows how to invoke", 03243055
"the DB2 cross-loader", 03243056
"=" 03243057
TEMP.18 = "= function to process these generated control", 03243058
"statements after you", 03243059
"=" 03243060
TEMP.19 = "= have reviewed them. ", 03243061
" ", 03243062
"=" 03243063
TEMP.20 = COPIES('=',72) 03243064
03243065
TEMP.21 = "CREATOR.NAME" COPIES(' ',244) 03243066
TEMP.22 = COPIES('-',257) 03243067
03243068
'EXECIO' 22 'DISKW REPORT14 (STEM TEMP.' 03243069
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03243070
, 'EXECIO DISKW REPORT14 rc=' rc 03243071
03243072
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03243073
address DSNREXX EXECSQL SQLSTMT 03243074
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03243075
03243076
SQLSTMT =, 03243077
"SELECT STRIP(TB.CREATOR) || '.' || STRIP(TB.NAME)", 03243078
"FROM SYSIBM.SYSTABLES TB", 03243079
",SYSIBM.SYSTABLESPACE TS", 03243080
"WHERE TB.DBNAME = TS.DBNAME", 03243081
"AND TB.TSNAME = TS.NAME", 03243082
"AND TB.TYPE = 'T'", 03243083
"AND TS.ENCODING_SCHEME <> 'U'", 03243084
"AND TB.NAME IN( 'DSN_DETCOST_TABLE'", 03243085
",'DSN_FILTER_TABLE'", 03243086
",'DSN_FUNCTION_TABLE'", 03243087
",'DSN_PGRANGE_TABLE'", 03243088
",'DSN_PGROUP_TABLE'", 03243089
",'DSN_PREDICAT_TABLE'", 03243090
",'DSN_PROFILE_TABLE'", 03243091
",'DSN_PROFILE_HISTORY'", 03243092
",'DSN_PTASK_TABLE'", 03243093
",'DSN_QUERY_AUX'", 03243094
",'DSN_QUERY_TABLE'", 03243095
",'DSN_SORTKEY_TABLE'", 03243096
",'DSN_SORT_TABLE'", 03243097
",'DSN_STATEMENT_CACHE_AUX'", 03243098
",'DSN_STATEMENT_CACHE_TABLE'", 03243099
",'DSN_STATEMENT_RUNTIME_INFO'", 03243100
",'DSN_STATEMNT_TABLE'", 03243101
",'DSN_STRUCT_TABLE'", 03243102
",'DSN_VIEWREF_TABLE'", 03243103
",'DSN_VIRTUAL_INDEX'", 03243104
",'PLAN_TABLE'", 03243105
")", 03243106
"ORDER BY TB.CREATOR, TB.NAME" 03243107
03243108
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03243109
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03243110
03243111
address DSNREXX "EXECSQL OPEN C1" 03243112
if sqlcode<>0 then call errsqlca "OPEN C1" 03243113
03243114
address DSNREXX "EXECSQL FETCH C1 INTO :HV1" 03243115
DO WHILE SQLCODE = 0 03243116
TEMP.1 = HV1 03243117
'EXECIO' 1 'DISKW REPORT14 (STEM TEMP.' 03243118
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03243119
, 'EXECIO DISKW REPORT14 rc=' rc 03243120
address DSNREXX "EXECSQL FETCH C1 INTO :HV1" 03243121
END 03243122
03243123
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03243124
03243125
drop TEMP. HV1 03243126
'EXECIO 0 DISKW REPORT14 (FINIS' 03243127
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03243128
, 'EXECIO DISKW REPORT14 CLOSE rc=' rc 03243129
03243130
address DSNREXX "EXECSQL CLOSE C1" 03243131
if sqlcode<>0 then call errsqlca "CLOSE C1" 03243132
03243133
CALL IntMsg, 03243134
' Report 14 completed' 03243135
03243136
RETURN /* end generateReport14 */ 03243137
03243138
03243139
generateReport15: PROCEDURE 03243140
/*****************************************************************/ 03243141
/* Generates premigration report 15 */ 03243142
/* Reports explain tables that are not in current-release fmt */ 03243143
/*****************************************************************/ 03243144
"EXECIO 0 DISKW REPORT15 (OPEN" 03243145
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03243146
, 'EXECIO DISKW REPORT15 OPEN rc=' rc 03243147
03243148
TEMP.1 = "=== REPORT 15" COPIES('=',58) 03243149
TEMP.2 = "= EXPLAIN tables that need to be updated to", 03243150
"current-release format ", 03243151
"=" 03243152
TEMP.3 = COPIES('=',72) 03243153
TEMP.4 = "= The EXPLAIN tables listed below are not in", 03243154
"current-release format, ", 03243155
"=" 03243156
TEMP.5 = "= meaning that one or more columns available in the", 03243157
"current release ", 03243158
"=" 03243159
TEMP.6 = "= is missing or has a different length than found. ", 03243160
"Use of such ", 03243161
"=" 03243162
TEMP.7 = "= EXPLAIN tables is deprecated and support for them", 03243163
"may be removed in ", 03243164
"=" 03243165
TEMP.8 = "= in a future release of DB2. Use DB2 sample job", 03243166
"DSNTIJXA to alter ", 03243167
"=" 03243168
TEMP.9 = "= all tables in a specified schema to current release", 03243169
"format. ", 03243170
"=" 03243171
TEMP.10 = COPIES('=',72) 03243172
03243173
TEMP.11 = "CREATOR.NAME" COPIES(' ',244) 03243174
TEMP.12 = COPIES('-',257) 03243175
03243176
'EXECIO' 12 'DISKW REPORT15 (STEM TEMP.' 03243177
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03243178
, 'EXECIO DISKW REPORT15 rc=' rc 03243179
03243180
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03243181
address DSNREXX EXECSQL SQLSTMT 03243182
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03243183
03243184
/*****************************************************************/ 03243185
/* The following CTE consists of 3 parts separated by UNIONs: */ 03243186
/* Part 1: Finds EXPLAIN tables on V9 that have missing columns */ 03243187
/* Part 2: Finds EXPLAIN tables on V8 that have missing columns */ 03243188
/* Part 3: Finds EXPLAIN tables on V8 or V9 that have unexpected */ 03243189
/* column lengths */ 03243190
/*****************************************************************/ 03243191
SQLSTMT =, 03243192
"WITH OLD_FORMAT_EXPLAIN_TABLES (FULL_NAME) AS", 03243193
"( SELECT STRIP(TBCREATOR) || '.' || STRIP(TBNAME)", 03243194
"FROM SYSIBM.SYSCOLUMNS", 03243195
"WHERE SUBSTR(GETVARIABLE('SYSIBM.VERSION'), 1, 5) >= 'DSN09'",03243196
"AND TBNAME IN( 'DSN_DETCOST_TABLE'", 03243197
", 'DSN_FILTER_TABLE'", 03243198
", 'DSN_FUNCTION_TABLE'", 03243199
", 'DSN_PGRANGE_TABLE'", 03243200
", 'DSN_PGROUP_TABLE'", 03243201
", 'DSN_PREDICAT_TABLE'", 03243202
", 'DSN_PROFILE_HISTORY'", 03243203
", 'DSN_PROFILE_TABLE'", 03243204
", 'DSN_PTASK_TABLE'", 03243205
", 'DSN_QUERY_TABLE'", 03243206
", 'DSN_SORT_TABLE'", 03243207
", 'DSN_SORTKEY_TABLE'", 03243208
", 'DSN_STATEMENT_CACHE_TABLE'", 03243209
", 'DSN_STATEMENT_RUNTIME_INFO'", 03243210
", 'DSN_STATEMNT_TABLE'", 03243211
", 'DSN_STRUCT_TABLE'", 03243212
", 'DSN_VIEWREF_TABLE'", 03243213
", 'DSN_VIRTUAL_INDEXES'", 03243214
", 'PLAN_TABLE'", 03243215
")", 03243216
"GROUP BY TBCREATOR, TBNAME", 03243217
"HAVING (TBNAME = 'DSN_DETCOST_TABLE'", 03243218
"AND MAX(COLNO) < 120)", 03243219
"OR (TBNAME = 'DSN_FILTER_TABLE'", 03243220
"AND MAX(COLNO) < 14)", 03243221
"OR (TBNAME = 'DSN_FUNCTION_TABLE'", 03243222
"AND MAX(COLNO) < 15)", 03243223
"OR (TBNAME = 'DSN_PGRANGE_TABLE'", 03243224
"AND MAX(COLNO) < 9)", 03243225
"OR (TBNAME = 'DSN_PGROUP_TABLE'", 03243226
"AND MAX(COLNO) < 38)", 03243227
"OR (TBNAME = 'DSN_PREDICAT_TABLE'", 03243228
"AND MAX(COLNO) < 36)", 03243229
"OR (TBNAME = 'DSN_PROFILE_HISTORY'", 03243230
"AND MAX(COLNO) < 10)", 03243231
"OR (TBNAME = 'DSN_PROFILE_TABLE'", 03243232
"AND MAX(COLNO) < 10)", 03243233
"OR (TBNAME = 'DSN_PTASK_TABLE'", 03243234
"AND MAX(COLNO) < 21)", 03243235
"OR (TBNAME = 'DSN_QUERY_TABLE'", 03243236
"AND MAX(COLNO) < 10)", 03243237
"OR (TBNAME = 'DSN_SORT_TABLE'", 03243238
"AND MAX(COLNO) < 13)", 03243239
"OR (TBNAME = 'DSN_SORTKEY_TABLE'", 03243240
"AND MAX(COLNO) < 18)", 03243241
"OR (TBNAME = 'DSN_STATEMENT_CACHE_TABLE'", 03243242
"AND MAX(COLNO) < 48)", 03243243
"OR (TBNAME = 'DSN_STATEMENT_RUNTIME_INFO'", 03243244
"AND MAX(COLNO) < 51)", 03243245
"OR (TBNAME = 'DSN_STATEMNT_TABLE'", 03243246
"AND MAX(COLNO) < 13)", 03243247
"OR (TBNAME = 'DSN_STRUCT_TABLE'", 03243248
"AND MAX(COLNO) < 15)", 03243249
"OR (TBNAME = 'DSN_VIEWREF_TABLE'", 03243250
"AND MAX(COLNO) < 11)", 03243251
"OR (TBNAME = 'DSN_VIRTUAL_INDEXES'", 03243252
"AND MAX(COLNO) < 145)", 03243253
"OR (TBNAME = 'PLAN_TABLE'", 03243254
"AND MAX(COLNO) < 59)", 03243255
"UNION", 03243256
"SELECT STRIP(TBCREATOR) || '.' || STRIP(TBNAME)", 03243257
"FROM SYSIBM.SYSCOLUMNS", 03243258
"WHERE SUBSTR(GETVARIABLE('SYSIBM.VERSION'), 1, 5) >= 'DSN08'",03243259
"AND TBNAME IN( 'DSN_DETCOST_TABLE'", 03243260
", 'DSN_FILTER_TABLE'", 03243261
", 'DSN_FUNCTION_TABLE'", 03243262
", 'DSN_PGRANGE_TABLE'", 03243263
", 'DSN_PGROUP_TABLE'", 03243264
", 'DSN_PREDICAT_TABLE'", 03243265
", 'DSN_PROFILE_HISTORY'", 03243266
", 'DSN_PROFILE_TABLE'", 03243267
", 'DSN_PTASK_TABLE'", 03243268
", 'DSN_QUERY_TABLE'", 03243269
", 'DSN_SORT_TABLE'", 03243270
", 'DSN_SORTKEY_TABLE'", 03243271
", 'DSN_STATEMENT_CACHE_TABLE'", 03243272
", 'DSN_STATEMENT_RUNTIME_INFO'", 03243273
", 'DSN_STATEMNT_TABLE'", 03243274
", 'DSN_STRUCT_TABLE'", 03243275
", 'DSN_VIEWREF_TABLE'", 03243276
", 'DSN_VIRTUAL_INDEXES'", 03243277
", 'PLAN_TABLE'", 03243278
")", 03243279
"GROUP BY TBCREATOR, TBNAME", 03243280
"HAVING (TBNAME = 'DSN_DETCOST_TABLE'", 03243281
"AND MAX(COLNO) < 85)", 03243282
"OR (TBNAME = 'DSN_FILTER_TABLE'", 03243283
"AND MAX(COLNO) < 11)", 03243284
"OR (TBNAME = 'DSN_FUNCTION_TABLE'", 03243285
"AND MAX(COLNO) < 15)", 03243286
"OR (TBNAME = 'DSN_PGRANGE_TABLE'", 03243287
"AND MAX(COLNO) < 8)", 03243288
"OR (TBNAME = 'DSN_PGROUP_TABLE'", 03243289
"AND MAX(COLNO) < 32)", 03243290
"OR (TBNAME = 'DSN_PREDICAT_TABLE'", 03243291
"AND MAX(COLNO) < 35)", 03243292
"OR (TBNAME = 'DSN_PTASK_TABLE'", 03243293
"AND MAX(COLNO) < 20)", 03243294
"OR (TBNAME = 'DSN_QUERY_TABLE'", 03243295
"AND MAX(COLNO) < 9)", 03243296
"OR (TBNAME = 'DSN_SORT_TABLE'", 03243297
"AND MAX(COLNO) < 12)", 03243298
"OR (TBNAME = 'DSN_SORTKEY_TABLE'", 03243299
"AND MAX(COLNO) < 17)", 03243300
"OR (TBNAME = 'DSN_STATEMENT_CACHE_TABLE'", 03243301
"AND MAX(COLNO) < 46)", 03243302
"OR (TBNAME = 'DSN_STATEMNT_TABLE'", 03243303
"AND MAX(COLNO) < 12)", 03243304
"OR (TBNAME = 'DSN_STRUCT_TABLE'", 03243305
"AND MAX(COLNO) < 14)", 03243306
"OR (TBNAME = 'DSN_VIEWREF_TABLE'", 03243307
"AND MAX(COLNO) < 10)", 03243308
"OR (TBNAME = 'DSN_VIRTUAL_INDEXES'", 03243309
"AND MAX(COLNO) < 145)", 03243310
"OR (TBNAME = 'PLAN_TABLE'", 03243311
"AND MAX(COLNO) < 58)", 03243312
"UNION", 03243314
"SELECT STRIP(TBCREATOR) || '.' || STRIP(TBNAME)", 03243316
"FROM SYSIBM.SYSCOLUMNS", 03243317
"WHERE SUBSTR(GETVARIABLE('SYSIBM.VERSION'), 1, 5) >= 'DSN09'",03243318
"AND TBNAME IN( 'DSN_DETCOST_TABLE'", 03243319
", 'DSN_FILTER_TABLE'", 03243320
", 'DSN_FUNCTION_TABLE'", 03243321
", 'DSN_PGRANGE_TABLE'", 03243322
", 'DSN_PGROUP_TABLE'", 03243323
", 'DSN_PREDICAT_TABLE'", 03243324
", 'DSN_PROFILE_HISTORY'", 03243325
", 'DSN_PROFILE_TABLE'", 03243326
", 'DSN_PTASK_TABLE'", 03243327
", 'DSN_QUERY_TABLE'", 03243328
", 'DSN_SORT_TABLE'", 03243329
", 'DSN_SORTKEY_TABLE'", 03243330
", 'DSN_STATEMENT_CACHE_TABLE'", 03243331
", 'DSN_STATEMENT_RUNTIME_INFO'", 03243332
", 'DSN_STATEMNT_TABLE'", 03243333
", 'DSN_STRUCT_TABLE'", 03243334
", 'DSN_VIEWREF_TABLE'", 03243335
", 'DSN_VIRTUAL_INDEXES'", 03243336
", 'PLAN_TABLE'", 03243337
")", 03243338
"AND ( (NAME = 'ACCESSCREATOR' AND LENGTH <> 128)", 03243339
"OR (NAME = 'ACCESSNAME' AND LENGTH <> 128)", 03243340
"OR (NAME = 'APPLNAME' AND LENGTH <> 24)", 03243341
"OR (NAME = 'COLLID' AND LENGTH <> 128)", 03243342
"OR (NAME = 'CORRELATION_NAME' AND LENGTH <> 128)", 03243343
"OR (NAME = 'CREATOR' AND LENGTH <> 128)", 03243344
"OR (NAME = 'FUNCTION_NAME' AND LENGTH <> 128)", 03243345
"OR (NAME = 'FUNCTION_TEXT' AND LENGTH <> 1500)", 03243346
"OR (NAME = 'GROUP_MEMBER' AND LENGTH <> 24)", 03243347
"OR (NAME = 'HINTUSED' AND LENGTH <> 128)", 03243348
"OR (NAME = 'OPTHINT' AND LENGTH <> 128)", 03243349
"OR (NAME = 'PATH' AND LENGTH <> 2048)", 03243350
"OR (NAME = 'PLANNAME' AND LENGTH <> 24)", 03243351
"OR (NAME = 'PROGNAME' AND LENGTH <> 128)", 03243352
"OR (NAME = 'REMARKS' AND LENGTH <> 762)", 03243353
"OR (NAME = 'SCHEMA_NAME' AND LENGTH <> 128)", 03243354
"OR (NAME = 'SPEC_FUNC_NAME' AND LENGTH <> 128)", 03243355
"OR (NAME = 'TNAME' AND LENGTH <> 128)", 03243356
"OR (NAME = 'VERSION' AND LENGTH <> 122)", 03243357
"OR (NAME = 'VIEW_CREATOR' AND LENGTH <> 128)", 03243358
"OR (NAME = 'VIEW_NAME' AND LENGTH <> 128)", 03243359
")", 03243360
"UNION", 03243361
"SELECT STRIP(TBCREATOR) || '.' || STRIP(TBNAME)", 03243362
"FROM SYSIBM.SYSCOLUMNS", 03243363
"WHERE SUBSTR(GETVARIABLE('SYSIBM.VERSION'), 1, 5) >= 'DSN08'",03243364
"AND TBNAME IN( 'DSN_DETCOST_TABLE'", 03243365
", 'DSN_FILTER_TABLE'", 03243366
", 'DSN_FUNCTION_TABLE'", 03243367
", 'DSN_PGRANGE_TABLE'", 03243368
", 'DSN_PGROUP_TABLE'", 03243369
", 'DSN_PREDICAT_TABLE'", 03243370
", 'DSN_PTASK_TABLE'", 03243371
", 'DSN_QUERY_TABLE'", 03243372
", 'DSN_SORT_TABLE'", 03243373
", 'DSN_SORTKEY_TABLE'", 03243374
", 'DSN_STATEMENT_CACHE_TABLE'", 03243375
", 'DSN_STATEMENT_RUNTIME_INFO'", 03243376
", 'DSN_STATEMNT_TABLE'", 03243377
", 'DSN_STRUCT_TABLE'", 03243378
", 'DSN_VIEWREF_TABLE'", 03243379
", 'DSN_VIRTUAL_INDEXES'", 03243380
", 'PLAN_TABLE'", 03243381
")", 03243382
"AND ( (NAME = 'ACCESSCREATOR' AND LENGTH <> 128)", 03243383
"OR (NAME = 'ACCESSNAME' AND LENGTH <> 128)", 03243384
"OR (NAME = 'APPLNAME' AND LENGTH < 8)", 03243385
"OR (NAME = 'COLLID' AND LENGTH <> 128)", 03243386
"OR (NAME = 'CORRELATION_NAME' AND LENGTH <> 128)", 03243387
"OR (NAME = 'CREATOR' AND LENGTH <> 128)", 03243388
"OR (NAME = 'FUNCTION_NAME' AND LENGTH <> 128)", 03243389
"OR (NAME = 'FUNCTION_TEXT' AND LENGTH <> 1500)", 03243390
"OR (NAME = 'GROUP_MEMBER' AND LENGTH < 8)", 03243391
"OR (NAME = 'HINTUSED' AND LENGTH <> 128)", 03243392
"OR (NAME = 'OPTHINT' AND LENGTH <> 128)", 03243393
"OR (NAME = 'PATH' AND LENGTH <> 2048)", 03243394
"OR (NAME = 'PLANNAME' AND LENGTH < 8)", 03243395
"OR (NAME = 'PROGNAME' AND LENGTH <> 128)", 03243396
"OR (NAME = 'REMARKS' AND LENGTH <> 762)", 03243397
"OR (NAME = 'SCHEMA_NAME' AND LENGTH <> 128)", 03243398
"OR (NAME = 'SPEC_FUNC_NAME' AND LENGTH <> 128)", 03243399
"OR (NAME = 'TNAME' AND LENGTH <> 128)", 03243400
"OR (NAME = 'VERSION' AND LENGTH < 64)", 03243401
"OR (NAME = 'VIEW_CREATOR' AND LENGTH <> 128)", 03243402
"OR (NAME = 'VIEW_NAME' AND LENGTH <> 128)", 03243403
")", 03243404
")", 03243405
"SELECT DISTINCT(FULL_NAME)", 03243406
"FROM OLD_FORMAT_EXPLAIN_TABLES", 03243407
"ORDER BY FULL_NAME" 03243408
03243409
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03243410
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03243411
03243412
address DSNREXX "EXECSQL OPEN C1" 03243413
if sqlcode<>0 then call errsqlca "OPEN C1" 03243414
03243415
address DSNREXX "EXECSQL FETCH C1 INTO :HV1" 03243416
DO WHILE SQLCODE = 0 03243417
TEMP.1 = HV1 03243418
'EXECIO' 1 'DISKW REPORT15 (STEM TEMP.' 03243419
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03243420
, 'EXECIO DISKW REPORT15 rc=' rc 03243421
address DSNREXX "EXECSQL FETCH C1 INTO :HV1" 03243422
END 03243423
03243424
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03243425
03243426
drop TEMP. HV1 03243427
'EXECIO 0 DISKW REPORT15 (FINIS' 03243428
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03243429
, 'EXECIO DISKW REPORT15 CLOSE rc=' rc 03243430
03243431
address DSNREXX "EXECSQL CLOSE C1" 03243432
if sqlcode<>0 then call errsqlca "CLOSE C1" 03243433
03243434
CALL IntMsg, 03243435
' Report 15 completed' 03243436
03243437
RETURN /* end generateReport15 */ 03243438
03243439
03243440
generateReport16: PROCEDURE 03243441
/*****************************************************************/ 03243442
/* Generates premigration report 16 */ 03243443
/* Report MQTs on the DB2 catalog that are affected by CATMAINT*/ 03243444
/*****************************************************************/ 03243445
"EXECIO 0 DISKW REPORT16 (OPEN" 03243446
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03243447
, 'EXECIO DISKW REPORT16 OPEN rc=' rc 03243448
03243449
TEMP.1 = "=== REPORT 16" COPIES('=',58) 03243451
TEMP.2 = "= MQTs on the DB2 catalog that are affected by DSNTIJTC",03243452
" ", 03243453
"=" 03243454
TEMP.3 = COPIES('=',72) 03243455
TEMP.4 = "= Following is a list of Materialized Query Tables", 03243456
"(MQTs) on the DB2 ", 03243457
"=" 03243458
TEMP.5 = "= catalog or on views that base on the DB2 catalog. ", 03243459
"You need to drop ", 03243460
"=" 03243461
TEMP.6 = "= these MQTs before starting migration to DB2 V10,", 03243462
"otherwise CATMAINT ", 03243463
"=" 03243464
TEMP.7 = "= processing will fail. You can", 03243466
"recreate them after you have ", 03243467
"=" 03243468
TEMP.8 = "= completed running job DSNTIJTC. ",03243469
" ", 03243470
"=" 03243471
TEMP.9 = COPIES('=',72) 03243472
03243473
TEMP.10 = "CREATOR.NAME" 03243474
TEMP.11 = COPIES('-',257) 03243475
03243476
'EXECIO' 11 'DISKW REPORT16 (STEM TEMP.' 03243477
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03243478
, 'EXECIO DISKW REPORT16 rc=' rc 03243479
03243480
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03243481
address DSNREXX EXECSQL SQLSTMT 03243482
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03243483
03243484
SQLSTMT =, 03243485
"SELECT STRIP(DCREATOR) || '.' || STRIP(DNAME)", 03243486
"FROM SYSIBM.SYSVIEWDEP,", 03243487
"( SELECT CREATOR, NAME", 03243488
"FROM SYSIBM.SYSTABLES", 03243489
"WHERE NUM_DEP_MQTS > 0", 03243490
"AND NAME IN( 'SYSROUTINES', 'USERNAMES' )", 03243491
") AS STB", 03243492
"WHERE BNAME = STB.NAME" 03243493
03243494
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03243495
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03243496
03243497
address DSNREXX "EXECSQL OPEN C1" 03243498
if sqlcode<>0 then call errsqlca "OPEN C1" 03243499
03243500
address DSNREXX "EXECSQL FETCH C1 INTO :HV1" 03243501
DO WHILE SQLCODE = 0 03243502
TEMP.1 = HV1 03243503
'EXECIO' 1 'DISKW REPORT16 (STEM TEMP.' 03243504
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03243505
, 'EXECIO DISKW REPORT16 rc=' rc 03243506
address DSNREXX "EXECSQL FETCH C1 INTO :HV1" 03243507
END 03243508
03243509
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03243510
03243511
drop TEMP. HV1 03243512
'EXECIO 0 DISKW REPORT16 (FINIS' 03243513
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03243514
, 'EXECIO DISKW REPORT16 CLOSE rc=' rc 03243515
03243516
address DSNREXX "EXECSQL CLOSE C1" 03243517
if sqlcode<>0 then call errsqlca "CLOSE C1" 03243518
03243520
CALL IntMsg, 03243522
' Report 16 completed' 03243524
03243526
RETURN /* end generateReport16 */ 03243528
03243530
03243532
generateReport17: PROCEDURE 03243534
/*****************************************************************/ 03243536
/* Generates premigration report 17 */ 03243538
/* Report MQTs on the DB2 catalog that are affected by CATENFM */ 03243540
/*****************************************************************/ 03243542
"EXECIO 0 DISKW REPORT17 (OPEN" 03243544
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03243546
, 'EXECIO DISKW REPORT17 OPEN rc=' rc 03243548
03243550
TEMP.1 = "=== REPORT 17" COPIES('=',58) 03243553
TEMP.2 = "= MQTs on the DB2 catalog that are affected by DSNTIJEN",03243554
" ", 03243556
"=" 03243558
TEMP.3 = COPIES('=',72) 03243560
TEMP.4 = "= Following is a list of Materialized Query Tables", 03243562
"(MQTs) on the DB2 ", 03243564
"=" 03243566
TEMP.5 = "= catalog or on views that base on the DB2 catalog. ", 03243568
"You need to drop ", 03243570
"=" 03243572
TEMP.6 = "= these MQTs before starting migration to DB2 V10 ENFM,",03243574
"otherwise ", 03243576
"=" 03243578
TEMP.7 = "= CATENFM processing will fail. ", 03243581
"You can recreate them after you have ", 03243582
"=" 03243584
TEMP.8 = "= completed running job DSNTIJEN. ",03243587
" ", 03243588
"=" 03243590
TEMP.9 = COPIES('=',72) 03243592
03243594
TEMP.10 = "CREATOR.NAME" 03243596
TEMP.11 = COPIES('-',257) 03243598
03243600
'EXECIO' 11 'DISKW REPORT17 (STEM TEMP.' 03243602
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03243604
, 'EXECIO DISKW REPORT17 rc=' rc 03243606
03243608
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03243610
address DSNREXX EXECSQL SQLSTMT 03243612
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03243614
03243616
SQLSTMT =, 03243618
"SELECT STRIP(DCREATOR) || '.' || STRIP(DNAME)", 03243620
"FROM SYSIBM.SYSVIEWDEP,", 03243622
"( SELECT CREATOR, NAME", 03243624
"FROM SYSIBM.SYSTABLES", 03243626
"WHERE NUM_DEP_MQTS > 0", 03243628
"AND NAME IN( 'SYSPACKSTMT', 'SYSTABLESPACE'", 03243631
", 'SYSTABLEPART', 'SYSSTMT'", 03243632
")", 03243633
") AS STB", 03243634
"WHERE BNAME = STB.NAME" 03243635
03243636
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03243638
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03243640
03243642
address DSNREXX "EXECSQL OPEN C1" 03243644
if sqlcode<>0 then call errsqlca "OPEN C1" 03243646
03243648
address DSNREXX "EXECSQL FETCH C1 INTO :HV1" 03243650
DO WHILE SQLCODE = 0 03243652
TEMP.1 = HV1 03243654
'EXECIO' 1 'DISKW REPORT17 (STEM TEMP.' 03243656
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03243658
, 'EXECIO DISKW REPORT17 rc=' rc 03243660
address DSNREXX "EXECSQL FETCH C1 INTO :HV1" 03243662
END 03243664
03243666
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03243668
03243670
drop TEMP. HV1 03243672
'EXECIO 0 DISKW REPORT17 (FINIS' 03243674
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03243676
, 'EXECIO DISKW REPORT17 CLOSE rc=' rc 03243678
03243680
address DSNREXX "EXECSQL CLOSE C1" 03243682
if sqlcode<>0 then call errsqlca "CLOSE C1" 03243684
03243686
CALL IntMsg, 03243688
' Report 17 completed' 03243690
03243692
RETURN /* end generateReport17 */ 03243694
03243696
03243698
generateReport18: PROCEDURE 03243700
/*****************************************************************/ 03243701
/* Generates premigration report 18 */ 03243702
/* Report plans that were bound with the DBPROTOCOL(PRIVATE) */ 03243703
/* option but that only access local objects and have no */ 03243705
/* support for dynamic SQL. */ 03243707
/*****************************************************************/ 03243708
"EXECIO 0 DISKW REPORT18 (OPEN" 03243709
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03243710
, 'EXECIO DISKW REPORT18 OPEN rc=' rc 03243711
03243712
TEMP.1 = "=== REPORT 18" COPIES('=',58) 03243714
TEMP.2 = "==== The following report is relevant", 03243715
"for any DB2 subsystems that =====" 03243716
TEMP.3 = "==== currently have Private", 03243717
"Protocol processing =====" 03243718
TEMP.4 = COPIES('=',72) 03243719
TEMP.5 = "= Following is a list of plans that", 03243720
"were bound with the =" 03243721
TEMP.6 = "= DBPROTOCOL(PRIVATE) bind option but", 03243722
"they only access local objects =" 03243723
TEMP.7 = "= and have no support for dynamic SQL. ", 03243724
" =" 03243725
TEMP.8 = COPIES('=',72) 03243727
03243730
TEMP.9 = "NAME CREATOR" 03243733
TEMP.10 = "---------- ----------" 03243734
03243736
'EXECIO' 10 'DISKW REPORT18 (STEM TEMP.' 03243739
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03243740
, 'EXECIO DISKW REPORT18 rc=' rc 03243742
03243744
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03243746
address DSNREXX EXECSQL SQLSTMT 03243748
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03243750
03243752
SQLSTMT =, 03243754
"SELECT CHAR( '""' || RTRIM(SUBSTR(NAME, 1, 8)) || '""' )", 03243756
",CHAR( '""' || RTRIM(SUBSTR(CREATOR, 1, 8)) || '""' )", 03243758
"FROM SYSIBM.SYSPLAN", 03243760
"WHERE NAME NOT IN", 03243762
"(SELECT PLNAME", 03243764
"FROM SYSIBM.SYSSTMT", 03243766
"WHERE STATUS IN ('A','B','I','J'))", 03243768
"AND DBPROTOCOL='P'" 03243770
03243772
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03243774
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03243776
03243778
address DSNREXX "EXECSQL OPEN C1" 03243780
if sqlcode<>0 then call errsqlca "OPEN C1" 03243782
03243784
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2" 03243786
DO WHILE SQLCODE = 0 03243788
TEMP.1 = HV1 HV2 03243790
'EXECIO' 1 'DISKW REPORT18 (STEM TEMP.' 03243792
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03243794
, 'EXECIO DISKW REPORT18 rc=' rc 03243796
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2" 03243798
END 03243800
03243802
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03243804
03243806
drop TEMP. HV1 03243808
'EXECIO 0 DISKW REPORT18 (FINIS' 03243810
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03243812
, 'EXECIO DISKW REPORT18 CLOSE rc=' rc 03243814
03243816
address DSNREXX "EXECSQL CLOSE C1" 03243818
if sqlcode<>0 then call errsqlca "CLOSE C1" 03243820
03243822
CALL IntMsg, 03243824
' Report 18 completed' 03243826
03243828
RETURN /* end generateReport18 */ 03243830
03243832
03243834
generateReport19: PROCEDURE 03243836
/*****************************************************************/ 03243838
/* Generates premigration report 19 */ 03243840
/* Report plans that were bound with the DBPROTOCOL(PRIVATE) */ 03243842
/* option that can be converted to DRDA via rebind commands. */ 03243844
/*****************************************************************/ 03243846
"EXECIO 0 DISKW REPORT19 (OPEN" 03243848
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03243850
, 'EXECIO DISKW REPORT19 OPEN rc=' rc 03243852
03243854
TEMP.1 = "=== REPORT 19" COPIES('=',58) 03243857
TEMP.2 = "==== The following report is relevant", 03243858
"for any DB2 subsystems that ====" 03243860
TEMP.3 = "==== currently have Private", 03243862
"Protocol processing ====" 03243864
TEMP.4 = COPIES('=',72) 03243866
TEMP.5 = "= Following is a list of plans that were", 03243868
"bound with the =" 03243870
TEMP.6 = "= DBPROTOCOL(PRIVATE) bind option. They", 03243872
"can only be converted to =" 03243874
TEMP.7 = "= DRDA protocol by rebind commands. To", 03243876
"determine the rebind commands =" 03243878
TEMP.8 = "= that you need to run, run the DSNTIJPD", 03243880
"job. DSNTIJPD analyzes the =" 03243882
TEMP.9 = "= catalog and generates rebind commands", 03243884
"that you can tailor for your =" 03243886
TEMP.10 = "= installation. ", 03243888
" =" 03243890
TEMP.11 = "= The job and program can be setup to", 03243892
"analyze the commands needed to =" 03243894
TEMP.12 = "= convert both plans and packages in one", 03243896
"execution. =" 03243898
TEMP.13 = COPIES('=',72) 03243900
TEMP.14 = "NAME CREATOR" 03243902
TEMP.15 = "---------- ----------" 03243904
03243906
'EXECIO' 15 'DISKW REPORT19 (STEM TEMP.' 03243908
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03243910
, 'EXECIO DISKW REPORT19 rc=' rc 03243912
03243914
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03243916
address DSNREXX EXECSQL SQLSTMT 03243918
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03243920
03243922
SQLSTMT =, 03243924
"SELECT CHAR( '""' || RTRIM(SUBSTR(NAME, 1, 8)) || '""' )", 03243926
",CHAR( '""' || RTRIM(SUBSTR(CREATOR, 1, 8)) || '""' )", 03243928
"FROM SYSIBM.SYSPLAN", 03243930
"WHERE NAME IN", 03243932
"(SELECT PLNAME", 03243934
"FROM SYSIBM.SYSSTMT", 03243936
"WHERE STATUS IN ('A','B','I','J'))", 03243938
"AND DBPROTOCOL='P'" 03243940
03243942
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03243944
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03243946
03243948
address DSNREXX "EXECSQL OPEN C1" 03243950
if sqlcode<>0 then call errsqlca "OPEN C1" 03243952
03243954
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2" 03243956
DO WHILE SQLCODE = 0 03243958
TEMP.1 = HV1 HV2 03243960
'EXECIO' 1 'DISKW REPORT19 (STEM TEMP.' 03243962
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03243964
, 'EXECIO DISKW REPORT19 rc=' rc 03243966
address DSNREXX "EXECSQL FETCH C1 INTO :HV1, :HV2" 03243968
END 03243970
03243972
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03243974
03243976
drop TEMP. HV1 03243978
'EXECIO 0 DISKW REPORT19 (FINIS' 03243980
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03243982
, 'EXECIO DISKW REPORT19 CLOSE rc=' rc 03243984
03243986
address DSNREXX "EXECSQL CLOSE C1" 03243988
if sqlcode<>0 then call errsqlca "CLOSE C1" 03243990
03243992
CALL IntMsg, 03243994
' Report 19 completed' 03243996
03243998
RETURN /* end generateReport19 */ 03244000
03244002
03244004
generateReport20: PROCEDURE 03244006
/*****************************************************************/ 03244008
/* Generates premigration report 20 */ 03244010
/* Report pkgs that were bound with the DBPROTOCOL(PRIVATE) */ 03244012
/* option but that only access local objects and have no */ 03244015
/* support for dynamic SQL. */ 03244017
/*****************************************************************/ 03244018
"EXECIO 0 DISKW REPORT20 (OPEN" 03244019
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03244020
, 'EXECIO DISKW REPORT20 OPEN rc=' rc 03244022
03244024
TEMP.1 = "=== REPORT 20" COPIES('=',58) 03244027
TEMP.2 = "==== The following report is relevant", 03244028
"for any DB2 subsystems that ====" 03244030
TEMP.3 = "==== currently have Private", 03244032
"Protocol processing ====" 03244034
TEMP.4 = COPIES('=',72) 03244036
TEMP.5 = "= Following is a list of packages that", 03244038
"were bound with the =" 03244042
TEMP.6 = "= DBPROTOCOL(PRIVATE) bind option but", 03244044
"they only access local objects, =" 03244046
TEMP.7 = "= have no support for dynamic SQL, and", 03244048
"were not bound by remote DRDA =" 03244050
TEMP.8 = "= requesters. ", 03244052
" =" 03244055
TEMP.9 = COPIES('=',72) 03244062
TEMP.10 = "COLLID NAME CREATOR ", 03244066
"VERSION " 03244070
TEMP.11 = "-------------------- ---------- ----------", 03244073
"-----------------------------" 03244074
03244076
'EXECIO' 11 'DISKW REPORT20 (STEM TEMP.' 03244079
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03244080
, 'EXECIO DISKW REPORT20 rc=' rc 03244082
03244084
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03244086
address DSNREXX EXECSQL SQLSTMT 03244088
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03244090
03244092
SQLSTMT =, 03244094
"SELECT CHAR( '""' || RTRIM(SUBSTR(PK.COLLID, 1, 18)) || '""' )", 03244097
",CHAR( '""' || RTRIM(SUBSTR(PK.NAME, 1, 8)) || '""' )", 03244098
",CHAR( '""' || RTRIM(SUBSTR(PK.CREATOR, 1, 8)) || '""' )", 03244099
",SUBSTR(PK.VERSION", 03244100
" || ' '", 03244104
" || ' '", 03244106
", 1, 122)", 03244108
"FROM SYSIBM.SYSPACKAGE PK", 03244110
"WHERE PK.LOCATION=' '", 03244113
"AND PK.DBPROTOCOL='P'", 03244114
"AND PK.REMOTE IN ('C','D','N')", 03244115
"AND (PK.COLLID, PK.NAME, PK.CONTOKEN) NOT IN", 03244116
"(SELECT DISTINCT PS.COLLID, PS.NAME, PS.CONTOKEN", 03244118
"FROM SYSIBM.SYSPACKSTMT PS", 03244120
"WHERE PS.STATUS IN ('A','B','I','J')", 03244126
"AND PS.LOCATION = ' '", 03244127
"AND PS.LOCATION = PK.LOCATION", 03244128
"AND PS.COLLID = PK.COLLID", 03244129
"AND PS.NAME = PK.NAME", 03244130
"AND PS.CONTOKEN = PK.CONTOKEN", 03244131
")" 03244132
03244133
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03244134
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03244136
03244138
address DSNREXX "EXECSQL OPEN C1" 03244140
if sqlcode<>0 then call errsqlca "OPEN C1" 03244142
03244144
address DSNREXX "EXECSQL FETCH C1", 03244146
"INTO :HV1, :HV2, :HV3, :HV4" 03244148
DO WHILE SQLCODE = 0 03244150
TEMP.1 = HV1 HV2 HV3 HV4 03244152
'EXECIO' 1 'DISKW REPORT20 (STEM TEMP.' 03244154
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03244156
, 'EXECIO DISKW REPORT20 rc=' rc 03244158
address DSNREXX "EXECSQL FETCH C1", 03244160
"INTO :HV1, :HV2, :HV3, :HV4" 03244162
END 03244164
03244166
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03244168
03244170
drop TEMP. HV1 03244172
'EXECIO 0 DISKW REPORT20 (FINIS' 03244174
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03244176
, 'EXECIO DISKW REPORT20 CLOSE rc=' rc 03244178
03244180
address DSNREXX "EXECSQL CLOSE C1" 03244182
if sqlcode<>0 then call errsqlca "CLOSE C1" 03244184
03244186
CALL IntMsg, 03244188
' Report 20 completed' 03244190
03244192
RETURN /* end generateReport20 */ 03244194
03244196
03244198
generateReport21: PROCEDURE 03244200
/*****************************************************************/ 03244202
/* Generates premigration report 21 */ 03244204
/* Report pkgs that were bound with the DBPROTOCOL(PRIVATE) */ 03244206
/* option that can be converted to DRDA via DSNTIJPD. */ 03244208
/*****************************************************************/ 03244210
"EXECIO 0 DISKW REPORT21 (OPEN" 03244212
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03244214
, 'EXECIO DISKW REPORT21 OPEN rc=' rc 03244216
03244218
TEMP.1 = "=== REPORT 21" COPIES('=',58) 03244221
TEMP.2 = "==== The following report is relevant", 03244222
"for any DB2 subsystems that ====" 03244224
TEMP.3 = "==== currently have Private", 03244226
"Protocol processing ====" 03244228
TEMP.4 = COPIES('=',72) 03244230
TEMP.5 = "= Following is a list of packages that", 03244232
"were bound with the =" 03244234
TEMP.6 = "= DBPROTOCOL(PRIVATE) bind option. They", 03244236
"can only be converted to =" 03244238
TEMP.7 = "= DRDA Protocol by rebind commands. To", 03244240
"determine the rebind commands =" 03244242
TEMP.8 = "= that you need to run, run the DSNTIJPD", 03244244
"job. DSNTIJPD analyzes the =" 03244246
TEMP.9 = "= catalog and generates rebind commands", 03244248
"that you can tailor for your =" 03244250
TEMP.10 = "= installation. ", 03244252
" =" 03244254
TEMP.11 = "= The job and program can be setup to analyze", 03244256
"the commands needed to =" 03244258
TEMP.12 = "= convert both plans and packages in one", 03244260
"execution. =" 03244262
TEMP.13 = COPIES('=',72) 03244264
TEMP.14 = "COLLID NAME CREATOR ", 03244266
"VERSION " 03244268
TEMP.15 = "-------------------- ---------- ----------", 03244270
"-----------------------------" 03244272
03244274
'EXECIO' 15 'DISKW REPORT21 (STEM TEMP.' 03244276
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03244278
, 'EXECIO DISKW REPORT21 rc=' rc 03244280
03244282
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03244284
address DSNREXX EXECSQL SQLSTMT 03244286
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03244288
03244290
SQLSTMT =, 03244292
"SELECT CHAR( '""' || RTRIM(SUBSTR(PK.COLLID, 1, 18)) || '""' )", 03244295
",CHAR( '""' || RTRIM(SUBSTR(PK.NAME, 1, 8)) || '""' )", 03244296
",CHAR( '""' || RTRIM(SUBSTR(PK.CREATOR, 1, 8)) || '""' )", 03244297
",SUBSTR(PK.VERSION", 03244298
"|| ' '", 03244302
"|| ' '", 03244304
", 1, 122)", 03244306
"FROM SYSIBM.SYSPACKAGE PK", 03244308
"WHERE PK.LOCATION=' '", 03244311
"AND PK.DBPROTOCOL='P'", 03244312
"AND (PK.REMOTE NOT IN ('C','D','N')", 03244313
"OR (PK.COLLID, PK.NAME, PK.CONTOKEN) IN", 03244314
"(SELECT DISTINCT PS.COLLID, PS.NAME, PS.CONTOKEN", 03244316
"FROM SYSIBM.SYSPACKSTMT PS", 03244318
"WHERE PS.STATUS IN ('A','B','I','J')", 03244323
"AND PS.LOCATION = ' '", 03244324
"AND PS.LOCATION = PK.LOCATION", 03244325
"AND PS.COLLID = PK.COLLID", 03244326
"AND PS.NAME = PK.NAME", 03244327
"AND PS.CONTOKEN = PK.CONTOKEN", 03244328
")", 03244329
")" 03244330
03244331
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03244332
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03244334
03244336
address DSNREXX "EXECSQL OPEN C1" 03244338
if sqlcode<>0 then call errsqlca "OPEN C1" 03244340
03244342
address DSNREXX "EXECSQL FETCH C1", 03244344
"INTO :HV1, :HV2, :HV3, :HV4" 03244346
DO WHILE SQLCODE = 0 03244348
TEMP.1 = HV1 HV2 HV3 HV4 03244350
'EXECIO' 1 'DISKW REPORT21 (STEM TEMP.' 03244352
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03244354
, 'EXECIO DISKW REPORT21 rc=' rc 03244356
address DSNREXX "EXECSQL FETCH C1", 03244358
"INTO :HV1, :HV2, :HV3, :HV4" 03244360
END 03244362
03244364
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03244366
03244368
drop TEMP. HV1 HV2 HV3 HV4 03244370
'EXECIO 0 DISKW REPORT21 (FINIS' 03244372
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03244374
, 'EXECIO DISKW REPORT21 CLOSE rc=' rc 03244376
03244378
address DSNREXX "EXECSQL CLOSE C1" 03244380
if sqlcode<>0 then call errsqlca "CLOSE C1" 03244382
03244384
CALL IntMsg, 03244386
' Report 21 completed' 03244388
03244390
RETURN /* end generateReport21 */ 03244392
03244394
03244396
generateReport22: PROCEDURE 03244398
/*****************************************************************/ 03244404
/* Generates premigration report 22 */ 03244410
/* Report authorization IDs and roles that use EBCDIC-encoded */ 03244416
/* routines for DBMD. */ 03244422
/*****************************************************************/ 03244428
"EXECIO 0 DISKW REPORT22 (OPEN" 03244434
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03244440
, 'EXECIO DISKW REPORT22 OPEN rc=' rc 03244446
03244452
TEMP.1 = "=== REPORT 22" COPIES('=',58) 03244461
TEMP.2 = "= Following is a list of authorization IDs", 03244464
"and roles with EXECUTE or =" 03244470
TEMP.3 = "= EXECUTE WITH GRANT privilege on one or more", 03244477
"DB2 MetaData stored =" 03244484
TEMP.4 = "= procedures. These stored procedures will be", 03244491
"dropped and recreated =" 03244498
TEMP.5 = "= during migration to DB2 V10 Conversion Mode,", 03244505
"when you run job =" 03244512
TEMP.6 = "= DSNTIJRT. After you run DSNTIJRT, you need", 03244519
"to grant the indicated =" 03244526
TEMP.7 = "= privilege to each authorization ID or role", 03244533
"listed. If the list has =" 03244540
TEMP.8 = "= no entries, then either the DB2 MetaData", 03244547
"stored procedures are =" 03244554
TEMP.9 = "= undefined or they have already been dropped", 03244561
"and recreated in V10. =" 03244568
TEMP.10 = COPIES('=',72) 03244575
TEMP.11 = "SCHEMA.NAME EXECUTE", 03244582
"PRIVILEGES GRANTEE (SHORT) GRANTEE(LONG)" 03244589
TEMP.12 = COPIES('-',25) COPIES('-',18) COPIES('-',18), 03244596
COPIES('-',128) 03244603
03244610
'EXECIO' 12 'DISKW REPORT22 (STEM TEMP.' 03244617
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03244624
, 'EXECIO DISKW REPORT22 rc=' rc 03244631
03244638
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03244645
address DSNREXX EXECSQL SQLSTMT 03244652
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03244659
03244666
SQLSTMT =, 03244673
"SELECT CHAR( RTRIM(SUBSTR(RA.SCHEMA, 1, 6))", 03244680
"||'.'||", 03244687
"RTRIM(SUBSTR(RA.SPECIFICNAME, 1, 18))", 03244694
") AS", 03244701
"ROUTINE_NAME", 03244708
", CASE WHEN RA.EXECUTEAUTH = 'Y' THEN 'EXECUTE ONLY'", 03244715
"ELSE 'EXECUTE W/ GRANT' END AS", 03244722
"EXECPRIVILEGES", 03244729
", GRANTEE", 03244736
"FROM SYSIBM.SYSROUTINEAUTH RA", 03244743
", SYSIBM.SYSROUTINES RT", 03244750
"WHERE RT.SCHEMA = RA.SCHEMA", 03244757
"AND RT.SPECIFICNAME = RA.SPECIFICNAME", 03244764
"AND RT.SCHEMA = 'SYSIBM'", 03244771
"AND RT.SPECIFICNAME IN", 03244778
"( 'SQLCOLUMNS', 'SQLCOLPRIVILEGES', 'SQLFOREIGNKEYS'", 03244785
", 'SQLFUNCTIONCOLS', 'SQLFUNCTIONS', 'SQLPRIMARYKEYS'", 03244792
", 'SQLPROCEDURECOLS', 'SQLPROCEDURES'", 03244799
", 'SQLSPECIALCOLUMNS'", 03244806
", 'SQLSTATISTICS', 'SQLTABLEPRIVILEGES', 'SQLTABLES'", 03244813
", 'SQLGETTYPEINFO', 'SQLUDTS'", 03244820
")", 03244827
"AND RT.PARAMETER_CCSID <> 1208", 03244834
"ORDER BY RA.SPECIFICNAME" 03244841
03244848
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03244855
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03244862
03244869
address DSNREXX "EXECSQL OPEN C1" 03244876
if sqlcode<>0 then call errsqlca "OPEN C1" 03244883
03244890
address DSNREXX "EXECSQL FETCH C1", 03244897
"INTO :HV1, :HV2, :HV3" 03244904
DO WHILE SQLCODE = 0 03244911
TEMP.1 = HV1 HV2 SUBSTR(HV3,1,18) HV3 03244918
'EXECIO' 1 'DISKW REPORT22 (STEM TEMP.' 03244925
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03244932
, 'EXECIO DISKW REPORT22 rc=' rc 03244939
address DSNREXX "EXECSQL FETCH C1", 03244946
"INTO :HV1, :HV2, :HV3" 03244953
END 03244960
03244967
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03244974
03244981
drop TEMP. HV1 HV2 HV3 03244988
'EXECIO 0 DISKW REPORT22 (FINIS' 03244995
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03245002
, 'EXECIO DISKW REPORT22 CLOSE rc=' rc 03245009
03245016
address DSNREXX "EXECSQL CLOSE C1" 03245023
if sqlcode<>0 then call errsqlca "CLOSE C1" 03245030
03245037
CALL IntMsg, 03245044
' Report 22 completed' 03245051
03245058
RETURN /* end generateReport22 */ 03245065
03245072
03245079
generateReport23: PROCEDURE 03245086
/*****************************************************************/ 03245094
/* Generates premigration report 23 */ 03245102
/* Report obsolete DB2 -supplied objects */ 03245110
/*****************************************************************/ 03245118
"EXECIO 0 DISKW REPORT23 (OPEN" 03245126
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03245134
, 'EXECIO DISKW REPORT23 OPEN rc=' rc 03245142
03245150
TEMP.1 = "=== REPORT 23" COPIES('=',58) 03245162
TEMP.2 = "= These obsolete objects can be dropped in DB2 V10", 03245166
"new-function mode =" 03245174
TEMP.3 = COPIES('=',72) 03245182
TEMP.4 = "= The following DB2 -supplied objects are not used in", 03245190
"DB2 V10 and can =" 03245198
TEMP.5 = "= be dropped in new-function mode. To avoid problems", 03245206
"during fallback =" 03245214
TEMP.6 = "= and data sharing coexistence, do not drop these", 03245222
"objects when DB2 V10 =" 03245230
TEMP.7 = "= is in conversion mode. ", 03245238
" =" 03245246
TEMP.8 = COPIES('=',72) 03245254
TEMP.9 = "OBJECT TYPE SCHEMA OR CREATOR NAME OBJECT NAME" 03245262
TEMP.10 = COPIES('-',11) COPIES('-',23) COPIES('-',36) 03245270
03245278
'EXECIO' 10 'DISKW REPORT23 (STEM TEMP.' 03245286
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03245294
, 'EXECIO DISKW REPORT23 rc=' rc 03245302
03245310
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03245318
address DSNREXX EXECSQL SQLSTMT 03245326
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03245334
03245342
SQLSTMT =, 03245350
"SELECT 'TABLE '", 03245358
", CHAR( RTRIM(SUBSTR(CREATOR, 1, 23)))", 03245366
", CHAR( RTRIM(SUBSTR(NAME, 1, 36)))", 03245374
"FROM SYSIBM.SYSTABLES", 03245382
"WHERE NAME IN('DSN_STATEMENT_RUNTIME_INFO'", 03245390
",'DSN_OBJECT_RUNTIME_INFO'", 03245398
")", 03245406
"UNION", 03245414
"SELECT 'PROCEDURE '", 03245422
", CHAR( RTRIM(SUBSTR(SCHEMA, 1, 23)))", 03245430
", CHAR( RTRIM(SUBSTR(NAME, 1, 36)))", 03245438
"FROM SYSIBM.SYSROUTINES", 03245446
"WHERE (SCHEMA = 'DSN8' AND NAME = 'DSN8EXP')", 03245454
"OR (SCHEMA = 'SYSPROC' AND NAME = 'OSC_EXECUTE_TASK')", 03245462
"OR (SCHEMA = 'SYSPROC' AND NAME = 'OSC_RUNSQL')" 03245470
03245478
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03245486
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03245494
03245502
address DSNREXX "EXECSQL OPEN C1" 03245510
if sqlcode<>0 then call errsqlca "OPEN C1" 03245518
03245526
address DSNREXX "EXECSQL FETCH C1", 03245534
"INTO :HV1, :HV2, :HV3" 03245542
DO WHILE SQLCODE = 0 03245550
TEMP.1 = HV1 HV2 HV3 03245558
'EXECIO' 1 'DISKW REPORT23 (STEM TEMP.' 03245566
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03245575
, 'EXECIO DISKW REPORT23 rc=' rc 03245584
address DSNREXX "EXECSQL FETCH C1", 03245593
"INTO :HV1, :HV2, :HV3" 03245602
END 03245611
03245620
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03245629
03245638
drop TEMP. HV1 HV2 HV3 03245647
'EXECIO 0 DISKW REPORT23 (FINIS' 03245656
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03245665
, 'EXECIO DISKW REPORT23 CLOSE rc=' rc 03245674
03245683
address DSNREXX "EXECSQL CLOSE C1" 03245692
if sqlcode<>0 then call errsqlca "CLOSE C1" 03245701
03245710
CALL IntMsg, 03245719
' Report 23 completed' 03245728
03245737
RETURN /* end generateReport23 */ 03245746
03245755
03245764
generateReport24: PROCEDURE 03245781
/*****************************************************************/ 03245789
/* Generates premigration report 24 */ 03245797
/* Report packages that use UDF SYSFUN.DSN_XMLVALIDATE */ 03245805
/*****************************************************************/ 03245813
"EXECIO 0 DISKW REPORT24 (OPEN" 03245821
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03245829
, 'EXECIO DISKW REPORT24 OPEN rc=' rc 03245837
03245845
TEMP.1 = "=== REPORT 24" COPIES('=',58) 03245857
TEMP.2 = "= Following is a list of packages that", 03245861
"use SYSFUN.DSN_XMLVALIDATE, a =" 03245869
TEMP.3 = "= DB2 -supplied user-defined function for", 03245877
"XML schema validation. This =" 03245885
TEMP.4 = "= UDF has been replaced by a DB2 built-in", 03245899
"function of the same name, =" 03245905
TEMP.5 = "= and is deprecated. The programs for packages", 03245911
"listed below need to =" 03245917
TEMP.6 = "= be modified to use the built-in function", 03245923
"instead. See the topic =" 03245929
TEMP.7 = "= 'Moving from SYSFUN.DSN_XMLVALIDATE to", 03245941
"SYSIBM.DSN_XMLVALIDATE' in =" 03245949
TEMP.8 = "= the DB2 for z/OS XML Guide for further", 03245957
"guidance on required changes. =" 03245965
TEMP.9 = COPIES('=',72) 03245973
TEMP.10 = "COLLECTION-ID.PACKAGE-NAME" 03245981
TEMP.11 = COPIES('-',257) 03245989
03245997
'EXECIO' 11 'DISKW REPORT24 (STEM TEMP.' 03246005
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03246013
, 'EXECIO DISKW REPORT24 rc=' rc 03246021
03246029
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03246037
address DSNREXX EXECSQL SQLSTMT 03246045
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03246053
03246061
SQLSTMT =, 03246069
"SELECT DISTINCT STRIP(DCOLLID) || '.' || STRIP(DNAME)", 03246077
"FROM SYSIBM.SYSPACKDEP", 03246085
"WHERE BTYPE='F'", 03246093
"AND BNAME LIKE 'DSN_XMLVALIDATE%'", 03246101
"AND BQUALIFIER='SYSFUN'", 03246109
"ORDER BY 1" 03246117
03246125
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03246133
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03246141
03246149
address DSNREXX "EXECSQL OPEN C1" 03246157
if sqlcode<>0 then call errsqlca "OPEN C1" 03246165
03246173
address DSNREXX "EXECSQL FETCH C1", 03246181
"INTO :HV1" 03246189
DO WHILE SQLCODE = 0 03246197
TEMP.1 = HV1 03246205
'EXECIO' 1 'DISKW REPORT24 (STEM TEMP.' 03246213
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03246221
, 'EXECIO DISKW REPORT24 rc=' rc 03246229
address DSNREXX "EXECSQL FETCH C1", 03246237
"INTO :HV1" 03246245
END 03246253
03246261
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03246269
03246277
drop TEMP. HV1 03246285
'EXECIO 0 DISKW REPORT24 (FINIS' 03246293
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03246301
, 'EXECIO DISKW REPORT24 CLOSE rc=' rc 03246309
03246317
address DSNREXX "EXECSQL CLOSE C1" 03246325
if sqlcode<>0 then call errsqlca "CLOSE C1" 03246333
03246341
CALL IntMsg, 03246349
' Report 24 completed' 03246357
03246365
RETURN /* end generateReport24 */ 03246373
03246381
03246389
generateReport25: PROCEDURE 03246400
/******************************************************************/03246403
/* Generate pre-migration report 25: */03246406
/* Reports the existence of inconsistent UTF-8 encoding */03246409
/* of the collection IDs and the package names that were */03246412
/* bound by a remote client system. */03246415
/******************************************************************/03246418
"EXECIO 0 DISKW REPORT25 (OPEN" 03246421
If rc<>0 Then Call Dsn_Error 'Write_source_dsn', 03246424
,'EXECIO DISKW REPORT25 OPEN rc=' rc 03246427
03246430
/* Print report header */03246433
TEMP.1 = "=== REPORT 25" COPIES('=',58) 03246437
TEMP.2 =, 03246439
"= The following collection IDs and package names", 03246442
"were bound by a =" 03246445
TEMP.3 =, 03246448
"= remote client system. After migrating to DB2", 03246451
"V10, when a remote =" 03246454
TEMP.4 =, 03246457
"= client system upgrades to a version that", 03246460
"supports the flow of =" 03246463
TEMP.5 =, 03246466
"= Unicode (UTF-8) DRDA character type data, these", 03246469
"collection IDs and =" 03246472
TEMP.6 =, 03246475
"= package names will not be found by DB2 V10.", 03246478
"Therefore, the remote =" 03246481
TEMP.7 =, 03246484
"= client system needs to bind these collection IDs", 03246489
"and package names =" 03246491
TEMP.8 =, 03246493
"= after it upgrades to a version that supports the", 03246498
"flow of Unicode =" 03246500
TEMP.9 =, 03246502
"= (UTF-8) DRDA character type data to a DB2 V10", 03246507
"system. =" 03246509
TEMP.10 = COPIES('=',72) 03246511
TEMP.11 = "COLLID NAME PDSNAME" 03246516
TEMP.12 = "-------------------- ---------- --------------------" 03246518
'EXECIO' 12 'DISKW REPORT25 (STEM TEMP.' 03246520
If rc<>0 Then 03246523
Call Dsn_Error 'Write_source_dsn', 03246526
,'EXECIO DISKW REPORT25 rc=' rc 03246529
03246532
/* Get DSNHDECP SYSTEM_EBCDIC_CCSID values */03246592
Address DSNREXX "EXECSQL DECLARE C1 CURSOR FOR S1" 03246595
If sqlcode<>0 Then Call errsqla "DECLARE C1 CURSOR FOR S1" 03246598
03246601
sqlstmt="SELECT GETVARIABLE('SYSIBM.SYSTEM_EBCDIC_CCSID') FROM", 03246604
"SYSIBM.SYSDUMMY1" 03246607
03246610
Address DSNREXX "EXECSQL PREPARE S1 FROM :sqlstmt" 03246613
If sqlcode<>0 Then Call errsqlca "PREPARE S1 FROM :sqlstmt" 03246616
03246619
Address DSNREXX "EXECSQL OPEN C1" 03246622
If sqlcode<>0 Then Call errsqlca "OPEN C1" 03246625
03246628
Address DSNREXX "EXECSQL FETCH C1 INTO :system_ebcdic_ccsids" 03246631
If sqlcode<>0 Then 03246634
Call errsqlca "FETCH C1 INTO :system_ebcdic_ccsids" 03246637
03246640
Address DSNREXX "EXECSQL CLOSE C1" 03246643
If sqlcode<>0 Then Call errsqlca "CLOSE C1" 03246646
03246649
Parse Var system_ebcdic_ccsids sccsid "," mccsid "," gccsid 03246652
03246655
Call validateSYSPACKAGE 03246658
03246662
'EXECIO 0 DISKW REPORT25 (FINIS' 03246663
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03246664
, 'EXECIO DISKW REPORT25 CLOSE rc=' rc 03246665
03246666
Call IntMsg, 03246667
' Report 25 completed' 03246668
03246670
SIGNAL REPORT25END 03246673
03246676
/******************************************************************/03246679
/* Internal procedures */03246682
/******************************************************************/03246685
03246688
/* Validate SYSPACKAGE column name */03246691
validateSYSPACKAGE: 03246694
03246697
If mccsid = 65534 Then 03246701
system_ebcdic_ccsid=sccsid 03246703
Else 03246706
system_ebcdic_ccsid=mccsid 03246709
03246712
Address DSNREXX "EXECSQL DECLARE C2 CURSOR FOR S2" 03246715
If sqlcode<>0 Then Call errsqlca "DECLARE C2 CURSOR FOR S2" 03246718
03246721
sqlstmt="SELECT COLLID,COLLID,NAME,NAME,PDSNAME", 03246725
"FROM SYSIBM.SYSPACKAGE", 03246727
"WHERE REMOTE='Y'", 03246730
"FOR READ ONLY" 03246733
03246736
s2SQLDA.='' 03246739
Address DSNREXX "EXECSQL PREPARE S2 INTO :s2SQLDA FROM :sqlstmt" 03246742
If sqlcode<>0 Then 03246745
Call errsqlca "PREPARE S2 INTO :s2SQLDA FROM :sqlstmt" 03246748
03246751
Address DSNREXX "EXECSQL OPEN C2" 03246754
If sqlcode<>0 Then Call errsqlca "OPEN C2" 03246757
03246760
row. = '' 03246763
j = 0 03246766
row.0 = j 03246769
Do Until (sqlcode<>0) 03246772
s2SQLDA.1.SQLUSECCSID=1208 03246775
s2SQLDA.2.SQLUSECCSID=system_ebcdic_ccsid 03246778
s2SQLDA.3.SQLUSECCSID=1208 03246781
s2SQLDA.4.SQLUSECCSID=system_ebcdic_ccsid 03246784
Address DSNREXX "EXECSQL FETCH C2 INTO DESCRIPTOR :s2SQLDA" 03246787
If sqlcode=0 Then 03246790
Do 03246793
If s2SQLDA.1.SQLDATA \== getString(s2SQLDA.2.SQLDATA) |, 03246798
s2SQLDA.3.SQLDATA \== getString(s2SQLDA.4.SQLDATA) Then 03246800
Do 03246802
j = j + 1 03246805
row.j.COLLID_ESBCS = STRIP(s2SQLDA.2.SQLDATA) 03246808
row.j.NAME_ESBCS = STRIP(s2SQLDA.4.SQLDATA) 03246811
row.j.PDSNAME = STRIP(s2SQLDA.5.SQLDATA) 03246812
row.0 = j 03246814
End 03246817
End 03246820
End 03246823
03246826
Address DSNREXX "EXECSQL CLOSE C2" 03246829
If sqlcode<>0 Then Call errsqlca "CLOSE C2" 03246832
03246835
If j > 0 Then 03246838
Do x = 1 To j 03246841
TEMP.1 = LEFT(row.x.COLLID_ESBCS,20), 03246844
LEFT(row.x.NAME_ESBCS,10), 03246848
LEFT(row.x.PDSNAME,20) 03246849
'EXECIO' 1 'DISKW REPORT25 (STEM TEMP.' 03246850
If rc<>0 Then 03246853
Call Dsn_Error 'Write_source_dsn', 03246856
,'EXECIO DISKW REPORT25 rc=' rc 03246859
End 03246862
03246865
getString: 03246868
Parse Arg str 03246873
03246874
pkgSet="DSNREXX_500" 03246877
Address DSNREXX "EXECSQL SET CURRENT PACKAGESET = :pkgset" 03246880
If sqlcode<>0 Then 03246883
Call errsqlca "SET CURRENT PACKAGESET = :pkgset" 03246886
03246889
Address DSNREXX "EXECSQL DECLARE C3 CURSOR FOR S3" 03246892
If sqlcode<>0 Then Call errsqlca "DECLARE C3 CURSOR FOR S3" 03246895
03246898
str_a='' 03246911
03246925
Do i = 1 To Length(str) 03246931
s3SQLDA. = '' 03246934
aChar = SUBSTR(str,i,1) 03246935
If aChar = '''' Then aChar = '''''' 03246936
sqls3="SELECT ASCII('", 03246937
||aChar||, 03246941
"') FROM SYSIBM.SYSDUMMY1" 03246943
Address DSNREXX, 03246946
"EXECSQL PREPARE S3 INTO :s3SQLDA FROM :sqls3" 03246949
If sqlcode<>0 Then 03246952
Call errsqlca "PREPARE S3 INTO :s3SQLDA FROM :sqls3" 03246955
03246958
Address DSNREXX "EXECSQL OPEN C3" 03246963
If sqlcode<>0 Then Call errsqlca "OPEN C3" 03246965
03246967
s3SQLDA.1.SQLUSECCSID=1208 03246973
03246976
Address DSNREXX "EXECSQL FETCH C3 INTO DESCRIPTOR :s3SQLDA" 03246980
Address DSNREXX "EXECSQL CLOSE C3" 03246981
If sqlcode<>0 Then Call errsqlca "CLOSE C3" 03246982
str_a = str_a || D2C(s3SQLDA.1.SQLDATA) 03246984
End 03246985
03246988
pkgSet='' 03246991
Address DSNREXX "EXECSQL SET CURRENT PACKAGESET = :pkgset" 03246994
If sqlcode<>0 Then 03246997
Call errsqlca "SET CURRENT PACKAGESET = :pkgset" 03247000
03247003
RETURN STRIP(str_a) /* end getString */ 03247007
03247009
RETURN /* end validateSYSPACKAGE */ 03247012
03247015
REPORT25END: 03247018
RETURN /* end generateReport25 */ 03247024
03247027
03247029
generateReport26: PROCEDURE 03247031
/*****************************************************************/ 03247032
/* Generates premigration report 26 */ 03247033
/* Report authorization IDs and roles that use the DB2 -supplied*/ 03247034
/* store procedure, DSNLEUSR. */ 03247035
/*****************************************************************/ 03247036
"EXECIO 0 DISKW REPORT26 (OPEN" 03247037
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03247038
, 'EXECIO DISKW REPORT26 OPEN rc=' rc 03247039
03247040
TEMP.1 = "=== REPORT 26" COPIES('=',58) 03247042
TEMP.2 = "= Following is a list of authorization IDs", 03247043
"and roles with EXECUTE or =" 03247044
TEMP.3 = "= EXECUTE WITH GRANT privilege on the DB2 -sup", 03247045
"plied stored procedure =" 03247046
TEMP.4 = "= DSNLEUSR. This stored procedure will be dro", 03247047
"pped and recreated =" 03247048
TEMP.5 = "= during migration to DB2 V10 New-Function mod", 03247049
"e, when you run the job =" 03247050
TEMP.6 = "= DSNTIJRT. After you run DSNTIJRT, you need", 03247051
"to grant the indicated =" 03247052
TEMP.7 = "= privilege to each authorization ID or role", 03247053
"listed. If the list has =" 03247054
TEMP.8 = "= no entries, then either the DB2 -supplied", 03247055
"stored procedure, DSNLEUSR =" 03247056
TEMP.9 = "= is undefined or it has already been dropped", 03247057
"and recreated in V10. =" 03247058
TEMP.10 = COPIES('=',72) 03247059
TEMP.11 = "SCHEMA.NAME EXECUTE", 03247060
"PRIVILEGES GRANTOR GRANTEE " 03247061
TEMP.12 = COPIES('-',25) COPIES('-',18) COPIES('-',18), 03247062
COPIES('-',16) 03247063
03247064
'EXECIO' 12 'DISKW REPORT26 (STEM TEMP.' 03247065
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03247066
, 'EXECIO DISKW REPORT26 rc=' rc 03247067
03247068
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03247069
address DSNREXX EXECSQL SQLSTMT 03247070
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03247071
03247072
SQLSTMT =, 03247073
"SELECT CHAR( RTRIM(SUBSTR(RA.SCHEMA, 1, 7))", 03247074
"||'.'||", 03247075
"RTRIM(SUBSTR(RA.SPECIFICNAME, 1, 17))", 03247076
") AS", 03247077
"ROUTINE_NAME", 03247078
", CASE WHEN RA.EXECUTEAUTH = 'Y' THEN 'EXECUTE ONLY'", 03247079
"ELSE 'EXECUTE W/ GRANT' END AS", 03247080
"EXECPRIVILEGES", 03247081
", RA.GRANTOR", 03247082
", RA.GRANTEE", 03247083
"FROM SYSIBM.SYSROUTINEAUTH RA", 03247084
", SYSIBM.SYSROUTINES RT", 03247085
"WHERE RT.SCHEMA = RA.SCHEMA", 03247086
"AND RT.SPECIFICNAME = RA.SPECIFICNAME", 03247087
"AND RT.SCHEMA = 'SYSPROC'", 03247088
"AND RT.SPECIFICNAME = 'DSNLEUSR'" 03247089
03247090
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03247091
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03247092
03247093
address DSNREXX "EXECSQL OPEN C1" 03247094
if sqlcode<>0 then call errsqlca "OPEN C1" 03247095
03247096
address DSNREXX "EXECSQL FETCH C1", 03247097
"INTO :HV1, :HV2, :HV3, :HV4" 03247098
DO WHILE SQLCODE = 0 03247099
TEMP.1 = HV1 SUBSTR(HV2,1,18) SUBSTR(HV3,1,18) HV4 03247100
'EXECIO' 1 'DISKW REPORT26 (STEM TEMP.' 03247101
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03247102
, 'EXECIO DISKW REPORT26 rc=' rc 03247103
address DSNREXX "EXECSQL FETCH C1", 03247104
"INTO :HV1, :HV2, :HV3, :HV4" 03247105
END 03247106
03247107
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03247108
03247109
drop TEMP. HV1 HV2 HV3 HV4 03247110
'EXECIO 0 DISKW REPORT26 (FINIS' 03247111
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03247112
, 'EXECIO DISKW REPORT26 CLOSE rc=' rc 03247113
03247114
address DSNREXX "EXECSQL CLOSE C1" 03247115
if sqlcode<>0 then call errsqlca "CLOSE C1" 03247116
03247117
CALL IntMsg, 03247118
' Report 26 completed' 03247119
03247120
RETURN /* end generateReport26 */ 03247121
03247122
03247123
generateReport27: PROCEDURE 03247126
/*****************************************************************/ 03247130
/* Generates premigration report 27 */ 03247134
/* Report use of DATACAPTURE disabled during migration to CM8 */ 03247138
/*****************************************************************/ 03247142
"EXECIO 0 DISKW REPORT27 (OPEN" 03247146
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03247150
, 'EXECIO DISKW REPORT27 OPEN rc=' rc 03247154
03247158
TEMP.1 = "=== REPORT 27" COPIES('=',58) 03247164
TEMP.2 = "= The DATA CAPTURE CHANGES option is active", 03247166
"but will be disabled on =" 03247170
TEMP.3 = "= the following DB2 catalog tables when you", 03247174
"run job DSNTIJTC to per- =" 03247178
TEMP.4 = "= form the DB2 catalog tailoring (CATMAINT)", 03247182
"process during migration =" 03247186
TEMP.5 = "= to DB2 V10 conversion mode. After completing", 03247190
"DSNTIJTC, use the =" 03247194
TEMP.6 = "= command ", 03247198
" =" 03247202
TEMP.7 = "= ALTER TABLE SYSIBM.tablename DATA CAPTURE", 03247206
"CHANGES; =" 03247210
TEMP.8 = "= to reenable DATA CAPTURE CHANGES on each", 03247214
"affected table. =" 03247218
TEMP.9 = COPIES('=',72) 03247222
TEMP.10 = "CREATOR.NAME" 03247226
TEMP.11 = COPIES('-',257) 03247230
03247234
'EXECIO' 11 'DISKW REPORT27 (STEM TEMP.' 03247238
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03247242
, 'EXECIO DISKW REPORT27 rc=' rc 03247246
03247250
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03247254
address DSNREXX EXECSQL SQLSTMT 03247258
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03247262
03247266
SQLSTMT =, 03247270
"SELECT STRIP(CREATOR) || '.' || STRIP(NAME)", 03247274
"FROM SYSIBM.SYSTABLES", 03247278
"WHERE SUBSTR(GETVARIABLE('SYSIBM.VERSION'), 1, 5) = 'DSN08'", 03247282
"AND CREATOR = 'SYSIBM'", 03247286
"AND NAME = 'SYSROUTINES'", 03247290
"AND DATACAPTURE = 'Y'" 03247295
03247300
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03247305
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03247310
03247315
address DSNREXX "EXECSQL OPEN C1" 03247320
if sqlcode<>0 then call errsqlca "OPEN C1" 03247325
03247330
address DSNREXX "EXECSQL FETCH C1", 03247335
"INTO :HV1" 03247340
DO WHILE SQLCODE = 0 03247345
TEMP.1 = HV1 03247350
'EXECIO' 1 'DISKW REPORT27 (STEM TEMP.' 03247355
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03247360
, 'EXECIO DISKW REPORT27 rc=' rc 03247365
address DSNREXX "EXECSQL FETCH C1", 03247370
"INTO :HV1" 03247375
END 03247380
03247385
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03247390
03247395
drop TEMP. HV1 03247400
'EXECIO 0 DISKW REPORT27 (FINIS' 03247405
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03247410
, 'EXECIO DISKW REPORT27 CLOSE rc=' rc 03247415
03247420
address DSNREXX "EXECSQL CLOSE C1" 03247425
if sqlcode<>0 then call errsqlca "CLOSE C1" 03247430
03247435
CALL IntMsg, 03247440
' Report 27 completed' 03247445
03247450
RETURN /* end generateReport27 */ 03247455
03247460
03247465
generateReport28: PROCEDURE 03247470
/*****************************************************************/ 03247475
/* Generates premigration report 28 */ 03247480
/* Report use of DATACAPTURE disabled during ENFM */ 03247485
/*****************************************************************/ 03247490
"EXECIO 0 DISKW REPORT28 (OPEN" 03247495
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03247500
, 'EXECIO DISKW REPORT28 OPEN rc=' rc 03247505
03247510
TEMP.1 = "=== REPORT 28" COPIES('=',58) 03247517
TEMP.2 = "= The DATA CAPTURE CHANGES option is active", 03247520
"but will be disabled on =" 03247525
TEMP.3 = "= the following DB2 catalog tables when you", 03247530
"run job DSNTIJEN to per- =" 03247535
TEMP.4 = "= form the enabling-new-function (CATENFM)", 03247540
"process after migration to =" 03247545
TEMP.5 = "= V10 conversion mode. After you have run job", 03247550
"DSNTIJNF to put DB2 in =" 03247555
TEMP.6 = "= new function mode, use the command: ", 03247560
" =" 03247565
TEMP.7 = "= ALTER TABLE SYSIBM.tablename DATA CAPTURE", 03247570
"CHANGES; =" 03247575
TEMP.8 = "= to reenable DATA CAPTURE CHANGES on each", 03247580
"affected table. Note that =" 03247585
TEMP.9 = "= you cannot enable DATA CAPTURE CHANGES on", 03247590
"any DB2 catalog table =" 03247595
TEMP.10 = "= during the enabling-new-function mode", 03247600
"process. =" 03247605
TEMP.11 = COPIES('=',72) 03247610
TEMP.12 = "CREATOR.NAME" 03247615
TEMP.13 = COPIES('-',257) 03247620
03247625
'EXECIO' 13 'DISKW REPORT28 (STEM TEMP.' 03247630
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03247635
, 'EXECIO DISKW REPORT28 rc=' rc 03247640
03247645
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03247650
address DSNREXX EXECSQL SQLSTMT 03247655
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03247660
03247665
SQLSTMT =, 03247670
"SELECT STRIP(CREATOR) || '.' || STRIP(NAME)", 03247675
"FROM SYSIBM.SYSTABLES", 03247680
"WHERE CREATOR = 'SYSIBM'", 03247685
"AND NAME = 'SYSPACKSTMT'", 03247690
"AND DATACAPTURE = 'Y'" 03247695
03247700
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03247705
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03247710
03247715
address DSNREXX "EXECSQL OPEN C1" 03247720
if sqlcode<>0 then call errsqlca "OPEN C1" 03247725
03247730
address DSNREXX "EXECSQL FETCH C1", 03247735
"INTO :HV1" 03247740
DO WHILE SQLCODE = 0 03247745
TEMP.1 = HV1 03247750
'EXECIO' 1 'DISKW REPORT28 (STEM TEMP.' 03247755
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03247760
, 'EXECIO DISKW REPORT28 rc=' rc 03247765
address DSNREXX "EXECSQL FETCH C1", 03247770
"INTO :HV1" 03247775
END 03247780
03247785
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03247790
03247795
drop TEMP. HV1 03247800
'EXECIO 0 DISKW REPORT28 (FINIS' 03247805
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03247810
, 'EXECIO DISKW REPORT28 CLOSE rc=' rc 03247815
03247820
address DSNREXX "EXECSQL CLOSE C1" 03247825
if sqlcode<>0 then call errsqlca "CLOSE C1" 03247830
03247835
CALL IntMsg, 03247840
' Report 28 completed' 03247845
03247850
RETURN /* end generateReport28 */ 03247855
03247860
03247865
generateReport29: 03247871
/*****************************************************************/ 03247872
/* Generates premigration report 29 */ 03247873
/* Report owners of packages and plans that contain self- */ 03247874
/* referencing SQL statements for tables or views on which */ 03247875
/* the package owner has been granted the UPDATE or DELETE */ 03247876
/* privilege but not the SELECT privilege. */ 03247877
/* */ 03247878
/* Examples of self-referencing statements are: */ 03247879
/* UPDATE T1 SET C1 = (SELECT C1*10 FROM T1) */ 03247880
/* UPDATE T1 SET C1 = C2 */ 03247881
/* UPDATE T1 SET C1 = 1000 WHERE C1 = 500 */ 03247882
/* DELETE FROM T1 WHERE C2 = (SELECT C1 FROM T1) */ 03247883
/* DELETE FROM T1 WHERE C1 = 500 */ 03247884
/* MERGE statements are automatically self-referencing. */ 03247885
/* */ 03247886
/* (1) ***********************************************************/ 03247887
/* * Get a list of packages that have the UPDATE or DELETE */ 03247888
/* * privilege (or both) but not the SELECT privilege on a */ 03247890
/* * table or view referenced within that package. */ 03247891
/* * */ 03247892
/* * For each package: */ 03247893
/* * - get the package owner and qualifier */ 03247894
/* * - If the package owner has the SYSADM authorization then */ 03247895
/* * no further checking is needed. */ 03247896
/* * - Else if the package owner or PUBLIC has the SELECT */ 03247897
/* * privilege on the table or view, no further checking is */ 03247898
/* * needed. */ 03247899
/* * - Otherwise: */ 03247900
/* * - For each such package, get the SQL statements from */ 03247901
/* * the SYSIBM.SYSPACKSTMT table. */ 03247902
/* * - Scan each statement to see if it is a self- */ 03247903
/* * referencing statement in one of these forms: */ 03247904
/* * UPDATE T1 SET C1 = (SELECT C1*10 FROM T1) */ 03247905
/* * UPDATE T1 SET C1 = C2 */ 03247906
/* * UPDATE T1 SET C1 = 1000 WHERE C1 = 500 */ 03247907
/* * MERGE INTO T1 */ 03247908
/* * DELETE FROM T1 WHERE C2 = (SELECT C1 FROM T1) */ 03247909
/* * DELETE FROM T1 WHERE C1 = 500 */ 03247910
/* * - If it is, report it as such */ 03247911
/* * */ 03247912
/* * PSEUDOCODE: */ 03247913
/* * ========== */ 03247914
/* * CheckPackagesHavingUpdateOrDeleteButNotSelectAuthOnTables */ 03247915
/* * Call GetPackageOwnerAndQualifier */ 03247916
/* * If \HasSysadmAuth and \HasSelectAuth Then */ 03247917
/* * ScanSYSPACKSTMT */ 03247918
/* * ScanSqlStatement */ 03247919
/* * ScanForUpdateWithSelectStatement */ 03247920
/* * ReportMatch */ 03247921
/* * ScanOtherUpdateStatement */ 03247922
/* * IsColumn */ 03247923
/* * ReportMatch */ 03247924
/* * ScanMergeStatement */ 03247925
/* * ReportMatch */ 03247926
/* * ScanForDeleteWithSelectStatement */ 03247927
/* * ReportMatch */ 03247928
/* * ScanOtherDeleteStatement */ 03247929
/* * IsColumn */ 03247930
/* * ReportMatch */ 03247931
/* *************************************************************/ 03247932
/* */ 03247933
/* (2) ***********************************************************/ 03247934
/* * Get a list of plans that have the UPDATE or DELETE */ 03247935
/* * privilege (or both) but not the SELECT privilege */ 03247936
/* * on a table or view referenced within that plan. */ 03247937
/* * */ 03247938
/* * For each plan: */ 03247939
/* * - If the plan owner has the SYSADM authorization then */ 03247940
/* * no further checking is needed. */ 03247941
/* * - Else if the plan owner or PUBLIC has the SELECT */ 03247942
/* * privilege on the table or view, no further checking is */ 03247943
/* * needed. */ 03247944
/* * - Otherwise: */ 03247945
/* * - For each such plan, get the SQL statements from */ 03247946
/* * the SYSIBM.SYSSTMT table. */ 03247947
/* * - Scan each statement to see if it is a self- */ 03247948
/* * referencing statement in one of these forms: */ 03247949
/* * UPDATE T1 SET C1 = (SELECT C1*10 FROM T1) */ 03247950
/* * UPDATE T1 SET C1 = C2 */ 03247951
/* * UPDATE T1 SET C1 = 1000 WHERE C1 = 500 */ 03247952
/* * MERGE INTO T1 */ 03247953
/* * DELETE FROM T1 WHERE C2 = (SELECT C1 FROM T1) */ 03247954
/* * DELETE FROM T1 WHERE C1 = 500 */ 03247955
/* * - If it is, report it as such */ 03247956
/* * */ 03247957
/* * PSEUDOCODE: */ 03247958
/* * ========== */ 03247959
/* * CheckPlansHavingUpdateOrDeleteButNotSelectAuthOnTables */ 03247960
/* * Call GetPlanOwnerAndQualifier */ 03247961
/* * If \HasSysadmAuth and \HasSelectAuth Then */ 03247962
/* * ScanSYSSTMT */ 03247963
/* * ScanSqlStatement */ 03247964
/* * ScanForUpdateWithSelectStatement */ 03247965
/* * ReportMatch */ 03247966
/* * ScanOtherUpdateStatement */ 03247967
/* * IsColumn */ 03247968
/* * ReportMatch */ 03247969
/* * ScanMergeStatement */ 03247970
/* * ReportMatch */ 03247971
/* * ScanForDeleteWithSelectStatement */ 03247972
/* * ReportMatch */ 03247973
/* * ScanOtherDeleteStatement */ 03247974
/* * IsColumn */ 03247975
/* * ReportMatch */ 03247976
/* *************************************************************/ 03247977
/* */ 03247978
/*****************************************************************/ 03247979
AllowDbadmAuth = No 03247981
"EXECIO 0 DISKW REPORT29 (OPEN" 03247982
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03247983
, 'EXECIO DISKW REPORT29 OPEN rc=' rc 03247984
03247985
TEMP.1 = "=== REPORT 29" COPIES('=',58) 03247986
TEMP.2 = "= Beginning in V10, DB2 enforces additional", 03247987
"authorization checking on =" 03247988
TEMP.3 = "= self-referencing SQL statements during PREPARE,", 03247989
"EXECUTE IMMEDIATE, =" 03247990
TEMP.4 = "= BIND, REBIND, or auto-bind processing. A", 03247991
"self-referencing SQL =" 03247992
TEMP.5 = "= statement is one in which the target table or", 03247993
"view refers to itself =" 03247994
TEMP.6 = "= in the statement body. Examples of self-referencing", 03247995
"statements are: =" 03247996
TEMP.7 = "= UPDATE T1 SET C1 = (SELECT C1*10 FROM T1) ", 03247997
" =" 03247998
TEMP.8 = "= UPDATE T1 SET C1 = C2 ", 03247999
" =" 03248000
TEMP.9 = "= UPDATE T1 SET C1 = 1000 WHERE C1 = 500 ", 03248001
" =" 03248002
TEMP.10 = "= DELETE FROM T1 WHERE C2 = (SELECT C1 FROM T1) ", 03248003
" =" 03248004
TEMP.11 = "= DELETE FROM T1 WHERE C1 = 500 ", 03248005
" =" 03248006
TEMP.12 = "= MERGE statements are automatically self-referencing.", 03248007
" =" 03248008
TEMP.13 = "= ", 03248009
" =" 03248010
TEMP.14 = "= Each package or plan listed below contains at least", 03248011
"one MERGE or =" 03248012
TEMP.15 = "= self-referencing DELETE or UPDATE statement for the", 03248013
"indicated table =" 03248014
TEMP.16 = "= or view. The package or plan owner has the UPDATE", 03248015
"or DELETE =" 03248016
TEMP.17 = "= privilege on the table or view but not the SELECT", 03248017
"privilege. To =" 03248018
TEMP.18 = "= prevent bind failure on the package or plan after", 03248019
"migration to V10, =" 03248020
TEMP.19 = "= ensure that the owner is authorized to perform all", 03248021
"SQL operations =" 03248022
TEMP.20 = "= within the statement. ", 03248023
" =" 03248024
TEMP.21 = "= ", 03248025
" =" 03248026
TEMP.22 = "= Notes: ", 03248027
" =" 03248028
TEMP.23 = "= (1) This list is obtained by shallow parsing", 03248029
"of the DB2 catalog and =" 03248030
TEMP.24 = "= may not include complex self-referencing", 03248031
"SQL statements. =" 03248032
If AllowDbadmAuth ^= No Then 03248033
Do 03248034
TEMP.25 = "= (2) This list does not include packages and plans",03248035
"that receive the =" 03248036
End 03248037
Else 03248038
Do 03248039
TEMP.25 = "= (2) This list may include packages and plans", 03248040
"that receive the =" 03248041
End 03248042
TEMP.26 = "= necessary SELECT authorization on a table", 03248043
"or view implicitly =" 03248044
TEMP.27 = "= from a user with DBADM authority on the", 03248045
"containing database. =" 03248046
If AllowDbadmAuth ^= No Then 03248047
Do 03248048
TEMP.28 = "= To include such packages and plans, edit", 03248049
"the job and change =" 03248050
TEMP.29 = "= 'AllowDbadmAuth = Yes' to 'AllowDbadmAuth", 03248051
"= No'. Recommendation: =" 03248052
End 03248053
Else 03248054
Do 03248055
TEMP.28 = "= To exclude such packages and plans, edit", 03248056
"the job and change =" 03248057
TEMP.29 = "= 'AllowDbadmAuth = No' to 'AllowDbadmAuth", 03248058
"= Yes'. Recommendation: =" 03248059
End 03248060
TEMP.30 = "= Do not exclude these packages and plans if,", 03248061
"after migrating to =" 03248062
TEMP.31 = "= DB2 10 NFM, you plan to replace existing", 03248063
"DBADM privileges with =" 03248064
TEMP.32 = "= the new Sytem DBADM privilege without data", 03248065
"access. =" 03248066
TEMP.33 = COPIES('=',72) 03248067
03248068
'EXECIO' 33 'DISKW REPORT29 (STEM TEMP.' 03248069
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03248070
, 'EXECIO DISKW REPORT29 rc=' rc 03248071
03248072
No = 0 03248073
Yes = 1 03248074
FoundMatch = No 03248075
TraceLevel = 0 03248076
LongRunTracing = No 03248077
StartTime = TIME('E') 03248078
DepthIndicator = '=>' 03248079
03248080
EBCDIC = '405A7F7B5B6C507D4D5D5C4E6B604B617A5E4C7E6E6F7C4F6D', 03248081
'C1C2C3C4C5C6C7C8C9', 03248082
'D1D2D3D4D5D6D7D8D9', 03248083
'E2E3E4E5E6E7E8E9', 03248084
'818283848586878889', 03248085
'919293949596979899', 03248086
'A2A3A4A5A6A7A8A9', 03248087
'F0F1F2F3F4F5F6F7F8F9' 03248088
EBCDIC = x2c(EBCDIC) 03248089
Unicode = '202122232425262728292A2B2C2D2E2F3A3B3C3D3E3F407C5F', 03248090
'414243444546474849', 03248091
'4A4B4C4D4E4F505152', 03248092
'535455565758595A', 03248093
'616263646566676869', 03248094
'6A6B6C6D6E6F707172', 03248095
'737475767778797A', 03248096
'30313233343536373839' 03248097
Unicode = x2c(Unicode) 03248098
03248099
Call CheckPackagesHavingUpdateOrDeleteButNotSelectAuthOnTables 03248100
03248101
Call CheckPlansHavingUpdateOrDeleteButNotSelectAuthOnTables 03248102
03248103
Signal generateReport29End 03248104
03248105
03248106
CheckPackagesHavingUpdateOrDeleteButNotSelectAuthOnTables: 03248107
/*******************************************************************/ 03248108
/* Internal procedure for generateReport29 */ 03248109
/*******************************************************************/ 03248110
/* Get a list of packages (GRANTEEs) that have the UPDATE or DELETE*/ 03248111
/* privilege (or both) but not the SELECT privilege on a table or */ 03248112
/* view referenced within that package. We refer to this table as */ 03248113
/* the target table. Exclude any package where one or more of the */ 03248114
/* following is true: */ 03248115
/* * The grantor has SYSADM auth */ 03248116
/* * The grantor has installation SYSADM auth */ 03248117
/* * The grantor is also the creator of the referenced table or */ 03248118
/* view */ 03248119
/* * Either the grantee or PUBLIC has SELECTAUTH elsewhere on the */ 03248120
/* same table or view */ 03248121
/*******************************************************************/ 03248122
/* Note: Before running this query, change '!ISA1!' and */ 03248123
/* '!ISA2!' to the installation SYSADM IDs. */ 03248124
/*******************************************************************/ 03248125
/* Process each package selected as follows: */ 03248126
/* (1) Call GetPackageOwnerAndQualifier to get the owner */ 03248127
/* (2) If the package owner has SYSADM auth then no further */ 03248128
/* checking is required because the SELECT auth is implicit */ 03248129
/* (3) If the package owner has SELECT auth on the target table */ 03248130
/* then no further checking is required. */ 03248131
/* (4) Otherwise, call ScanSYSPACKSTMT to check for self- */ 03248132
/* referencing SQL on the target table. */ 03248133
/*******************************************************************/ 03248134
03248135
Call TraceIn, 03248136
'CheckPackagesHavingUpdateOrDeleteButNotSelectAuthOnTables' 03248137
03248138
SQLStmt = "SELECT STRIP(TA1.COLLID) ",03248139
", STRIP(TA1.GRANTEE) ",03248140
", HEX(TA1.CONTOKEN) ",03248141
", STRIP(TA1.TCREATOR) ",03248142
", STRIP(TA1.TTNAME) ",03248143
", TA1.DELETEAUTH ",03248144
", TA1.UPDATEAUTH ",03248145
" FROM SYSIBM.SYSTABAUTH TA1 ",03248146
" WHERE TA1.GRANTEETYPE = 'P' ",03248147
" AND TA1.COLLID <> ' ' ",03248148
" AND (TA1.UPDATEAUTH <> ' ' OR ",03248149
" TA1.DELETEAUTH <> ' ' ",03248150
" ) ",03248151
" AND TA1.SELECTAUTH = ' ' ",03248152
" AND TA1.GRANTOR NOT IN ",03248153
" ( SELECT UA.GRANTEE ",03248154
" FROM SYSIBM.SYSUSERAUTH UA ",03248155
" WHERE UA.SYSADMAUTH <> ' ' ",03248156
" ) ",03248157
" AND TA1.GRANTOR <> '!ISA1!' ",03248158
" AND TA1.GRANTOR <> '!ISA2!' ",03248159
" AND TA1.GRANTOR <> TCREATOR ",03248160
" AND NOT EXISTS ",03248161
" ( SELECT 1 ",03248162
" FROM SYSIBM.SYSTABAUTH TA2 ",03248163
" WHERE TA1.TCREATOR = TA2.TCREATOR ",03248164
" AND TA1.TTNAME = TA2.TTNAME ",03248165
" AND TA2.SELECTAUTH <> ' ' ",03248166
" AND (TA1.GRANTOR = TA2.GRANTEE OR ",03248167
" TA2.GRANTEE = 'PUBLIC' ",03248168
" ) ",03248169
" ) " 03248170
If AllowDbadmAuth ^= No Then 03248171
/***************************************************************/ 03248172
/* Only if requested, exclude packages that have implicit auth */ 03248173
/* on a table because the grantor has DBADM auth on the */ 03248174
/* containing database. */ 03248175
/***************************************************************/ 03248176
Do 03248177
SQLStmt = SQLStmt, 03248178
" AND TA1.DBNAME = ' ' " 03248179
End 03248180
03248181
SQLStmt = SQLStmt, 03248182
" ORDER BY TA1.COLLID ",03248183
", TA1.GRANTEE ",03248184
", TA1.CONTOKEN ",03248185
", TA1.TCREATOR ",03248186
", TA1.TTNAME " 03248187
03248188
Function = "EXECSQL DECLARE C1 CURSOR FOR S1" 03248189
ADDRESS DSNREXX Function 03248190
Call Show_SQLCA 03248191
03248192
Function = "EXECSQL PREPARE S1 FROM :SQLSTMT" 03248193
ADDRESS DSNREXX Function 03248194
Call Show_SQLCA 03248195
03248196
Function = "EXECSQL OPEN C1" 03248197
ADDRESS DSNREXX Function 03248198
Call Show_SQLCA 03248199
03248200
Function = "EXECSQL FETCH C1 INTO ",03248201
":STA_CollID, :STA_Grantee, ",03248202
":STA_ConToken, ",03248203
":STA_TCreator, :STA_TTName, ",03248204
":STA_DeleteAuth, :STA_UpdateAuth " 03248205
ADDRESS DSNREXX Function 03248206
03248207
Do I = 1 By 1 While(SQLCODE = 0) 03248208
03248209
Call TracePlanOrPackageName 03248210
/***************************************************************/ 03248211
/* Get the package's owner and qualifier */ 03248212
/***************************************************************/ 03248213
Call GetPackageOwnerAndQualifier 03248214
/***************************************************************/ 03248215
/* If the package owner has SYSADM authorization then the */ 03248216
/* package is not of interest. */ 03248217
/* */ 03248218
/* If the package owner or PUBLIC has SELECT access on the */ 03248219
/* table or view then the package is not of interest. */ 03248220
/* */ 03248221
/* Otherwise, scan the SQL statements in the selected package */ 03248222
/* for self-referencing SQL on the target table. */ 03248223
/***************************************************************/ 03248224
If HasSysadmAuth(PlanOrPackageOwner) = No Then 03248225
If HasSelectAuth(PlanOrPackageOwner STA_TCreator STA_TTName), 03248226
= No Then 03248227
Call ScanSYSPACKSTMT 03248228
03248229
Function = "EXECSQL FETCH C1 INTO ",03248230
":STA_CollID, :STA_Grantee, ",03248231
":STA_ConToken, ",03248232
":STA_TCreator, :STA_TTName, ",03248233
":STA_DeleteAuth, :STA_UpdateAuth " 03248234
ADDRESS DSNREXX Function 03248235
03248236
End /* Do I = 1 By 1 While(SQLCODE = 0) */ 03248237
03248238
Call Show_SQLCA 03248239
03248240
Function = "EXECSQL CLOSE C1" 03248241
ADDRESS DSNREXX Function 03248242
Call Show_SQLCA 03248243
03248244
Call TraceOut, 03248245
'CheckPackagesHavingUpdateOrDeleteButNotSelectAuthOnTables' 03248246
Return /* CheckPackagesHavingUpdateOrDeleteButNotSelectAuthOnTables */03248247
03248248
03248249
GetPackageOwnerAndQualifier: 03248250
/*******************************************************************/ 03248251
/* Internal procedure for generateReport29 */ 03248252
/*******************************************************************/ 03248253
/* Get the OWNER and QUALIFIER of the package currently selected */ 03248254
/* from SYSIBM.SYSTABAUTH */ 03248255
/*******************************************************************/ 03248256
03248257
Call TraceIn 'GetPackageOwnerAndQualifier' 03248258
03248259
SQLStmt = "SELECT STRIP(OWNER), ",03248260
" STRIP(QUALIFIER) ",03248261
" FROM SYSIBM.SYSPACKAGE ",03248262
" WHERE LOCATION = ' ' ",03248263
" AND COLLID = '"STA_CollID"' ",03248264
" AND NAME = '"STA_Grantee"' ",03248265
" AND HEX(CONTOKEN) = '"STA_ConToken"' " 03248266
03248267
Function = "EXECSQL DECLARE C5 CURSOR FOR S5" 03248268
ADDRESS DSNREXX Function 03248269
Call Show_SQLCA 03248270
03248271
Function = "EXECSQL PREPARE S5 FROM :SQLSTMT" 03248272
ADDRESS DSNREXX Function 03248273
Call Show_SQLCA 03248274
03248275
Function = "EXECSQL OPEN C5" 03248276
ADDRESS DSNREXX Function 03248277
Call Show_SQLCA 03248278
03248279
Function = "EXECSQL FETCH C5 INTO ",03248280
":PlanOrPackageOwner, :PlanOrPackageQualifier " 03248281
ADDRESS DSNREXX Function 03248282
Call Show_SQLCA 03248283
03248284
Function = "EXECSQL CLOSE C5" 03248285
ADDRESS DSNREXX Function 03248286
Call Show_SQLCA 03248287
03248288
Call TraceOut 'GetPackageOwnerAndQualifier' 03248289
Return /* GetPackageOwnerAndQualifier */ 03248290
03248291
03248292
ScanSYSPACKSTMT: 03248293
/*******************************************************************/ 03248294
/* Internal procedure for generateReport29 */ 03248295
/*******************************************************************/ 03248296
/* Scan the SYSIBM.SYSPACKSTMT table for self-referencing SQL on */ 03248297
/* the target table within the package specified by */ 03248298
/* STA_CollID.STA_Grantee. */ 03248299
/* */ 03248300
/* Fetch rows ordered by sequence number, and string together */ 03248301
/* those that have SQL statement text. */ 03248302
/* */ 03248303
/* Pass each assembled SQL statement to ScanSqlStatement to */ 03248304
/* see if it contains a self-referencing UPDATE, DELETE, or */ 03248305
/* MERGE statement on the target table. */ 03248306
/* */ 03248307
/* Note: Packages for triggers that were created in V8 prior to */ 03248308
/* PK72349 will have a negative statement section number */ 03248309
/* number (SECTNOI) and cannot be analyzed here so are */ 03248310
/* bypassed. Report 35 identifies these packages. */ 03248311
/*******************************************************************/ 03248312
03248313
Call TraceIn 'ScanSYSPACKSTMT' 03248314
03248315
PrevSPS_StmtNoI = 0 03248316
PrevSPS_SectNoI = 0 03248317
StmtLen = 0 03248318
SQLLen = 0 03248319
SqlStatement = '' 03248320
03248321
SQLStmt = "SELECT STRIP(COLLID), ",03248322
" STRIP(NAME), ",03248323
" HEX(CONTOKEN), ",03248324
" CASE ",03248325
" WHEN STMTNOI = 0 THEN STMTNO ",03248326
" ELSE STMTNOI ",03248327
" END AS STMTNOI, ",03248328
" CASE ",03248329
" WHEN SECTNOI = 0 THEN SECTNO ",03248330
" ELSE SECTNOI ",03248331
" END AS SECTNOI, ",03248332
" SEQNO, ",03248333
" STMT ",03248334
" FROM SYSIBM.SYSPACKSTMT ",03248335
" WHERE LOCATION = ' ' ",03248336
" AND COLLID = '"STA_CollID"' ",03248337
" AND NAME = '"STA_Grantee"' ",03248338
" AND HEX(CONTOKEN) = '"STA_ConToken"' ",03248339
" ORDER BY STMTNOI, SECTNOI, SEQNO " 03248340
03248341
Function = "EXECSQL DECLARE C2 CURSOR FOR S2" 03248342
ADDRESS DSNREXX Function 03248343
Call Show_SQLCA 03248344
03248345
Function = "EXECSQL PREPARE S2 FROM :SQLSTMT" 03248346
ADDRESS DSNREXX Function 03248347
Call Show_SQLCA 03248348
03248349
Function = "EXECSQL OPEN C2" 03248350
ADDRESS DSNREXX Function 03248351
Call Show_SQLCA 03248352
03248353
/*****************************************************************/ 03248354
/* Fetch from SYSPACKSTMT, assembling the SQL statements in each */ 03248355
/* package. After each statement is assembled, call the */ 03248356
/* ScanSqlStatement routine to check it for self-referencing */ 03248357
/* UPDATE, DELETE, and MERGE statements on the target table. */ 03248358
/* */ 03248359
/* If a package contains a negative SECTNOI, bypass it. */ 03248360
/*****************************************************************/ 03248361
Statement = '' 03248362
Function = "EXECSQL FETCH C2 INTO ",03248363
":SPS_CollID, :SPS_Name, :SPS_Contoken, ",03248364
":SPS_StmtNoI, :SPS_SectNoI, :SPS_SeqNo, :SPS_Stmt " 03248365
ADDRESS DSNREXX Function 03248366
03248367
Do While(SQLCODE = 0 & SPS_SectNoI >= 0 ) 03248368
Select 03248369
When SPS_StmtNoI = 0 & , /*+Statement 0 */ 03248370
SPS_SectNoI = 0 & , 03248371
SPS_SeqNo = 0 Then 03248372
/***********************************************************/ 03248373
/* Statement 0: Start of a new DBRM. Also contains */ 03248374
/* information about that DBRM in a control block. */ 03248375
/***********************************************************/ 03248376
Do 03248377
Call TraceSqlStmtBuild 'Statement 0' 03248378
/*********************************************************/ 03248379
/* Byte 43 of the DBRM's control block indicates whether */ 03248380
/* the SQL statment length resides in a halfword or a */ 03248381
/* fullword. */ 03248382
/*********************************************************/ 03248383
StmtType = Substr(SPS_Stmt,43,1) 03248384
03248385
SqlStatement = '' 03248386
PrevSPS_StmtNoI = SPS_StmtNoI 03248387
PrevSPS_SectNoI = SPS_SectNoI 03248388
End /*-Statement 0 */ 03248389
03248390
When SPS_StmtNoI = 0 & , /*+Symbol Table */ 03248391
SPS_SectNoI = 0 & , 03248392
Length(SPS_Stmt) > 0 Then 03248393
/***********************************************************/ 03248394
/* Symbol table: Ignore */ 03248395
/***********************************************************/ 03248396
Do 03248397
Call TraceSqlStmtBuild 'Symbol Table' 03248398
End /*-Symbol Table */ 03248399
03248400
When Length(SPS_Stmt) > 0 & , /*+Normal SQL 1st row */ 03248401
(SPS_StmtNoI ^= PrevSPS_StmtNoI | , 03248402
SPS_SectNoI ^= PrevSPS_SectNoI ) Then 03248403
/***********************************************************/ 03248404
/* 1st row of the next SQL statement in the package: Scan */ 03248405
/* the current SQL statement if there is one */ 03248406
/***********************************************************/ 03248407
Do 03248408
Call TraceSqlStmtBuild 'SQL row 1' 03248409
If Length(SqlStatement) > 0 Then 03248410
Do 03248411
Call ScanSqlStatement 'Package' 03248412
End 03248413
SqlStatement = '' 03248414
PrevSPS_StmtNoI = SPS_StmtNoI 03248415
PrevSPS_SectNoI = SPS_SectNoI 03248416
PrevSPS_SeqNo = SPS_SeqNo 03248417
03248418
If StmtType = '1' Then 03248419
/*******************************************************/ 03248420
/* The statement length resides in a fullword */ 03248421
/*******************************************************/ 03248422
Do 03248423
SQLLen = x2d(c2x(Substr(SPS_Stmt,5,4))) 03248424
SPS_Stmt = Substr(SPS_Stmt,9) 03248425
End 03248426
Else 03248427
/*******************************************************/ 03248428
/* The statement length resides in a halfword */ 03248429
/*******************************************************/ 03248430
Do 03248431
SQLLen = x2d(c2x(Substr(SPS_Stmt,5,2))) 03248432
SPS_Stmt = Substr(SPS_Stmt,7) 03248433
End 03248434
StmtLen = Length(SPS_Stmt) 03248435
If SQLLen ^< StmtLen Then 03248436
Do 03248437
Statement = SPS_Stmt 03248438
SQLLen = SQLLen-StmtLen 03248439
StmtLen = 0 03248440
End 03248441
Else 03248442
Do 03248443
Statement = Substr(SPS_Stmt,1,SQLLen) 03248444
SQLLen = SQLLen+1 03248445
SPS_Stmt = Substr(SPS_Stmt,SQLLen) 03248446
StmtLen = Length(SPS_Stmt) 03248447
SQLLen = 0 03248448
End 03248449
03248450
If Substr(Statement,1,1) < 'A' Then 03248451
Statement = Translate(Statement,EBCDIC,Unicode) 03248452
SqlStatement = SqlStatement || Statement 03248453
End /*-Normal SQL 1st row */ 03248454
03248455
When SQLLen > 0 & , /*+Normal SQL next row */ 03248456
Length(SPS_Stmt) > 0 Then 03248457
/***********************************************************/ 03248458
/* Next row of current SQL statement found: Append it to */ 03248459
/* the previous row(s) */ 03248460
/***********************************************************/ 03248461
Do 03248462
Call TraceSqlStmtBuild 'SQL row next' 03248463
StmtLen = Length(SPS_Stmt) 03248464
If SQLLen ^< StmtLen Then 03248465
Do 03248466
Statement = SPS_Stmt 03248467
SQLLen = SQLLen-StmtLen 03248468
StmtLen = 0 03248469
End 03248470
Else 03248471
Do 03248472
Statement = Substr(SPS_Stmt,1,SQLLen) 03248473
SQLLen = SQLLen+1 03248474
SPS_Stmt = Substr(SPS_Stmt,SQLLen) 03248475
StmtLen = Length(SPS_Stmt) 03248476
SQLLen = 0 03248477
End 03248478
If Substr(Statement,1,1) < 'A' Then 03248479
Statement = Translate(Statement,EBCDIC,Unicode) 03248480
SqlStatement = SqlStatement || Statement 03248481
End /*-Normal SQL next row */ 03248482
03248483
Otherwise 03248484
/***********************************************************/ 03248485
/* Something else: Ignore */ 03248486
/***********************************************************/ 03248487
Do 03248488
Call TraceSqlStmtBuild 'Unexpected' 03248489
End 03248490
End /* Select */ 03248491
03248492
/***************************************************************/ 03248493
/* Get the next row */ 03248494
/***************************************************************/ 03248495
Statement = '' 03248496
Function = "EXECSQL FETCH C2 INTO ",03248497
":SPS_CollID, :SPS_Name, :SPS_Contoken, ",03248498
":SPS_StmtNoI, :SPS_SectNoI, :SPS_SeqNo, :SPS_Stmt " 03248499
ADDRESS DSNREXX Function 03248500
03248501
End /* Do While(SQLCODE = 0) */ 03248502
03248503
Call Show_SQLCA 03248504
03248505
If SQLCODE = 100 Then 03248506
/***************************************************************/ 03248507
/* SQL statement rebuild complete: Scan it */ 03248508
/***************************************************************/ 03248509
Do /*+Scan SQL statement */ 03248510
Call TraceSqlStmtBuild 'SQLCODE = 100' 03248511
If Length(SqlStatement) > 0 Then 03248512
Do 03248513
Call ScanSqlStatement 'Package' 03248514
End 03248515
End /*-Scan SQL statement */ 03248516
03248517
Function = "EXECSQL CLOSE C2" 03248518
ADDRESS DSNREXX Function 03248519
Call Show_SQLCA 03248520
03248521
Drop PrevSPS_StmtNoI PrevSPS_SectNoI StmtLen SQLLen SqlStatement, 03248522
SPS_CollID SPS_Name SPS_Contoken, 03248523
SPS_StmtNoI SPS_SectNoI SPS_SeqNo SPS_Stmt 03248524
03248525
Call TraceOut 'ScanSYSPACKSTMT' 03248526
Return /* ScanSYSPACKSTMT */ 03248527
03248528
03248529
CheckPlansHavingUpdateOrDeleteButNotSelectAuthOnTables: 03248530
/*******************************************************************/ 03248531
/* Internal procedure for generateReport29 */ 03248532
/*******************************************************************/ 03248533
/* Get a list of plans (GRANTEEs) that have the UPDATE or DELETE */ 03248534
/* privilege (or both) but not the SELECT privilege on a table or */ 03248535
/* view referenced within that plan. We refer to this table as the */ 03248536
/* target table. Exclude any plan where one or more of the */ 03248537
/* following is true: */ 03248538
/* * The grantor has SYSADM auth */ 03248539
/* * The grantor has installation SYSADM auth */ 03248540
/* * The grantor is also the creator of the referenced table or */ 03248541
/* view */ 03248542
/* * Either the grantee or PUBLIC has SELECTAUTH elsewhere on the */ 03248543
/* same table or view */ 03248544
/* */ 03248545
/* Note: Before running this query, change '!ISA1!' and */ 03248546
/* '!ISA2!' to the installation SYSADM IDs. */ 03248547
/* */ 03248548
/* Process each plan selected as follows: */ 03248549
/* (1) Call GetPlanOwnerAndQualifier to get the owner */ 03248550
/* (2) If the plan owner has SYSADM auth then no further */ 03248551
/* checking is required because the SELECT auth is implicit */ 03248552
/* (3) If the plan owner has SELECT auth on the target table */ 03248553
/* then no further checking is required. */ 03248554
/* (4) Otherwise, call ScanSYSSTMT to check for self-referencing */ 03248555
/* SQL on the target table. */ 03248556
/*******************************************************************/ 03248557
03248558
STA_CollID = '' 03248559
STA_ConToken = '' 03248560
03248561
Call TraceIn, 03248562
'CheckPlansHavingUpdateOrDeleteButNotSelectAuthOnTables' 03248563
03248564
SQLStmt = "SELECT STRIP(TA1.GRANTEE) ",03248565
", STRIP(TA1.TCREATOR) ",03248566
", STRIP(TA1.TTNAME) ",03248567
", TA1.DELETEAUTH ",03248568
", TA1.UPDATEAUTH ",03248569
" FROM SYSIBM.SYSTABAUTH TA1 ",03248570
" WHERE TA1.GRANTEETYPE = 'P' ",03248571
" AND TA1.COLLID = ' ' ",03248572
" AND (TA1.UPDATEAUTH <> ' ' OR ",03248573
" TA1.DELETEAUTH <> ' ' ",03248574
" ) ",03248575
" AND TA1.SELECTAUTH = ' ' ",03248576
" AND TA1.GRANTOR NOT IN ",03248577
" ( SELECT UA.GRANTEE ",03248578
" FROM SYSIBM.SYSUSERAUTH UA ",03248579
" WHERE UA.SYSADMAUTH <> ' ' ",03248580
" ) ",03248581
" AND TA1.GRANTOR <> '!ISA1!' ",03248582
" AND TA1.GRANTOR <> '!ISA2!' ",03248583
" AND TA1.GRANTOR <> TCREATOR ",03248584
" AND NOT EXISTS ",03248585
" ( SELECT 1 ",03248586
" FROM SYSIBM.SYSTABAUTH TA2 ",03248587
" WHERE TA1.TCREATOR = TA2.TCREATOR ",03248588
" AND TA1.TTNAME = TA2.TTNAME ",03248589
" AND TA2.SELECTAUTH <> ' ' ",03248590
" AND (TA1.GRANTOR = TA2.GRANTEE OR ",03248591
" TA2.GRANTEE = 'PUBLIC' ",03248592
" ) ",03248593
" ) " 03248594
If AllowDbadmAuth ^= No Then 03248595
/***************************************************************/ 03248596
/* Only if requested, exclude plans that have implicit auth */ 03248597
/* on a table because the grantor has DBADM auth on the */ 03248598
/* containing database. */ 03248599
/***************************************************************/ 03248600
Do 03248601
SQLStmt = SQLStmt, 03248602
" AND TA1.DBNAME = ' ' " 03248603
End 03248604
03248605
SQLStmt = SQLStmt, 03248606
" ORDER BY TA1.GRANTEE ",03248607
", TA1.TCREATOR ",03248608
", TA1.TTNAME " 03248609
03248610
Function = "EXECSQL DECLARE C3 CURSOR FOR S3" 03248611
ADDRESS DSNREXX Function 03248612
Call Show_SQLCA 03248613
03248614
Function = "EXECSQL PREPARE S3 FROM :SQLSTMT" 03248615
ADDRESS DSNREXX Function 03248616
Call Show_SQLCA 03248617
03248618
Function = "EXECSQL OPEN C3" 03248619
ADDRESS DSNREXX Function 03248620
Call Show_SQLCA 03248621
03248622
Function = "EXECSQL FETCH C3 INTO ",03248623
":STA_Grantee, ",03248624
":STA_TCreator, :STA_TTName, ",03248625
":STA_DeleteAuth, :STA_UpdateAuth " 03248626
ADDRESS DSNREXX Function 03248627
03248628
Do I = 1 By 1 While(SQLCODE = 0) 03248629
03248630
Call TracePlanOrPackageName 03248631
/***************************************************************/ 03248632
/* Get the plan's owner and qualifier */ 03248633
/***************************************************************/ 03248634
Call GetPlanOwnerAndQualifier 03248635
/***************************************************************/ 03248636
/* If the plan owner has SYSADM authorization then the plan is */ 03248637
/* not of interest. */ 03248638
/* */ 03248639
/* If the plan owner or PUBLIC has SELECT access on the table */ 03248640
/* or view then the plan is not of interest. */ 03248641
/* */ 03248642
/* Otherwise, scan the SQL statements in the selected plan for */ 03248643
/* self-referencing SQL on the target table. */ 03248644
/***************************************************************/ 03248645
If HasSysadmAuth(PlanOrPackageOwner) = No Then 03248646
If HasSelectAuth(PlanOrPackageOwner STA_TCreator STA_TTName), 03248647
= No Then 03248648
Call ScanSYSSTMT 03248649
03248650
Function = "EXECSQL FETCH C3 INTO ",03248651
":STA_Grantee, ",03248652
":STA_TCreator, :STA_TTName, ",03248653
":STA_DeleteAuth, :STA_UpdateAuth " 03248654
ADDRESS DSNREXX Function 03248655
03248656
End /* Do I = 1 By 1 While(SQLCODE = 0) */ 03248657
03248658
Call Show_SQLCA 03248659
03248660
Function = "EXECSQL CLOSE C3" 03248661
ADDRESS DSNREXX Function 03248662
Call Show_SQLCA 03248663
03248664
Call TraceOut, 03248665
'CheckPlansHavingUpdateOrDeleteButNotSelectAuthOnTables' 03248666
Return /* CheckPlansHavingUpdateOrDeleteButNotSelectAuthOnTables */ 03248667
03248668
03248669
GetPlanOwnerAndQualifier: 03248670
/*******************************************************************/ 03248671
/* Internal procedure for generateReport29 */ 03248672
/*******************************************************************/ 03248673
/* Get the OWNER and QUALIFIER of the plan currently selected */ 03248674
/* from SYSIBM.SYSTABAUTH */ 03248675
/*******************************************************************/ 03248676
03248677
Call TraceIn 'GetPlanOwnerAndQualifier' 03248678
03248679
SQLStmt = "SELECT STRIP(CREATOR), ",03248680
" STRIP(QUALIFIER) ",03248681
" FROM SYSIBM.SYSPLAN ",03248682
" WHERE NAME = '"STA_Grantee"' " 03248683
03248684
Function = "EXECSQL DECLARE C9 CURSOR FOR S9" 03248685
ADDRESS DSNREXX Function 03248686
Call Show_SQLCA 03248687
03248688
Function = "EXECSQL PREPARE S9 FROM :SQLSTMT" 03248689
ADDRESS DSNREXX Function 03248690
Call Show_SQLCA 03248691
03248692
Function = "EXECSQL OPEN C9" 03248693
ADDRESS DSNREXX Function 03248694
Call Show_SQLCA 03248695
03248696
Function = "EXECSQL FETCH C9 INTO ",03248697
":PlanOrPackageOwner, :PlanOrPackageQualifier " 03248698
ADDRESS DSNREXX Function 03248699
Call Show_SQLCA 03248700
03248701
Function = "EXECSQL CLOSE C9" 03248702
ADDRESS DSNREXX Function 03248703
Call Show_SQLCA 03248704
03248705
Call TraceOut 'GetPlanOwnerAndQualifier' 03248706
Return /* GetPlanOwnerAndQualifier */ 03248707
03248708
03248709
ScanSYSSTMT: 03248710
/*******************************************************************/ 03248711
/* Internal procedure for generateReport29 */ 03248712
/*******************************************************************/ 03248713
/* Scan the SYSIBM.SYSSTMT table for self-referencing SQL on */ 03248714
/* the target table within the plan specified by STA_Grantee. */ 03248715
/* */ 03248716
/* Fetch rows ordered by sequence number, and string together */ 03248717
/* those that have SQL statement text. */ 03248718
/* */ 03248719
/* Pass each assembled SQL statement to ScanSqlStatement to */ 03248720
/* the ScanSqlStatement routine to check if it contains a */ 03248721
/* self-referencing UPDATE, DELETE, or MERGE statement on */ 03248722
/* the target table. */ 03248723
/*******************************************************************/ 03248724
Call TraceIn 'ScanSYSSTMT' 03248725
03248726
PrevSS_StmtNoI = 0 03248727
PrevSS_SectNoI = 0 03248728
StmtLen = 0 03248729
SQLLen = 0 03248730
SqlStatement = '' 03248731
03248732
SQLStmt = "SELECT STRIP(PLNAME), ",03248733
" STRIP(NAME), ",03248734
" CASE ",03248735
" WHEN STMTNOI = 0 THEN STMTNO ",03248736
" ELSE STMTNOI ",03248737
" END AS STMTNOI, ",03248738
" CASE ",03248739
" WHEN SECTNOI = 0 THEN SECTNO ",03248740
" ELSE SECTNOI ",03248741
" END AS SECTNOI, ",03248742
" SEQNO, ",03248743
" TEXT ",03248744
" FROM SYSIBM.SYSSTMT ",03248745
" WHERE PLNAME = '"STA_Grantee"' ",03248746
" ORDER BY STMTNOI, SECTNOI, SEQNO " 03248747
03248748
Function = "EXECSQL DECLARE C4 CURSOR FOR S4" 03248749
ADDRESS DSNREXX Function 03248750
Call Show_SQLCA 03248751
03248752
Function = "EXECSQL PREPARE S4 FROM :SQLSTMT" 03248753
ADDRESS DSNREXX Function 03248754
Call Show_SQLCA 03248755
03248756
Function = "EXECSQL OPEN C4" 03248757
ADDRESS DSNREXX Function 03248758
Call Show_SQLCA 03248759
03248760
/*****************************************************************/ 03248761
/* Fetch from SYSSTMT, assembling the SQL statements in the */ 03248762
/* plan. After each statement is assembled, call the */ 03248763
/* ScanSqlStatement routine to check it for self-referencing */ 03248764
/* UPDATE, DELETE, and MERGE statements on the target table. */ 03248765
/*****************************************************************/ 03248766
Statement = '' 03248767
Function = "EXECSQL FETCH C4 INTO ",03248768
":SS_PlName, :SS_Name, ",03248769
":SS_StmtNoI, :SS_SectNoI, :SS_SeqNo, :SS_Stmt " 03248770
ADDRESS DSNREXX Function 03248771
03248772
Do While(SQLCODE = 0) 03248773
Select 03248774
When SS_StmtNoI = 0 & , /*+Statement 0 */ 03248775
SS_SectNoI = 0 & , 03248776
SS_SeqNo = 0 Then , 03248777
/***********************************************************/ 03248778
/* Statement 0: Start of a new DBRM. Also contains */ 03248779
/* information about that DBRM in a control block. */ 03248780
/***********************************************************/ 03248781
Do 03248782
Call TraceSqlStmtBuild 'Statement 0' 03248783
/*********************************************************/ 03248784
/* Byte 43 of the DBRM's control block indicates whether */ 03248785
/* the SQL statment length resides in a halfword or a */ 03248786
/* fullword. */ 03248787
/*********************************************************/ 03248788
StmtType = Substr(SS_Stmt,43,1) 03248789
03248790
SqlStatement = '' 03248791
PrevSS_StmtNoI = SS_StmtNoI 03248792
PrevSS_SectNoI = SS_SectNoI 03248793
End /*-Statement 0 */ 03248794
03248795
When SS_StmtNoI = 0 & , /*+Symbol Table */ 03248796
SS_SectNoI = 0 & , 03248797
Length(SS_Stmt) > 0 Then 03248798
/***********************************************************/ 03248799
/* Symbol table: Ignore */ 03248800
/***********************************************************/ 03248801
Do 03248802
Call TraceSqlStmtBuild 'Symbol Table' 03248803
End /*-Symbol Table */ 03248804
03248805
When Length(SS_Stmt) > 0 & , /*+Normal SQL 1st row */ 03248806
(SS_StmtNoI ^= PrevSS_StmtNoI | , 03248807
SS_SectNoI ^= PrevSS_SectNoI ) Then 03248808
/***********************************************************/ 03248809
/* 1st row of the next SQL statement in the plan: Scan the */ 03248810
/* current SQL statement if there is one */ 03248811
/***********************************************************/ 03248812
Do 03248813
Call TraceSqlStmtBuild 'SQL row 1' 03248814
If Length(SqlStatement) > 0 Then 03248815
Do 03248816
Call ScanSqlStatement 'Plan' 03248817
End 03248818
SqlStatement = '' 03248819
PrevSS_StmtNoI = SS_StmtNoI 03248820
PrevSS_SectNoI = SS_SectNoI 03248821
03248822
If StmtType = '1' Then 03248823
/*******************************************************/ 03248824
/* The statement length resides in a fullword */ 03248825
/*******************************************************/ 03248826
Do 03248827
SQLLen = x2d(c2x(Substr(SS_Stmt,5,4))) 03248828
SS_Stmt = Substr(SS_Stmt,9) 03248829
End 03248830
Else 03248831
/*******************************************************/ 03248832
/* The statement length resides in a halfword */ 03248833
/*******************************************************/ 03248834
Do 03248835
SQLLen = x2d(c2x(Substr(SS_Stmt,5,2))) 03248836
SS_Stmt = Substr(SS_Stmt,7) 03248837
End 03248838
StmtLen = Length(SS_Stmt) 03248839
If SQLLen ^< StmtLen Then 03248840
Do 03248841
Statement = SS_Stmt 03248842
SQLLen = SQLLen-StmtLen 03248843
StmtLen = 0 03248844
End 03248845
Else 03248846
Do 03248847
Statement = Substr(SS_Stmt,1,SQLLen) 03248848
SQLLen = SQLLen+1 03248849
SS_Stmt = Substr(SS_Stmt,SQLLen) 03248850
StmtLen = Length(SS_Stmt) 03248851
SQLLen = 0 03248852
End 03248853
03248854
If Substr(Statement,1,1) < 'A' Then 03248855
Statement = Translate(Statement,EBCDIC,Unicode) 03248856
SqlStatement = SqlStatement || Statement 03248857
End /*-Normal SQL 1st row */ 03248858
03248859
When SQLLen > 0 & , /*+Normal SQL next row */ 03248860
Length(SS_Stmt) > 0 Then 03248861
/***********************************************************/ 03248862
/* Next row of current SQL statement found: Append it to */ 03248863
/* the previous row(s) */ 03248864
/***********************************************************/ 03248865
Do 03248866
Call TraceSqlStmtBuild 'SQL row next' 03248867
StmtLen = Length(SS_Stmt) 03248868
If SQLLen ^< StmtLen Then 03248869
Do 03248870
Statement = SS_Stmt 03248871
SQLLen = SQLLen-StmtLen 03248872
StmtLen = 0 03248873
End 03248874
Else 03248875
Do 03248876
Statement = Substr(SS_Stmt,1,SQLLen) 03248877
SQLLen = SQLLen+1 03248878
SS_Stmt = Substr(SS_Stmt,SQLLen) 03248879
StmtLen = Length(SS_Stmt) 03248880
SQLLen = 0 03248881
End 03248882
If Substr(Statement,1,1) < 'A' Then 03248883
Statement = Translate(Statement,EBCDIC,Unicode) 03248884
SqlStatement = SqlStatement || Statement 03248885
End /*-Normal SQL next row */ 03248886
03248887
Otherwise 03248888
/***********************************************************/ 03248889
/* Something else: Ignore */ 03248890
/***********************************************************/ 03248891
Do 03248892
Call TraceSqlStmtBuild 'Unexpected' 03248893
End 03248894
End /* Select */ 03248895
03248896
/***************************************************************/ 03248897
/* Fetch the next row */ 03248898
/***************************************************************/ 03248899
Statement = '' 03248900
Function = "EXECSQL FETCH C4 INTO ",03248901
":SS_PlName, :SS_Name, ",03248902
":SS_StmtNoI, :SS_SectNoI, :SS_SeqNo, :SS_Stmt " 03248903
ADDRESS DSNREXX Function 03248904
03248905
End /* Do While(SQLCODE = 0) */ 03248906
03248907
Call Show_SQLCA 03248908
03248909
If SQLCODE = 100 Then 03248910
/***************************************************************/ 03248911
/* SQL statement rebuild complete: Scan it */ 03248912
/***************************************************************/ 03248913
Do /*+Scan SQL statement */ 03248914
Call TraceSqlStmtBuild 'SQLCODE = 100' 03248915
If Length(SqlStatement) > 0 Then 03248916
Do 03248917
Call ScanSqlStatement 'Plan' 03248918
End 03248919
End /*-Scan SQL statement */ 03248920
03248921
Function = "EXECSQL CLOSE C4" 03248922
ADDRESS DSNREXX Function 03248923
Call Show_SQLCA 03248924
03248925
StmtLen = 0 03248926
SQLLen = 0 03248927
SqlStatement = '' 03248928
03248929
Drop PrevSPS_StmtNoI PrevSPS_SectNoI StmtLen SQLLen SqlStatement, 03248930
SS_PlName SS_Name SS_StmtNoI SS_SectNoI SS_SeqNo SS_Stmt 03248931
03248932
Call TraceOut 'ScanSYSSTMT' 03248933
Return /* ScanSYSSTMT */ 03248934
03248935
03248936
ScanSqlStatement: 03248937
/*******************************************************************/ 03248938
/* Internal procedure for generateReport29 */ 03248939
/*******************************************************************/ 03248940
/* Search an assembled SQL statement for these targets: */ 03248941
/* - 'UPDATE ' */ 03248942
/* followed by TCREATOR || ' . ' || TTNAME || ' ' */ 03248943
/* or TTNAME || ' ' */ 03248944
/* followed by ' SELECT ' */ 03248945
/* followed by ' FROM ' || TCREATOR || ' . ' || TTNAME||' ' */ 03248946
/* or ' FROM ' || TTNAME || ' ' */ 03248947
/* */ 03248948
/* - 'UPDATE ' */ 03248949
/* followed by TCREATOR || ' . ' || TTNAME || ' ' */ 03248950
/* or TTNAME || ' ' */ 03248951
/* followed by ' SET ' || COLNAME1 || ' = ' || COLNAME2 */ 03248952
/* */ 03248953
/* - 'UPDATE ' */ 03248954
/* followed by TCREATOR || ' . ' || TTNAME || ' ' */ 03248955
/* or TTNAME || ' ' */ 03248956
/* followed by ' WHERE ' || COLNAME1 || ' = ' */ 03248957
/* */ 03248958
/* - 'MERGE INTO ' */ 03248959
/* followed by TCREATOR || ' . ' || TTNAME || ' ' */ 03248960
/* or TTNAME || ' ' */ 03248961
/* */ 03248962
/* - 'DELETE FROM ' */ 03248963
/* followed by TCREATOR || ' . ' || TTNAME || ' ' */ 03248964
/* or TTNAME || ' ' */ 03248965
/* followed by ' SELECT ' */ 03248966
/* followed by ' FROM ' || TCREATOR || ' . ' || TTNAME||' ' */ 03248967
/* or ' FROM ' || TTNAME || ' ' */ 03248968
/* */ 03248969
/* - 'DELETE FROM ' */ 03248970
/* followed by TCREATOR || ' . ' || TTNAME || ' ' */ 03248971
/* or TTNAME || ' ' */ 03248972
/* followed by ' WHERE ' || COLNAME1 || ' = ' */ 03248973
/* */ 03248974
/* where: */ 03248975
/* - TCREATOR and TTNAME identify a table on which a user has */ 03248976
/* the UPDATE or DELETE privileges (or both) but not the */ 03248977
/* SELECT privilege. */ 03248978
/* - COLNAME1 and COLNAME2 are columns in TTNAME */ 03248979
/* */ 03248980
/*******************************************************************/ 03248981
Parse Arg PlanOrPackage /* Type of object to scan for */ 03248982
03248983
Call TraceIn 'ScanSqlStatement: PlanOrPackage='PlanOrPackage 03248984
03248985
StatementY = SqlStatement || ' ' 03248986
03248987
Select 03248988
When Substr(StatementY,1,7) = 'UPDATE ' Then 03248989
Do 03248990
Call ScanForUpdateWithSelectStatement PlanOrPackage 03248991
If FoundMatch = No Then 03248992
Do 03248993
Call ScanOtherUpdateStatement PlanOrPackage 03248994
End 03248995
End 03248996
03248997
When Substr(StatementY,1,11) = 'MERGE INTO ' Then 03248998
Do 03248999
Call ScanMergeStatement PlanOrPackage 03249000
End 03249001
03249002
When Substr(StatementY,1,12) = 'DELETE FROM ' Then 03249003
Do 03249004
Call ScanForDeleteWithSelectStatement PlanOrPackage 03249005
If FoundMatch = No Then 03249006
Do 03249007
Call ScanOtherDeleteStatement PlanOrPackage 03249008
End 03249009
End 03249010
03249011
Otherwise 03249012
Do 03249013
Call TraceSqlStatementScan '-Not a DELETE, MERGE, or UPDATE' 03249014
End /* Otherwise */ 03249015
End /* Select */ 03249016
03249017
Call TraceOut 'ScanSqlStatement' 03249018
Return /* ScanSqlStatement */ 03249019
03249020
03249021
ScanForUpdateWithSelectStatement: 03249022
/*******************************************************************/ 03249023
/* Internal procedure for generateReport29 */ 03249024
/*******************************************************************/ 03249025
/* */ 03249026
/* */ 03249027
/* */ 03249028
/* Search an assembled SQL statement for this target: */ 03249029
/* 'UPDATE ' */ 03249030
/* followed by TCREATOR || ' . ' || TTNAME || ' ' */ 03249031
/* or TCREATOR || ' . ' || "TTNAME" || ' ' */ 03249032
/* or "TCREATOR" || ' . ' || TTNAME || ' ' */ 03249033
/* or "TCREATOR" || ' . ' || "TTNAME" || ' ' */ 03249034
/* or TTNAME || ' ' */ 03249035
/* or "TTNAME" || ' ' */ 03249036
/* followed by ' SELECT ' */ 03249037
/* followed by ' FROM '|| TCREATOR ||' . '|| TTNAME ||' ' */ 03249038
/* or ' FROM '|| TCREATOR ||' . '||"TTNAME"||' ' */ 03249039
/* or ' FROM '||"TCREATOR"||' . '|| TTNAME ||' ' */ 03249040
/* or ' FROM '||"TCREATOR"||' . '||"TTNAME"||' ' */ 03249041
/* or ' FROM '|| TTNAME ||' ' */ 03249042
/* or ' FROM '||"TTNAME"||' ' */ 03249043
/* */ 03249044
/* where: */ 03249045
/* - TCREATOR and TTNAME identify a table on which a user has */ 03249046
/* the UPDATE or DELETE privileges (or both) but not the */ 03249047
/* SELECT privilege. */ 03249048
/* */ 03249049
/*******************************************************************/ 03249050
Parse Arg PlanOrPackage /* Type of object to scan for */ 03249051
03249052
Call TraceIn 'ScanForUpdateWithSelectStatement:', 03249053
'PlanOrPackage='PlanOrPackage 03249054
03249055
StatementY = SqlStatement || ' ' 03249056
ContinueScan = Yes 03249057
FoundMatch = No 03249058
03249059
/*****************************************************************/ 03249060
/* Cut 1: Search the UPDATE statement only for tables on which */ 03249061
/* the UPDATE privilege has been granted */ 03249062
/*****************************************************************/ 03249063
If STA_UpdateAuth = ' ' Then 03249064
Do /*+UPDATE cut 1 */ 03249065
Call TraceSqlStatementScan '-failed UPDATE cut 1' 03249066
ContinueScan = No 03249067
End /*-UPDATE cut 1 */ 03249068
03249069
/*****************************************************************/ 03249070
/* Cut 2: Verify that the UPDATE statement begins with one of: */ 03249071
/* 'UPDATE ' || TCREATOR || ' . ' || TTNAME || ' ' */ 03249072
/* or 'UPDATE ' || TCREATOR || ' . ' || "TTNAME" || ' ' */ 03249073
/* or 'UPDATE ' || "TCREATOR" || ' . ' || TTNAME || ' ' */ 03249074
/* or 'UPDATE ' || "TCREATOR" || ' . ' || "TTNAME" || ' ' */ 03249075
/* or 'UPDATE ' || TTNAME || ' ' */ 03249076
/* or 'UPDATE ' || "TTNAME" || ' ' */ 03249077
/*****************************************************************/ 03249078
If ContinueScan = Yes Then 03249079
Do /*+UPDATE cut 2 */ 03249080
/*************************************************************/ 03249081
/* Check for explicitly qualified (creator.tablename) format */ 03249082
/* (undelimited creator and undelimited tablename) */ 03249083
/*************************************************************/ 03249084
sArg = 'UPDATE '||STA_TCreator||' . '||STA_TTName||' ' 03249085
Offset = INDEX(StatementY,sArg) 03249086
03249087
/*************************************************************/ 03249088
/* Check for explicitly qualified (creator.tablename) format */ 03249089
/* (undelimited creator and delimited tablename) */ 03249090
/*************************************************************/ 03249091
If Offset = 0 Then 03249092
Do 03249093
sArg = 'UPDATE '||STA_TCreator||' . "'||STA_TTName||'" ' 03249094
Offset = INDEX(StatementY,sArg) 03249095
End 03249096
03249097
/*************************************************************/ 03249098
/* Check for explicitly qualified (creator.tablename) format */ 03249099
/* (delimited creator and undelimited tablename) */ 03249100
/*************************************************************/ 03249101
If Offset = 0 Then 03249102
Do 03249103
sArg = 'UPDATE "'||STA_TCreator||'" . '||STA_TTName||' ' 03249104
Offset = INDEX(StatementY,sArg) 03249105
End 03249106
03249107
/*************************************************************/ 03249108
/* Check for explicitly qualified (creator.tablename) format */ 03249109
/* (delimited creator and delimited tablename) */ 03249110
/*************************************************************/ 03249111
If Offset = 0 Then 03249112
Do 03249113
sArg = 'UPDATE "'||STA_TCreator||'" . "'||STA_TTName||'" ' 03249114
Offset = INDEX(StatementY,sArg) 03249115
End 03249116
03249117
/*************************************************************/ 03249118
/* Check for implicitly qualified (tablename only) format */ 03249119
/* (undelimited tablename) */ 03249120
/*************************************************************/ 03249121
If Offset = 0 & STA_TCreator = PlanOrPackageQualifier Then 03249122
Do 03249123
sArg = 'UPDATE '||STA_TTName||' ' 03249124
Offset = INDEX(StatementY,sArg) 03249125
End 03249126
03249127
/*************************************************************/ 03249128
/* Check for implicitly qualified (tablename only) format */ 03249129
/* (delimited tablename) */ 03249130
/*************************************************************/ 03249131
If Offset = 0 & STA_TCreator = PlanOrPackageQualifier Then 03249132
Do 03249133
sArg = 'UPDATE "'||STA_TTName||'" ' 03249134
Offset = INDEX(StatementY,sArg) 03249135
End 03249136
03249137
If Offset <= 0 Then 03249138
Do 03249139
Call TraceSqlStatementScan '-failed UPDATE cut 2' 03249140
ContinueScan = No 03249141
End 03249142
End /*-UPDATE cut 2 */ 03249143
03249144
/*****************************************************************/ 03249145
/* Cut 3: Verify that the UPDATE statement continues with */ 03249146
/* ' SELECT ' */ 03249147
/*****************************************************************/ 03249148
If ContinueScan = Yes Then 03249149
Do /*+UPDATE cut 3 */ 03249150
Offset = Offset + Length(sArg) + 1 03249151
StatementY = Substr(StatementY,Offset) 03249152
sArg = ' SELECT ' 03249153
Offset = INDEX(StatementY,sArg) 03249154
03249155
If Offset <= 0 Then 03249156
Do 03249157
Call TraceSqlStatementScan '-failed UPDATE cut 3' 03249158
ContinueScan = No 03249159
End 03249160
End /*-UPDATE cut 3 */ 03249161
03249162
/*****************************************************************/ 03249163
/* Cut 4: Verify that the UPDATE statement continues with: */ 03249164
/* ' FROM ' || TCREATOR || ' . ' || TTNAME || ' ' */ 03249165
/* or ' FROM ' || TCREATOR || ' . ' || "TTNAME" || ' ' */ 03249166
/* or ' FROM ' || "TCREATOR" || ' . ' || TTNAME || ' ' */ 03249167
/* or ' FROM ' || "TCREATOR" || ' . ' || "TTNAME" || ' ' */ 03249168
/* or ' FROM ' || TTNAME || ' ' */ 03249169
/* or ' FROM ' || "TTNAME" || ' ' */ 03249170
/*****************************************************************/ 03249171
If ContinueScan = Yes Then 03249172
Do /*+UPDATE cut 4 */ 03249173
Offset = Offset + Length(sArg) + 1 03249174
/*************************************************************/ 03249175
/* Check for explicitly qualified (creator.tablename) format */ 03249176
/* (undelimited creator and undelimited tablename) */ 03249177
/*************************************************************/ 03249178
StatementY = Substr(StatementY,Offset) 03249179
sArg = ' FROM '||STA_TCreator||' . '||STA_TTName||' ' 03249180
Offset = INDEX(StatementY,sArg) 03249181
03249182
/*************************************************************/ 03249183
/* Check for explicitly qualified (creator.tablename) format */ 03249184
/* (undelimited creator and delimited tablename) */ 03249185
/*************************************************************/ 03249186
If Offset = 0 Then 03249187
Do 03249188
sArg = ' FROM '||STA_TCreator||' . "'||STA_TTName||'" ' 03249189
Offset = INDEX(StatementY,sArg) 03249190
End 03249191
03249192
/*************************************************************/ 03249193
/* Check for explicitly qualified (creator.tablename) format */ 03249194
/* (delimited creator and undelimited tablename) */ 03249195
/*************************************************************/ 03249196
If Offset = 0 Then 03249197
Do 03249198
sArg = ' FROM "'||STA_TCreator||'" . '||STA_TTName||' ' 03249199
Offset = INDEX(StatementY,sArg) 03249200
End 03249201
03249202
/*************************************************************/ 03249203
/* Check for explicitly qualified (creator.tablename) format */ 03249204
/* (delimited creator and delimited tablename) */ 03249205
/*************************************************************/ 03249206
If Offset = 0 Then 03249207
Do 03249208
sArg = ' FROM "'||STA_TCreator||'" . "'||STA_TTName||'" ' 03249209
Offset = INDEX(StatementY,sArg) 03249210
End 03249211
03249212
/*************************************************************/ 03249213
/* Check for implicitly qualified (tablename only) format */ 03249214
/* (undelimited tablename) */ 03249215
/*************************************************************/ 03249216
If Offset = 0 & STA_TCreator = PlanOrPackageQualifier Then 03249217
Do 03249218
sArg = ' FROM '||STA_TTName||' ' 03249219
Offset = INDEX(StatementY,sArg) 03249220
End 03249221
03249222
/*************************************************************/ 03249223
/* Check for implicitly qualified (tablename only) format */ 03249224
/* (delimited tablename) */ 03249225
/*************************************************************/ 03249226
If Offset = 0 & STA_TCreator = PlanOrPackageQualifier Then 03249227
Do 03249228
sArg = ' FROM "'||STA_TTName||'" ' 03249229
Offset = INDEX(StatementY,sArg) 03249230
End 03249231
03249232
If Offset <= 0 Then 03249233
Do 03249234
Call TraceSqlStatementScan '-failed UPDATE cut 4' 03249235
ContinueScan = No 03249236
End 03249237
End /*-UPDATE cut 4 */ 03249238
03249239
/*****************************************************************/ 03249240
/* If a match was found, report it */ 03249241
/*****************************************************************/ 03249242
If ContinueScan = Yes Then 03249243
Do /*+Match found */03249244
FoundMatch = Yes 03249245
Call ReportMatch PlanOrPackage 03249246
End /*-Match found */03249247
03249248
Call TraceOut 'ScanForUpdateWithSelectStatement' 03249249
Return /* ScanForUpdateWithSelectStatement */ 03249250
03249251
03249252
ScanOtherUpdateStatement: 03249253
/*******************************************************************/ 03249254
/* Internal procedure for generateReport29 */ 03249255
/*******************************************************************/ 03249256
/* Search an assembled SQL statement either of these targets: */ 03249257
/* - 'UPDATE ' */ 03249258
/* followed by TCREATOR || ' . ' || TTNAME || ' ' */ 03249259
/* or TCREATOR || ' . ' || "TTNAME" || ' ' */ 03249260
/* or "TCREATOR" || ' . ' || TTNAME || ' ' */ 03249261
/* or "TCREATOR" || ' . ' || "TTNAME" || ' ' */ 03249262
/* or TTNAME || ' ' */ 03249263
/* or "TTNAME" || ' ' */ 03249264
/* followed by ' SET ' || COLNAME1 || ' = ' || COLNAME2 */ 03249265
/* or ' SET ' || COLNAME1 || ' = ' || "COLNAME2" */ 03249266
/* or ' SET ' || "COLNAME1" || ' = ' || COLNAME2 */ 03249267
/* or ' SET ' || "COLNAME1" || ' = ' || "COLNAME2" */ 03249268
/* */ 03249269
/* - 'UPDATE ' */ 03249270
/* followed by TCREATOR || ' . ' || TTNAME || ' ' */ 03249271
/* or TCREATOR || ' . ' || "TTNAME" || ' ' */ 03249272
/* or "TCREATOR" || ' . ' || TTNAME || ' ' */ 03249273
/* or "TCREATOR" || ' . ' || "TTNAME" || ' ' */ 03249274
/* or TTNAME || ' ' */ 03249275
/* or "TTNAME" || ' ' */ 03249276
/* followed by ' WHERE ' || COLNAME1 || ' = ' */ 03249277
/* or ' WHERE ' || "COLNAME1" || ' = ' */ 03249278
/* */ 03249279
/* where: */ 03249280
/* - TCREATOR and TTNAME identify a table on which a user has */ 03249281
/* the UPDATE or DELETE privileges (or both) but not the */ 03249282
/* SELECT privilege. */ 03249283
/* - COLNAME1 and COLNAME2 are columns in TTNAME */ 03249284
/* */ 03249285
/*******************************************************************/ 03249286
Parse Arg PlanOrPackage /* Type of object to scan for */ 03249287
03249288
Call TraceIn 'ScanOtherUpdateStatement: PlanOrPackage='PlanOrPackage03249289
03249290
StatementY = SqlStatement || ' ' 03249291
ContinueScan = Yes 03249292
FoundMatch = No 03249293
FoundSET = No 03249294
Creator = '' 03249295
Table = '' 03249296
03249297
03249298
PARSE VAR StatementY Token StatementY 03249299
Call TraceSqlStatementScan '-1: token=<' || token || '>' 03249300
/*****************************************************************/ 03249301
/* Verify that the first token is UPDATE */ 03249302
/*****************************************************************/ 03249303
IF token \= 'UPDATE' THEN 03249304
DO 03249305
Call TraceSqlStatementScan '-Not an UPDATE statement' 03249306
ContinueScan = No 03249307
END 03249308
03249309
/*****************************************************************/ 03249310
/* Verify that the next token(s) are 'creator.table' or 'table' */ 03249311
/*****************************************************************/ 03249312
IF ContinueScan = Yes THEN 03249313
DO /*+Verify creator and table name */ 03249314
PARSE VAR StatementY Token StatementY 03249315
Call TraceSqlStatementScan '-2: token=<' || token || '>' 03249316
IF token = ' ' THEN 03249317
DO 03249318
Call TraceSqlStatementScan '-No creator or table name' 03249319
ContinueScan = No 03249320
END 03249321
/*************************************************************/ 03249322
/* Token 2 is either the creator name or the table name */ 03249323
/*************************************************************/ 03249324
ELSE 03249325
DO /*+Check tokens 2, 3, and 4 */ 03249326
Name = token 03249327
PARSE VAR StatementY Token StatementY 03249328
Call TraceSqlStatementScan '-3: token=<' || token || '>' 03249329
IF token = ' ' THEN 03249330
DO 03249331
ContinueScan = No 03249332
END 03249333
/*********************************************************/ 03249334
/* If token 3 is '.' then token 2 was the creator name */ 03249335
/*********************************************************/ 03249336
ELSE IF token = '.' THEN 03249337
DO /*+Token 3 is '.' */ 03249338
Creator = Name 03249339
/*****************************************************/ 03249340
/* And token 4 is the table name */ 03249341
/*****************************************************/ 03249342
PARSE VAR StatementY Token StatementY 03249343
Call TraceSqlStatementScan '-4: token=<' || token || '>'03249344
IF token = ' ' THEN 03249345
DO 03249346
ContinueScan = No 03249347
END 03249348
ELSE 03249349
DO 03249350
Table = token 03249351
END 03249352
END /*-Token 3 is '.' */ 03249353
/*********************************************************/ 03249354
/* If token 3 is 'SET' then token 2 is the table name */ 03249355
/* The creator name is the BIND QUALIFIER */ 03249356
/*********************************************************/ 03249357
ELSE IF token = 'SET' THEN 03249358
DO /*+Token 3 is 'SET' */ 03249359
FoundSET = Yes 03249360
Creator = PlanOrPackageQualifier 03249361
Table = Name 03249362
END /*-Token 3 is 'SET' */ 03249363
/*********************************************************/ 03249364
/* If token 3 is not '.' or 'SET' then token 2 is the */ 03249365
/* table name. The creator name is the BIND QUALIFIER */ 03249366
/*********************************************************/ 03249367
ELSE 03249368
DO /*+Token 3 is not '.' */ 03249369
Creator = PlanOrPackageQualifier 03249370
Table = Name 03249371
END /*-Token 3 is not '.' */ 03249372
END /*-Check tokens 2, 3, and 4 */ 03249373
END /*-Verify creator and table name */ 03249374
03249375
/*****************************************************************/ 03249376
/* Verify that the creator and table name in the statement match */ 03249377
/* the creator and name of the target table */ 03249378
/*****************************************************************/ 03249379
IF ContinueScan = Yes THEN 03249380
DO /*+Verify target table match */ 03249381
IF (Creator = STA_TCreator & Table = STA_TTName), 03249382
| (Creator = '"'STA_TCreator'"' & Table = '"'STA_TTName'"'), 03249383
| (Creator = '"'STA_TCreator'"' & Table = STA_TTName), 03249384
| (Creator = STA_TCreator & Table = '"'STA_TTName'"') THEN 03249385
DO 03249386
ContinueScan = Yes 03249387
END 03249388
ELSE 03249389
DO 03249390
ContinueScan = No 03249391
END 03249392
END /*-Verify target table match */ 03249393
03249394
/*****************************************************************/ 03249395
/* If a 'SET' has not yet been located, verify that the next */ 03249396
/* token is 'SET' */ 03249397
/*****************************************************************/ 03249398
IF ContinueScan = Yes & FoundSET = No THEN 03249399
DO /*+Verify SET */ 03249400
PARSE VAR StatementY Token StatementY 03249401
Call TraceSqlStatementScan '-5: token=<' || token || '>' 03249402
IF token \= 'SET' THEN 03249403
DO 03249404
ContinueScan = No 03249405
END 03249406
END /*-Verify SET */ 03249407
03249408
/*****************************************************************/ 03249409
/* Verify that tokens after SET and before WHERE or the end of */ 03249410
/* the statement are groups of three or four consisting of: */ 03249411
/* (1) a column name, (2) '=', and (3) a non-blank. If (3) is */ 03249412
/* ':' then verify that the fourth token is 'h'. If (3) is a */ 03249413
/* column in the table being updated, the UPDATE statement is */ 03249414
/* self-referencing and no further processing of it is required. */ 03249415
/*****************************************************************/ 03249416
IF ContinueScan = Yes THEN 03249417
DO 03249418
PARSE VAR StatementY Token StatementY 03249419
Call TraceSqlStatementScan '-6: token=<' || token || '>' 03249420
IF token = ' ' THEN 03249421
DO 03249422
ContinueScan = No 03249423
END 03249424
END 03249425
03249426
DO WHILE( (ContinueScan = Yes) & (token \= 'WHERE') ) 03249427
/***************************************************************/ 03249428
/* Verify that the current token is a column name */ 03249429
/***************************************************************/ 03249430
IF IsColumn(token creator table) = No THEN 03249431
DO 03249432
ContinueScan = No 03249433
END 03249434
/***************************************************************/ 03249435
/* Verify that the next token is '=' */ 03249436
/***************************************************************/ 03249437
IF ContinueScan = Yes THEN 03249438
DO 03249439
PARSE VAR StatementY Token StatementY 03249440
Call TraceSqlStatementScan '-7: token=<' || token || '>' 03249441
IF token \= '=' THEN 03249442
DO 03249443
ContinueScan = No 03249444
END 03249445
END 03249446
/***************************************************************/ 03249447
/* Get the next token, which is for assignment */ 03249448
/***************************************************************/ 03249449
IF ContinueScan = Yes THEN 03249450
DO /*+Verify right side of '=' */ 03249451
PARSE VAR StatementY Token StatementY 03249452
Call TraceSqlStatementScan '-8: token=<' || token || '>' 03249453
IF token = ' ' THEN 03249454
DO 03249455
ContinueScan = No 03249456
END 03249457
/***********************************************************/ 03249458
/* If the token is '(' then assignment is probably from a */ 03249459
/* subselect which we already checked so just give up */ 03249460
/***********************************************************/ 03249461
ELSE IF token = '(' THEN 03249462
DO 03249463
ContinueScan = No 03249464
END 03249465
/***********************************************************/ 03249466
/* If the token is ':' then assignment is from a host var */ 03249467
/* so verify that the next token is 'H' */ 03249468
/***********************************************************/ 03249469
ELSE IF token = ':' THEN 03249470
DO 03249471
PARSE VAR StatementY Token StatementY 03249472
Call TraceSqlStatementScan '-9: token=<' || token || '>' 03249473
IF token \= 'H' THEN 03249474
DO 03249475
ContinueScan = No 03249476
END 03249477
END 03249478
/***********************************************************/ 03249479
/* Otherwise, check if assignment is from a column in the */ 03249480
/* table being updated. If yes, flag this as a self- */ 03249481
/* referencing SQL statement (no need to check it further) */ 03249482
/***********************************************************/ 03249483
ELSE IF IsColumn(token creator table) = Yes THEN 03249484
DO 03249485
FoundMatch = Yes 03249486
ContinueScan = No 03249487
END 03249488
END /*-Verify right side of '=' */ 03249489
/***************************************************************/ 03249490
/* Get the next token in the SET clause. Expect ',' 'WHERE', */ 03249491
/* or end of statement. Otherwise, just give up. */ 03249492
/***************************************************************/ 03249493
IF ContinueScan = Yes THEN 03249494
DO 03249495
PARSE VAR StatementY Token StatementY 03249496
Call TraceSqlStatementScan '-10: token=<' || token || '>' 03249497
IF token = ' ' THEN 03249498
DO 03249499
ContinueScan = No 03249500
END 03249501
ELSE IF token \= ',' & token \= 'WHERE' THEN 03249502
DO 03249503
ContinueScan = No 03249504
END 03249505
END 03249506
END /* DO WHILE( (ContinueScan = Yes) & (token \= 'WHERE') ) */ 03249507
03249508
/*****************************************************************/ 03249509
/* If a WHERE clause was found then check if the first element */ 03249510
/* is a column in the table being updated. If yes, flag this as */ 03249511
/* a self-referencing SQL statement. Do not inspect elements */ 03249512
/* other than the first one. */ 03249513
/*****************************************************************/ 03249514
IF ContinueScan = Yes & token = 'WHERE' THEN 03249515
DO /*+Check search argument 1 */ 03249516
PARSE VAR StatementY Token StatementY 03249517
Call TraceSqlStatementScan '-10: token=<' || token || '>' 03249518
IF token = ' ' THEN 03249519
DO 03249520
ContinueScan = No 03249521
END 03249522
ELSE IF IsColumn(token creator table) = Yes THEN 03249523
DO 03249524
FoundMatch = Yes 03249525
ContinueScan = No 03249526
END 03249527
END /*-Check search argument 1 */ 03249528
03249529
/*****************************************************************/ 03249530
/* If the statement is self-referencing, report it */ 03249531
/* is a column in the table being updated. If yes, flag this as */ 03249532
/* a self-referencing SQL statement. Do not inspect elements */ 03249533
/* other than the first one. */ 03249534
/*****************************************************************/ 03249535
IF FoundMatch = Yes THEN 03249536
Call ReportMatch PlanOrPackage 03249537
03249538
Call TraceOut 'ScanOtherUpdateStatement' 03249539
Return /* ScanOtherUpdateStatement */ 03249540
03249541
03249542
ScanMergeStatement: 03249543
/*******************************************************************/ 03249544
/* Internal procedure for generateReport29 */ 03249545
/*******************************************************************/ 03249546
/* Search an assembled SQL statement for this target: */ 03249547
/* 'MERGE INTO ' */ 03249548
/* followed by TCREATOR || ' . ' || TTNAME || ' ' */ 03249549
/* or TCREATOR || ' . ' || "TTNAME" || ' ' */ 03249550
/* or "TCREATOR" || ' . ' || TTNAME || ' ' */ 03249551
/* or "TCREATOR" || ' . ' || "TTNAME" || ' ' */ 03249552
/* or TTNAME || ' ' */ 03249553
/* or "TTNAME" || ' ' */ 03249554
/* */ 03249555
/* where: */ 03249556
/* - TCREATOR and TTNAME identify a table on which a user has */ 03249557
/* the UPDATE or DELETE privileges (or both) but not the */ 03249558
/* SELECT privilege. */ 03249559
/* */ 03249560
/*******************************************************************/ 03249561
Parse Arg PlanOrPackage /* Type of object to scan for */ 03249562
03249563
Call TraceIn 'ScanMergeStatement: PlanOrPackage='PlanOrPackage 03249564
03249565
StatementY = SqlStatement || ' ' 03249566
/*****************************************************************/ 03249567
/* Cut 1: Search the MERGE statement only for tables on */ 03249568
/* which the UPDATE privilege has been granted */ 03249569
/*****************************************************************/ 03249570
If STA_UpdateAuth ^= ' ' Then 03249571
Do /*+MERGE cut 2 */ 03249572
Call TraceSqlStatementScan '-passed MERGE cut 1' 03249573
/*************************************************************/ 03249574
/* Cut 2: The SQL statment must begin with either: */ 03249575
/* 'MERGE INTO ' || TCREATOR || ' . ' TTNAME || ' ' */ 03249576
/* or 'MERGE INTO ' || TCREATOR || ' . ' "TTNAME" || ' ' */ 03249577
/* or 'MERGE INTO ' || "TCREATOR" || ' . ' TTNAME || ' ' */ 03249578
/* or 'MERGE INTO ' || "TCREATOR" || ' . ' "TTNAME" || ' ' */ 03249579
/* or 'MERGE INTO ' || TTNAME || ' ' */ 03249580
/* or 'MERGE INTO ' || "TTNAME" || ' ' */ 03249581
/*************************************************************/ 03249582
/* Check for explicitly qualified (creator.tablename) format */ 03249583
/* (undelimited creator and undelimited tablename) */ 03249584
/*************************************************************/ 03249585
sArg = 'MERGE INTO '||STA_TCreator||' . ', 03249586
||STA_TTName||' ' 03249587
Offset = INDEX(StatementY,sArg) 03249588
/*************************************************************/ 03249589
/* Check for explicitly qualified (creator.tablename) format */ 03249590
/* (undelimited creator and delimited tablename) */ 03249591
/*************************************************************/ 03249592
If Offset = 0 Then 03249593
Do 03249594
sArg = 'MERGE INTO '||STA_TCreator||' . "', 03249595
||STA_TTName||'" ' 03249596
Offset = INDEX(StatementY,sArg) 03249597
End 03249598
03249599
/*************************************************************/ 03249600
/* Check for explicitly qualified (creator.tablename) format */ 03249601
/* (delimited creator and undelimited tablename) */ 03249602
/*************************************************************/ 03249603
If Offset = 0 Then 03249604
Do 03249605
sArg = 'MERGE INTO "'||STA_TCreator||'" . ', 03249606
||STA_TTName||' ' 03249607
Offset = INDEX(StatementY,sArg) 03249608
End 03249609
03249610
/*************************************************************/ 03249611
/* Check for explicitly qualified (creator.tablename) format */ 03249612
/* (delimited creator and delimited tablename) */ 03249613
/*************************************************************/ 03249614
If Offset = 0 Then 03249615
Do 03249616
sArg = 'MERGE INTO "'||STA_TCreator||'" . "', 03249617
||STA_TTName||'" ' 03249618
Offset = INDEX(StatementY,sArg) 03249619
End 03249620
03249621
/*************************************************************/ 03249622
/* Check for implicitly qualified (tablename only) format */ 03249623
/* (undelimited tablename) */ 03249624
/*************************************************************/ 03249625
If Offset = 0, 03249626
& STA_TCreator = PlanOrPackageQualifier Then 03249627
Do 03249628
sArg = 'MERGE INTO '||STA_TTName||' ' 03249629
Offset = INDEX(StatementY,sArg) 03249630
End 03249631
03249632
/*************************************************************/ 03249633
/* Check for implicitly qualified (tablename only) format */ 03249634
/* (delimited tablename) */ 03249635
/*************************************************************/ 03249636
If Offset = 0, 03249637
& STA_TCreator = PlanOrPackageQualifier Then 03249638
Do 03249639
sArg = 'MERGE INTO "'||STA_TTName||'" ' 03249640
Offset = INDEX(StatementY,sArg) 03249641
End 03249642
03249643
If Offset > 0 Then 03249644
Do /*+MERGE cut 3 */ 03249645
Call TraceSqlStatementScan '-passed MERGE cut 2' 03249646
/*********************************************************/ 03249647
/* Match found: Report it */ 03249648
/*********************************************************/ 03249649
Call ReportMatch PlanOrPackage 03249650
End /* If Offset > 0 Then */ /*-MERGE cut 3 */ 03249651
End /*-MERGE cut 2 */ 03249652
03249653
Call TraceOut 'ScanMergeStatement' 03249654
Return /* ScanMergeStatement */ 03249655
03249656
03249657
ScanForDeleteWithSelectStatement: 03249658
/*******************************************************************/ 03249659
/* Internal procedure for generateReport29 */ 03249660
/*******************************************************************/ 03249661
/* Search an assembled SQL statement for this target: */ 03249662
/* 'DELETE FROM ' */ 03249663
/* followed by TCREATOR || ' . ' || TTNAME || ' ' */ 03249664
/* or TCREATOR || ' . ' || "TTNAME" || ' ' */ 03249665
/* or "TCREATOR" || ' . ' || TTNAME || ' ' */ 03249666
/* or "TCREATOR" || ' . ' || "TTNAME" || ' ' */ 03249667
/* or TTNAME || ' ' */ 03249668
/* or "TTNAME" || ' ' */ 03249669
/* followed by ' SELECT ' */ 03249670
/* followed by ' FROM '|| TCREATOR ||' . '|| TTNAME ||' ' */ 03249671
/* or ' FROM '|| TCREATOR ||' . '||"TTNAME"||' ' */ 03249672
/* or ' FROM '||"TCREATOR"||' . '|| TTNAME ||' ' */ 03249673
/* or ' FROM '||"TCREATOR"||' . '||"TTNAME"||' ' */ 03249674
/* or ' FROM '|| TTNAME || ' ' */ 03249675
/* or ' FROM '||"TTNAME"|| ' ' */ 03249676
/* */ 03249677
/* where: */ 03249678
/* - TCREATOR and TTNAME identify a table on which a user has */ 03249679
/* the UPDATE or DELETE privileges (or both) but not the */ 03249680
/* SELECT privilege. */ 03249681
/* */ 03249682
/*******************************************************************/ 03249683
Parse Arg PlanOrPackage /* Type of object to scan for */ 03249684
03249685
Call TraceIn 'ScanForDeleteWithSelectStatement:', 03249686
'PlanOrPackage='PlanOrPackage 03249687
03249688
StatementY = SqlStatement || ' ' 03249689
FoundMatch = No 03249690
/*****************************************************************/ 03249691
/* Cut 1: Search the DELETE statement only for tables on */ 03249692
/* which the DELETE privilege has been granted */ 03249693
/*****************************************************************/ 03249694
If STA_DeleteAuth ^= ' ' Then 03249695
Do /*+DELETE cut 2 */ 03249696
Call TraceSqlStatementScan '-passed DELETE cut 1' 03249697
/*************************************************************/ 03249698
/* Cut 2: The SQL statment must begin with either: */ 03249699
/* 'DELETE FROM ' || TCREATOR || ' . ' TTNAME || ' ' */ 03249700
/* or 'DELETE FROM ' || TCREATOR || ' . ' "TTNAME" || ' ' */ 03249701
/* or 'DELETE FROM ' || "TCREATOR" || ' . ' TTNAME || ' ' */ 03249702
/* or 'DELETE FROM ' || "TCREATOR" || ' . ' "TTNAME" || ' ' */ 03249703
/* or 'DELETE FROM ' || TTNAME || ' ' */ 03249704
/* or 'DELETE FROM ' || "TTNAME" || ' ' */ 03249705
/*************************************************************/ 03249706
/* Check for explicitly qualified (creator.tablename) format */ 03249707
/* (undelimited creator and undelimited tablename) */ 03249708
/*************************************************************/ 03249709
sArg = 'DELETE FROM '||STA_TCreator||' . ', 03249710
||STA_TTName||' ' 03249711
Offset = INDEX(StatementY,sArg) 03249712
03249713
/*************************************************************/ 03249714
/* Check for explicitly qualified (creator.tablename) format */ 03249715
/* (undelimited creator and delimited tablename) */ 03249716
/*************************************************************/ 03249717
If Offset = 0 Then 03249718
Do 03249719
sArg = 'DELETE FROM '||STA_TCreator||' . "', 03249720
||STA_TTName||'" ' 03249721
Offset = INDEX(StatementY,sArg) 03249722
End 03249723
03249724
/*************************************************************/ 03249725
/* Check for explicitly qualified (creator.tablename) format */ 03249726
/* (delimited creator and undelimited tablename) */ 03249727
/*************************************************************/ 03249728
If Offset = 0 Then 03249729
Do 03249730
sArg = 'DELETE FROM "'||STA_TCreator||'" . ', 03249731
||STA_TTName||' ' 03249732
Offset = INDEX(StatementY,sArg) 03249733
End 03249734
03249735
/*************************************************************/ 03249736
/* Check for explicitly qualified (creator.tablename) format */ 03249737
/* (delimited creator and delimited tablename) */ 03249738
/*************************************************************/ 03249739
If Offset = 0 Then 03249740
Do 03249741
sArg = 'DELETE FROM "'||STA_TCreator||'" . "', 03249742
||STA_TTName||'" ' 03249743
Offset = INDEX(StatementY,sArg) 03249744
End 03249745
03249746
/*************************************************************/ 03249747
/* Check for implicitly qualified (tablename only) format */ 03249748
/* (undelimited tablename) */ 03249749
/*************************************************************/ 03249750
If Offset = 0, 03249751
& STA_TCreator = PlanOrPackageQualifier Then 03249752
Do 03249753
sArg = 'DELETE FROM '||STA_TTName||' ' 03249754
Offset = INDEX(StatementY,sArg) 03249755
End 03249756
03249757
/*************************************************************/ 03249758
/* Check for implicitly qualified (tablename only) format */ 03249759
/* (delimited tablename) */ 03249760
/*************************************************************/ 03249761
If Offset = 0, 03249762
& STA_TCreator = PlanOrPackageQualifier Then 03249763
Do 03249764
sArg = 'DELETE FROM "'||STA_TTName||'" ' 03249765
Offset = INDEX(StatementY,sArg) 03249766
End 03249767
03249768
If Offset > 0 Then 03249769
Do /*+DELETE cut 3 */ 03249770
Call TraceSqlStatementScan '-passed DELETE cut 2' 03249771
/*********************************************************/ 03249772
/* Cut 3: The SQL statement must continue with */ 03249773
/* ' SELECT ' */ 03249774
/*********************************************************/ 03249775
Offset = Offset + Length(sArg) + 1 03249776
StatementY = Substr(StatementY,Offset) 03249777
sArg = ' SELECT ' 03249778
Offset = INDEX(StatementY,sArg) 03249779
If Offset > 0 Then 03249780
Do /*+DELETE cut 4 */ 03249781
Call TraceSqlStatementScan '-passed DELETE cut 3' 03249782
/*****************************************************/ 03249783
/* Cut 4: SQL statement must continue with */ 03249784
/* ' FROM '|| TCREATOR ||' . '|| TTNAME ||' ' */ 03249785
/* or ' FROM '|| TCREATOR ||' . '||"TTNAME"||' ' */ 03249786
/* or ' FROM '||"TCREATOR"||' . '|| TTNAME ||' ' */ 03249787
/* or ' FROM '||"TCREATOR"||' . '||"TTNAME"||' ' */ 03249788
/* or ' FROM '|| TNAME ||' ' */ 03249789
/* or ' FROM '||"TNAME"||' ' */ 03249790
/*****************************************************/ 03249791
/* Check for explicitly qualified (creator.tablename)*/ 03249792
/* format */ 03249793
/* (undelimited creator and undelimited tablename) */ 03249794
/*****************************************************/ 03249795
Offset = Offset + Length(sArg) + 1 03249796
StatementY = Substr(StatementY,Offset) 03249797
sArg = ' FROM '||STA_TCreator||' . ', 03249798
||STA_TTName||' ' 03249799
Offset = INDEX(StatementY,sArg) 03249800
/*****************************************************/ 03249801
/* Check for explicitly qualified (creator.tablename)*/ 03249802
/* format */ 03249803
/* (undelimited creator and delimited tablename) */ 03249804
/*****************************************************/ 03249805
If Offset = 0 Then 03249806
Do 03249807
sArg = ' FROM '||STA_TCreator||' . "', 03249808
||STA_TTName||'" ' 03249809
Offset = INDEX(StatementY,sArg) 03249810
End 03249811
/*****************************************************/ 03249812
/* Check for explicitly qualified (creator.tablename)*/ 03249813
/* format */ 03249814
/* (delimited creator and undelimited tablename) */ 03249815
/*****************************************************/ 03249816
If Offset = 0 Then 03249817
Do 03249818
sArg = ' FROM "'||STA_TCreator||'" . ', 03249819
||STA_TTName||' ' 03249820
Offset = INDEX(StatementY,sArg) 03249821
End 03249822
/*****************************************************/ 03249823
/* Check for explicitly qualified (creator.tablename)*/ 03249824
/* format */ 03249825
/* (delimited creator and delimited tablename) */ 03249826
/*****************************************************/ 03249827
If Offset = 0 Then 03249828
Do 03249829
sArg = ' FROM "'||STA_TCreator||'" . "', 03249830
||STA_TTName||'" ' 03249831
Offset = INDEX(StatementY,sArg) 03249832
End 03249833
/*****************************************************/ 03249834
/* Check for implicitly qualified (tablename only) */ 03249835
/* format (undelimited tablename) */ 03249836
/*****************************************************/ 03249837
If Offset = 0, 03249838
& STA_TCreator = PlanOrPackageQualifier Then 03249839
Do 03249840
sArg = ' FROM '||STA_TTName||' ' 03249841
Offset = INDEX(StatementY,sArg) 03249842
End 03249843
/*****************************************************/ 03249844
/* Check for implicitly qualified (tablename only) */ 03249845
/* format (delimited tablename) */ 03249846
/*****************************************************/ 03249847
If Offset = 0, 03249848
& STA_TCreator = PlanOrPackageQualifier Then 03249849
Do 03249850
sArg = ' FROM "'||STA_TTName||'" ' 03249851
Offset = INDEX(StatementY,sArg) 03249852
End 03249853
03249854
If Offset > 0 Then 03249855
Do /*+DELETE cut 5 */ 03249856
Call TraceSqlStatementScan, 03249857
'-passed DELETE cut 4' 03249858
/*************************************************/ 03249859
/* Match found: Report it */ 03249860
/*************************************************/ 03249861
FoundMatch = Yes 03249862
Call ReportMatch PlanOrPackage 03249863
End /*-DELETE cut 5 */ 03249864
End /*-DELETE cut 4 */ 03249865
End /*-DELETE cut 3 */ 03249866
End /*-DELETE cut 2 */ 03249867
03249868
Call TraceOut 'ScanForDeleteWithSelectStatement' 03249869
Return /* ScanForDeleteWithSelectStatement */ 03249870
03249871
03249872
ScanOtherDeleteStatement: 03249873
/*******************************************************************/ 03249874
/* Internal procedure for generateReport29 */ 03249875
/*******************************************************************/ 03249876
/* Search an assembled SQL statement for this target: */ 03249877
/* 'DELETE FROM ' */ 03249878
/* followed by TCREATOR || ' . ' || TTNAME || ' ' */ 03249879
/* or TCREATOR || ' . ' || "TTNAME" || ' ' */ 03249880
/* or "TCREATOR" || ' . ' || TTNAME || ' ' */ 03249881
/* or "TCREATOR" || ' . ' || "TTNAME" || ' ' */ 03249882
/* or TTNAME || ' ' */ 03249883
/* or "TTNAME" || ' ' */ 03249884
/* followed by ' WHERE ' || COLNAME1 || ' = ' */ 03249885
/* */ 03249886
/* where: */ 03249887
/* - TCREATOR and TTNAME identify a table on which a user has */ 03249888
/* the UPDATE or DELETE privileges (or both) but not the */ 03249889
/* SELECT privilege. */ 03249890
/* - COLNAME1 and COLNAME2 are columns in TTNAME */ 03249891
/* */ 03249892
/*******************************************************************/ 03249893
Parse Arg PlanOrPackage /* Type of object to scan for */ 03249894
03249895
Call TraceIn 'ScanOtherDeleteStatement: PlanOrPackage='PlanOrPackage03249896
03249897
StatementY = SqlStatement || ' ' 03249898
ContinueScan = Yes 03249899
FoundMatch = No 03249900
FoundWHERE = No 03249901
Creator = '' 03249902
Table = '' 03249903
03249904
03249905
PARSE VAR StatementY Token StatementY 03249906
Call TraceSqlStatementScan '-1: token=<' || token || '>' 03249907
/*****************************************************************/ 03249908
/* Verify that the first token is DELETE */ 03249909
/*****************************************************************/ 03249910
IF token \= 'DELETE' THEN 03249911
DO 03249912
Call TraceSqlStatementScan '-Not a DELETE statement' 03249913
ContinueScan = No 03249914
END 03249915
03249916
/*****************************************************************/ 03249917
/* Verify that the next token is 'FROM' */ 03249918
/*****************************************************************/ 03249919
IF ContinueScan = Yes THEN 03249920
DO 03249921
PARSE VAR StatementY Token StatementY 03249922
Call TraceSqlStatementScan '-2: token=<' || token || '>' 03249923
IF token \= 'FROM' THEN 03249924
DO 03249925
Call TraceSqlStatementScan '-No FROM after DELETE' 03249926
ContinueScan = No 03249927
END 03249928
END 03249929
03249930
/*****************************************************************/ 03249931
/* Verify that the next token(s) are 'creator.table' or 'table' */ 03249932
/*****************************************************************/ 03249933
IF ContinueScan = Yes THEN 03249934
DO /*+Verify creator and table name */ 03249935
PARSE VAR StatementY Token StatementY 03249936
Call TraceSqlStatementScan '-3: token=<' || token || '>' 03249937
IF token = ' ' THEN 03249938
DO 03249939
Call TraceSqlStatementScan '-No creator or table name' 03249940
ContinueScan = No 03249941
END 03249942
/*************************************************************/ 03249943
/* Token 3 is either the creator name or the table name */ 03249944
/*************************************************************/ 03249945
ELSE 03249946
DO /*+Check tokens 3, 4, and 5 */ 03249947
Name = token 03249948
PARSE VAR StatementY Token StatementY 03249949
Call TraceSqlStatementScan '-4: token=<' || token || '>' 03249950
IF token = ' ' THEN 03249951
DO 03249952
ContinueScan = No 03249953
END 03249954
/*********************************************************/ 03249955
/* If token 4 is '.' then token 3 was the creator name */ 03249956
/*********************************************************/ 03249957
ELSE IF token = '.' THEN 03249958
DO /*+Token 4 is '.' */ 03249959
Creator = Name 03249960
/*****************************************************/ 03249961
/* And token 5 is the table name */ 03249962
/*****************************************************/ 03249963
PARSE VAR StatementY Token StatementY 03249964
Call TraceSqlStatementScan '-5: token=<' || token || '>'03249965
IF token = ' ' THEN 03249966
DO 03249967
ContinueScan = No 03249968
END 03249969
ELSE 03249970
DO 03249971
Table = token 03249972
END 03249973
END /*-Token 5 is '.' */ 03249974
/*********************************************************/ 03249975
/* If token 4 is 'WHERE' then token 3 is the table name */ 03249976
/* The creator name is the BIND QUALIFIER */ 03249977
/*********************************************************/ 03249978
ELSE IF token = 'WHERE' THEN 03249979
DO /*+Token 4 is 'WHERE' */ 03249980
FoundWHERE = Yes 03249981
Creator = PlanOrPackageQualifier 03249982
Table = Name 03249983
END /*-Token 4 is 'WHERE' */ 03249984
/*********************************************************/ 03249985
/* If token 4 is not '.' or 'WHERE' then token 3 is the */ 03249986
/* table name. The creator name is the BIND QUALIFIER */ 03249987
/*********************************************************/ 03249988
ELSE 03249989
DO /*+Token 4 is not '.' */ 03249990
Creator = PlanOrPackageQualifier 03249991
Table = Name 03249992
END /*-Token 4 is not '.' */ 03249993
END /*-Check tokens 3, 4, and 5 */ 03249994
END /*-Verify creator and table name */ 03249995
03249996
/*****************************************************************/ 03249997
/* Verify that the creator and table name in the statement match */ 03249998
/* the creator and name of the target table */ 03249999
/*****************************************************************/ 03250000
IF ContinueScan = Yes THEN 03250001
DO /*+Verify target table match */ 03250002
IF (Creator = STA_TCreator & Table = STA_TTName), 03250003
| (Creator = '"'STA_TCreator'"' & Table = '"'STA_TTName'"'), 03250004
| (Creator = '"'STA_TCreator'"' & Table = STA_TTName), 03250005
| (Creator = STA_TCreator & Table = '"'STA_TTName'"') THEN 03250006
DO 03250007
ContinueScan = Yes 03250008
END 03250009
ELSE 03250010
DO 03250011
ContinueScan = No 03250012
END 03250013
END /*-Verify target table match */ 03250014
03250015
/*****************************************************************/ 03250016
/* If a 'WHERE' has not yet been located, verify that the next */ 03250017
/* token is 'WHERE' */ 03250018
/*****************************************************************/ 03250019
IF ContinueScan = Yes & FoundWHERE = No THEN 03250020
DO /*+Verify WHERE */ 03250021
PARSE VAR StatementY Token StatementY 03250022
Call TraceSqlStatementScan '-6: token=<' || token || '>' 03250023
IF token \= 'WHERE' THEN 03250024
DO 03250025
ContinueScan = No 03250026
END 03250027
END /*-Verify WHERE */ 03250028
03250029
/*****************************************************************/ 03250030
/* If a WHERE clause was found then check if the first element */ 03250031
/* is a column in the table being updated. If yes, flag this as */ 03250032
/* a self-referencing SQL statement. Do not inspect elements */ 03250033
/* other than the first one. */ 03250034
/*****************************************************************/ 03250035
IF ContinueScan = Yes THEN 03250036
DO /*+Check search argument 1 */ 03250037
PARSE VAR StatementY Token StatementY 03250038
Call TraceSqlStatementScan '-7: token=<' || token || '>' 03250039
IF token = ' ' THEN 03250040
DO 03250041
ContinueScan = No 03250042
END 03250043
ELSE IF IsColumn(token creator table) = Yes THEN 03250044
DO 03250045
FoundMatch = Yes 03250046
ContinueScan = No 03250047
END 03250048
END /*-Check search argument 1 */ 03250049
03250050
/*****************************************************************/ 03250051
/* If the statement is self-referencing, report it */ 03250052
/* is a column in the table being updated. If yes, flag this as */ 03250053
/* a self-referencing SQL statement. Do not inspect elements */ 03250054
/* other than the first one. */ 03250055
/*****************************************************************/ 03250056
IF FoundMatch = Yes THEN 03250057
Call ReportMatch PlanOrPackage 03250058
03250059
Call TraceOut 'ScanOtherDeleteStatement' 03250060
Return /* ScanOtherDeleteStatement */ 03250061
03250062
03250063
IsColumn: 03250064
/*******************************************************************/ 03250065
/* Internal procedure for generateReport29 */ 03250066
/*******************************************************************/ 03250067
/* Returns Yes if the value of 'String' is a column in table */ 03250068
/* TCREATOR.TTNAME */ 03250069
/*******************************************************************/ 03250070
Parse Arg String TbCreator TbName 03250071
03250072
Call TraceIn 'IsColumn:', 03250073
'String='String',', 03250074
'TbCreator='TbCreator',', 03250075
'TbName='TbName 03250076
03250077
/****************************************************************** 03250078
* If string contains an apostrophe, disqualify it as a column name 03250079
******************************************************************/ 03250080
If INDEX(String,"'") > 0 Then 03250081
Do 03250082
Answer = No 03250083
End 03250084
/****************************************************************** 03250085
* If string is too short or too long, it is not a column name 03250086
******************************************************************/ 03250087
Else if Length(String) < 1 | Length(String) > 30 Then 03250088
Do 03250089
Answer = No 03250090
End 03250091
/****************************************************************** 03250092
* Otherwise, check to see if the string is the name of a column 03250093
******************************************************************/ 03250094
Else 03250095
Do 03250096
/************************************************************** 03250097
* Remove delimiters, if any 03250098
**************************************************************/ 03250099
String = STRIP(String,,'"') /* remove delimiters, if any */ 03250100
03250101
SQLStmt = "SELECT STRIP(NAME) ",03250102
" FROM SYSIBM.SYSCOLUMNS ",03250103
" WHERE NAME = '"String"' ",03250104
" AND TBCREATOR = '"TbCreator"' ",03250105
" AND TBNAME = '"TbName"' " 03250106
03250107
Function = "EXECSQL DECLARE C6 CURSOR FOR S6" 03250108
ADDRESS DSNREXX Function 03250109
Call Show_SQLCA 03250110
03250111
Function = "EXECSQL PREPARE S6 FROM :SQLSTMT" 03250112
ADDRESS DSNREXX Function 03250113
Call Show_SQLCA 03250114
03250115
Function = "EXECSQL OPEN C6" 03250116
ADDRESS DSNREXX Function 03250117
Call Show_SQLCA 03250118
03250119
Function = "EXECSQL FETCH C6 INTO ",03250120
":ColumnName " 03250121
ADDRESS DSNREXX Function 03250122
Call Show_SQLCA 03250123
03250124
If SQLCODE = 0 Then 03250125
Answer = Yes 03250126
Else 03250127
Answer = No 03250128
03250129
Function = "EXECSQL CLOSE C6" 03250130
ADDRESS DSNREXX Function 03250131
Call Show_SQLCA 03250132
End 03250133
03250134
Call TraceOut 'IsColumn='Answer 03250135
Return Answer /* IsColumn */ 03250136
03250137
03250138
HasSysadmAuth: 03250139
/*******************************************************************/ 03250140
/* Internal procedure for generateReport29 */ 03250141
/*******************************************************************/ 03250142
/* Returns Yes if 'AuthId' has SYSADM authority. */ 03250143
/*******************************************************************/ 03250144
Parse Arg AuthId 03250145
03250146
Call TraceIn 'HasSysadmAuth: AuthId='AuthId 03250147
03250148
SQLStmt = "SELECT SYSADMAUTH ",03250149
" FROM SYSIBM.SYSUSERAUTH ",03250150
" WHERE (GRANTEE = '"AuthId"' ",03250151
" OR GRANTOR = '"AuthId"') ",03250152
" AND (SYSADMAUTH = 'G' ",03250153
" OR SYSADMAUTH = 'Y') " 03250154
03250155
Function = "EXECSQL DECLARE C7 CURSOR FOR S7" 03250156
ADDRESS DSNREXX Function 03250157
Call Show_SQLCA 03250158
03250159
Function = "EXECSQL PREPARE S7 FROM :SQLSTMT" 03250160
ADDRESS DSNREXX Function 03250161
Call Show_SQLCA 03250162
03250163
Function = "EXECSQL OPEN C7" 03250164
ADDRESS DSNREXX Function 03250165
Call Show_SQLCA 03250166
03250167
Function = "EXECSQL FETCH C7 INTO ",03250168
":ColumnName " 03250169
ADDRESS DSNREXX Function 03250170
Call Show_SQLCA 03250171
03250172
If SQLCODE = 0 Then 03250173
Answer = Yes 03250174
Else 03250175
Answer = No 03250176
03250177
Function = "EXECSQL CLOSE C7" 03250178
ADDRESS DSNREXX Function 03250179
Call Show_SQLCA 03250180
03250181
Call TraceOut 'HasSysadmAuth='Answer 03250182
Return Answer /* HasSysadmAuth */ 03250183
03250184
03250185
HasSelectAuth: 03250186
/*******************************************************************/ 03250187
/* Internal procedure for generateReport29 */ 03250188
/*******************************************************************/ 03250189
/* Returns Yes if 'AuthId' or PUBLIC has SELECT authorization */ 03250190
/* TbCreator.TbName */ 03250191
/*******************************************************************/ 03250192
Parse Arg AuthId TbCreator TbName 03250193
03250194
Call TraceIn 'HasSelectAuth:', 03250195
'AuthId='AuthId',', 03250196
'TbCreator='TbCreator',', 03250197
'TbName='TbName 03250198
03250199
SQLStmt = "SELECT SELECTAUTH ",03250200
" FROM SYSIBM.SYSTABAUTH ",03250201
" WHERE (GRANTEE IN( '"AuthId"', 'PUBLIC', 'PUBLIC*' ) ",03250202
" OR GRANTOR IN( 'PUBLIC', 'PUBLIC*' ) ",03250203
" ) ",03250204
" AND SELECTAUTH IN( 'G', 'Y' ) ",03250205
" AND TCREATOR = '"TbCreator"' ",03250206
" AND TTNAME = '"TbName"' " 03250207
03250208
Function = "EXECSQL DECLARE C8 CURSOR FOR S8" 03250209
ADDRESS DSNREXX Function 03250210
Call Show_SQLCA 03250211
03250212
Function = "EXECSQL PREPARE S8 FROM :SQLSTMT" 03250213
ADDRESS DSNREXX Function 03250214
Call Show_SQLCA 03250215
03250216
Function = "EXECSQL OPEN C8" 03250217
ADDRESS DSNREXX Function 03250218
Call Show_SQLCA 03250219
03250220
Function = "EXECSQL FETCH C8 INTO ",03250221
":ColumnName " 03250222
ADDRESS DSNREXX Function 03250223
Call Show_SQLCA 03250224
03250225
If SQLCODE = 0 Then 03250226
Answer = Yes 03250227
Else 03250228
Answer = No 03250229
03250230
Function = "EXECSQL CLOSE C8" 03250231
ADDRESS DSNREXX Function 03250232
Call Show_SQLCA 03250233
03250234
Call TraceOut 'HasSelectAuth='Answer 03250235
Return Answer /* HasSelectAuth */ 03250236
03250237
03250238
ReportMatch: 03250239
/*******************************************************************/ 03250240
/* Internal procedure for generateReport29 */ 03250241
/*******************************************************************/ 03250242
/* When a package or plan contains self-referencing SQL for a */ 03250243
/* table on which a user has the UPDATE or DELETE privileges */ 03250244
/* (or both) but not the SELECT privilege, add it to the report. */ 03250245
/*******************************************************************/ 03250246
Parse Arg PlanOrPackage /* Type of object reported on */ 03250247
03250248
Call TraceIn 'ReportMatch: PlanOrPackage='PlanOrPackage 03250249
03250250
If PlanOrPackage = 'Package' Then 03250251
Do 03250252
Line.1 = 'PACKAGE:', 03250253
STA_CollID || '.' || STA_Grantee || '.' || STA_ConToken03250254
End 03250255
Else 03250256
Do 03250257
Line.1 = ' PLAN:' STA_Grantee 03250258
End 03250259
03250260
/****************************************************************** 03250261
* Truncate the SQL statement if it exceeds the max output length 03250262
******************************************************************/ 03250263
If LENGTH(SqlStatement) > 265 Then 03250264
SqlStatement = Substr(SqlStatement,1,265) 03250265
03250266
Line.2 = ' OWNER:' PlanOrPackageOwner 03250267
Line.3 = ' QUAL:' PlanOrPackageQualifier 03250268
Line.4 = ' TABLE:' STA_TCreator || '.' || STA_TTName 03250269
Line.5 = ' STMT:' SqlStatement 03250270
Line.6 = ' ' 03250271
03250272
'EXECIO' 6 'DISKW REPORT29 (STEM Line.' 03250273
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03250274
, 'EXECIO DISKW REPORT29 rc=' rc 03250275
03250276
Drop Line. 03250277
03250278
Call TraceOut 'ReportMatch' 03250279
Return /* ReportMatch */ 03250280
03250281
03250282
Show_SQLCA: Procedure, 03250283
/*******************************************************************/,03250284
/* Internal procedure for generateReport29 */,03250285
/*******************************************************************/,03250286
/* Routine to display the SQLCA */,03250287
/*******************************************************************/,03250288
Expose Function SQLStmt, 03250289
SQLCODE SQLERRMC SQLERRP, 03250290
SQLERRD. SQLWARN. SQLSTATE 03250291
03250292
If SQLCODE = 0 Then 03250293
Return 03250294
If SQLCODE = 100 Then 03250295
Return 03250296
Say SQLStmt 03250297
Say Function 03250298
Say 'SQLCODE = 'SQLCODE 03250299
Say 'SQLERRMC = 'SQLERRMC 03250300
Say 'SQLERRP = 'SQLERRP 03250301
Say 'SQLERRD = 'SQLERRD.1',', 03250302
|| SQLERRD.2',', 03250303
|| SQLERRD.3',', 03250304
|| SQLERRD.4',', 03250305
|| SQLERRD.5',', 03250306
|| SQLERRD.6',' 03250307
Say 'SQLWARN = 'SQLWARN.0',', 03250308
|| SQLWARN.1',', 03250309
|| SQLWARN.2',', 03250310
|| SQLWARN.3',', 03250311
|| SQLWARN.4',', 03250312
|| SQLWARN.5',', 03250313
|| SQLWARN.6',', 03250314
|| SQLWARN.7',', 03250315
|| SQLWARN.8',', 03250316
|| SQLWARN.9',', 03250317
|| SQLWARN.10 03250318
Say 'SQLSTATE = 'SQLSTATE 03250319
If SQLCODE < 0 Then 03250320
Do 03250321
EXIT Finis(12) 03250322
End 03250323
Return 03250324
03250325
03250326
TraceIn: 03250327
/*******************************************************************/ 03250328
/* Internal procedure for generateReport29 */ 03250329
/*******************************************************************/ 03250330
/* Traces entry into the calling routine */ 03250331
/* */ 03250332
/* When report 29 processing exceeds 6 hours elapsed time, if */ 03250333
/* tracing is disabled (TraceLevel = 0), this routine will */ 03250334
/* activate level 1 (call flow) tracing for possible diagnostic */ 03250335
/* use. Such tracing, if activated, will first call the */ 03250336
/* TracePlanOrPackageName routine to display the current package */ 03250337
/* or plan, and be terminated by the -next- call to the */ 03250338
/* TracePlanOrPackageName routine (which will occur when the */ 03250339
/* next package or plan is selected for analysis. Tracing of a */ 03250340
/* long run is retriggered every 6 hours thereafter. */ 03250341
/* */ 03250342
/*******************************************************************/ 03250343
Parse Arg RoutineName 03250344
03250345
If TIME('E') > 21600 /* 6 hours elasped, in seconds */,03250346
& TraceLevel = 0 Then 03250347
Do 03250348
TraceLevel = 1 03250349
Say '#########################################################' 03250350
Say '########## Report 29 long run trace initiated ###########' 03250351
Say '#########################################################' 03250352
Call TracePlanOrPackageName 03250353
LongRunTracing = Yes 03250354
End 03250355
03250356
If TraceLevel > 0 Then 03250357
Do 03250358
Say DepthIndicator 'Enter' RoutineName 03250359
DepthIndicator = '=' || DepthIndicator 03250360
End 03250361
03250362
Return /* TraceIn */ 03250363
03250364
03250365
TraceOut: 03250366
/*******************************************************************/ 03250367
/* Internal procedure for generateReport29 */ 03250368
/*******************************************************************/ 03250369
/* Traces exit from the calling routine */ 03250370
/*******************************************************************/ 03250371
Parse Arg RoutineName 03250372
03250373
If TraceLevel > 0 Then 03250374
Do 03250375
DepthIndicator = Substr(DepthIndicator,2) 03250376
Say DepthIndicator 'Leave' RoutineName 03250377
End 03250378
03250379
Return /* TraceOut */ 03250380
03250381
03250382
TracePlanOrPackageName: 03250383
/*******************************************************************/ 03250384
/* Internal procedure for generateReport29 */ 03250385
/*******************************************************************/ 03250386
/* Routine to trace current package or plan */ 03250387
/*******************************************************************/ 03250388
03250389
If TraceLevel > 0 Then 03250390
Do 03250391
DataDepthIndicator = Copies('.',Length(DepthIndicator)-1) 03250392
If SYMBOL('STA_CollID') = 'VAR' Then 03250393
Do 03250394
Say DataDepthIndicator 'STA_CollID :' STA_CollID 03250395
Say DataDepthIndicator 'STA_Grantee :' STA_Grantee 03250396
Say DataDepthIndicator 'STA_Contoken:' STA_Contoken 03250397
Say DataDepthIndicator 'STA_TCreator:' STA_TCreator 03250398
Say DataDepthIndicator 'STA_TTName :' STA_TTName 03250399
End 03250400
Else 03250401
Do 03250402
Say DataDepthIndicator 'STA_Grantee :' STA_Grantee 03250403
Say DataDepthIndicator 'STA_TCreator:' STA_TCreator 03250404
Say DataDepthIndicator 'STA_TTName :' STA_TTName 03250405
End 03250406
Drop DataDepthIndicator 03250407
End 03250408
03250409
If LongRunTracing = Yes Then 03250410
Do 03250411
LongRunTracing = No 03250412
TraceLevel = 0 03250413
Say '#########################################################' 03250414
Say '########## Report 29 Long run trace terminated ##########' 03250415
Say '#########################################################' 03250416
x = TIME('R') /* Clear the elapsed time */ 03250417
End 03250418
03250419
Return /* TracePlanOrPackageName */ 03250420
03250421
03250422
TraceSqlStmtBuild: 03250423
/*******************************************************************/ 03250424
/* Internal procedure for generateReport29 */ 03250425
/*******************************************************************/ 03250426
/* Routine to trace reconstruction of an SQL statement */ 03250427
/*******************************************************************/ 03250428
Parse Arg TaskName 03250429
03250430
If TraceLevel > 1 Then 03250431
Do 03250432
DepthIndicator = '=' || DepthIndicator 03250433
Say DepthIndicator TaskName 03250434
03250435
If TraceLevel > 2 Then 03250436
Do 03250437
DataDepthIndicator = Copies('.',Length(DepthIndicator)) 03250438
If SYMBOL('SPS_StmtNoI') = 'VAR' Then 03250439
Do 03250440
Say DataDepthIndicator 'SPS_StmtNoI :' SPS_StmtNoI 03250441
Say DataDepthIndicator 'SPS_SectNoI :' SPS_SectNoI 03250442
Say DataDepthIndicator 'SPS_SeqNo :' SPS_SeqNo 03250443
Say DataDepthIndicator 'SPS_Stmt :' SPS_Stmt 03250444
End 03250445
Else 03250446
Do 03250447
Say DataDepthIndicator 'SS_StmtNoI :' SS_StmtNoI 03250448
Say DataDepthIndicator 'SS_SectNoI :' SS_SectNoI 03250449
Say DataDepthIndicator 'SS_SeqNo :' SS_SeqNo 03250450
Say DataDepthIndicator 'SS_Stmt :' SS_Stmt 03250451
End 03250452
Say DataDepthIndicator 'SqlStatement:' SqlStatement 03250453
Drop DataDepthIndicator 03250454
End 03250455
DepthIndicator = Substr(DepthIndicator,2) 03250456
End 03250457
03250458
Return /* TraceSqlStmtBuild */ 03250459
03250460
03250461
TraceSqlStatementScan: 03250462
/*******************************************************************/ 03250463
/* Internal procedure for generateReport29 */ 03250464
/*******************************************************************/ 03250465
/* Routine to trace scanning of an SQL statement */ 03250466
/*******************************************************************/ 03250467
Parse Arg TaskName 03250468
03250469
If TraceLevel > 1 Then 03250470
Do 03250471
DepthIndicator = '=' || DepthIndicator 03250472
Say DepthIndicator TaskName 03250473
03250474
If TraceLevel > 2 & Index(TaskName,'cut 0') > 0 Then 03250475
Do 03250476
DataDepthIndicator = Copies('.',Length(DepthIndicator)) 03250477
Say DataDepthIndicator 'STA_CollID :' STA_CollID 03250478
Say DataDepthIndicator 'STA_Grantee :' STA_Grantee 03250479
Say DataDepthIndicator 'STA_TCreator :' STA_TCreator 03250480
Say DataDepthIndicator 'STA_TTName :' STA_TTName 03250481
Say DataDepthIndicator 'STA_DeleteAuth:' STA_DeleteAuth 03250482
Say DataDepthIndicator 'STA_UpdateAuth:' STA_UpdateAuth 03250483
Say DataDepthIndicator 'PlPkgQualifier:', 03250484
PlanOrPackageQualifier 03250485
Drop DataDepthIndicator 03250486
End 03250487
DepthIndicator = Substr(DepthIndicator,2) 03250488
End 03250489
03250490
Return /* TraceSqlStatementScan */ 03250491
03250492
03250493
generateReport29End: 03250494
drop EBCDIC Unicode 03250495
'EXECIO 0 DISKW REPORT29 (FINIS' 03250496
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03250497
, 'EXECIO DISKW REPORT29 CLOSE rc=' rc 03250498
03250499
CALL IntMsg, 03250500
' Report 29 completed' 03250501
RETURN /* end GenerateReport29 */ 03250502
03250503
03250504
generateReport30: 03250505
/*****************************************************************/ 03250506
/* Generates premigration report 30 */ 03250507
/* Report existence of obsolete (AMT-based) MQSeries functions */ 03250508
/*****************************************************************/ 03250509
"EXECIO 0 DISKW REPORT30 (OPEN" 03250510
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03250511
, 'EXECIO DISKW REPORT30 OPEN rc=' rc 03250512
03250513
TEMP.1 = "=== REPORT 30" COPIES('=',58) 03250514
TEMP.2 = "= The DB2 MQSeries functions listed below are", 03250515
"deprecated in DB2 V8 and =" 03250516
TEMP.3 = "= V9 and are obsolete in V10. ", 03250517
" =" 03250518
TEMP.4 = "= ", 03250519
" =" 03250520
TEMP.5 = "= These DB2 MQSeries functions were originally", 03250521
"implemented with the =" 03250522
TEMP.6 = "= Application Messaging Interface (AMI), which", 03250523
"is no longer supported =" 03250524
TEMP.7 = "= by MQSeries. Therefore, DB2 APAR PK37290", 03250525
"deprecated these functions =" 03250526
TEMP.8 = "= in V8 and V9 and provided a replacement set", 03250527
"(except for the =" 03250528
TEMP.9 = "= MQPUBLISH, MQSUBSCRIBE and MQUNSUBSCRIBE", 03250529
"functions) that uses the =" 03250530
TEMP.10 = "= MQSeries Message Queue Interface (MQI).", 03250531
" The MQI-based functions =" 03250532
TEMP.11 = "= have the same signatures as the AMI-based", 03250533
"functions, but are created =" 03250534
TEMP.12 = "= in a different schema, 'DB2MQ'. ", 03250535
" =" 03250536
TEMP.13 = "= ", 03250537
" =" 03250538
TEMP.14 = "= Before migrating to V10, identify any applications", 03250539
"that use the =" 03250540
TEMP.15 = "= obsolete functions listed below, and convert them", 03250541
"to use the MQI- =" 03250542
TEMP.16 = "= based replacement functions. For more information,", 03250543
"see the topic =" 03250544
TEMP.17 = "= entitled 'Converting from the AMI-based MQ functions", 03250545
"to the MQI- =" 03250546
TEMP.18 = "= based MQ functions' in the DB2 Installation Guide. ", 03250547
"See also APAR =" 03250548
TEMP.19 = "= PK37290. ", 03250549
" =" 03250550
TEMP.20 = COPIES('=',72) 03250551
TEMP.21 = "SCHEMA.NAME" 03250552
TEMP.22 = COPIES('-',257) 03250553
03250554
'EXECIO' 22 'DISKW REPORT30 (STEM TEMP.' 03250555
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03250556
, 'EXECIO DISKW REPORT30 rc=' rc 03250557
03250558
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03250559
address DSNREXX EXECSQL SQLSTMT 03250560
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03250561
03250562
SQLSTMT =, 03250563
"SELECT DISTINCT STRIP(SCHEMA) || '.' || STRIP(NAME)", 03250564
"FROM SYSIBM.SYSROUTINES", 03250565
"WHERE SCHEMA IN ( 'DB2MQ1C', 'DB2MQ2C', 'DB2MQ1N', 'DB2MQ2N' )" 03250566
03250567
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03250568
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03250569
03250570
address DSNREXX "EXECSQL OPEN C1" 03250571
if sqlcode<>0 then call errsqlca "OPEN C1" 03250572
03250573
address DSNREXX "EXECSQL FETCH C1", 03250574
"INTO :HV1" 03250575
DO WHILE SQLCODE = 0 03250576
TEMP.1 = HV1 03250577
'EXECIO' 1 'DISKW REPORT30 (STEM TEMP.' 03250578
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03250579
, 'EXECIO DISKW REPORT30 rc=' rc 03250580
address DSNREXX "EXECSQL FETCH C1", 03250581
"INTO :HV1" 03250582
END 03250583
03250584
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03250585
03250586
drop TEMP. HV1 03250587
'EXECIO 0 DISKW REPORT30 (FINIS' 03250588
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03250589
, 'EXECIO DISKW REPORT30 CLOSE rc=' rc 03250590
03250591
address DSNREXX "EXECSQL CLOSE C1" 03250592
if sqlcode<>0 then call errsqlca "CLOSE C1" 03250593
03250594
CALL IntMsg, 03250595
' Report 30 completed' 03250596
RETURN /* end GenerateReport30 */ 03250597
03250598
03250599
generateReport31: 03250600
/*****************************************************************/ 03250601
/* Generates premigration report 31 */ 03250602
/* Report existence of obsolete DB2 XML MQSeries routines */ 03250603
/*****************************************************************/ 03250604
"EXECIO 0 DISKW REPORT31 (OPEN" 03250605
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03250606
, 'EXECIO DISKW REPORT31 OPEN rc=' rc 03250607
03250608
TEMP.1 = "=== REPORT 31" COPIES('=',58) 03250609
TEMP.2 = "= The DB2 MQSeries XML functions and stored", 03250610
"procedures listed below =" 03250611
TEMP.3 = "= are deprecated in DB2 V8 and V9 and are", 03250612
"obsolete in V10. These =" 03250613
TEMP.4 = "= routines were originally implemented for", 03250614
"use with the DB2 XML =" 03250615
TEMP.5 = "= extender feature which has been replaced", 03250616
"by native support for XML =" 03250617
TEMP.6 = "= beginning in DB2 V9. ", 03250618
" =" 03250619
TEMP.7 = "= ", 03250620
" =" 03250621
TEMP.8 = "= After migrating to V10, identify any", 03250622
"applications that use the =" 03250623
TEMP.9 = "= obsolete routines listed below and: ", 03250624
" =" 03250625
TEMP.10 = "= * Convert callers of DB2 MQSeries XML", 03250626
"functions for send, receive, =" 03250627
TEMP.11 = "= and read to use the equivalent MQI-based", 03250628
"DB2 MQSeries functions, =" 03250629
TEMP.12 = "= casting the XML data to VARCHAR or CLOB.", 03250630
" For example, an =" 03250631
TEMP.13 = "= application that currently calls the", 03250632
"MQSENDXML function should be =" 03250633
TEMP.14 = "= converted to call the DB2MQ.MQSEND", 03250634
"function with the XML data =" 03250635
TEMP.15 = "= cast to VARCHAR or CLOB. ", 03250636
" =" 03250637
TEMP.16 = "= * Convert callers of DB2 MQSeries XML", 03250638
"composition stored procedures =" 03250639
TEMP.17 = "= to call DB2 XML publishing functions", 03250640
"to compose XML documents, =" 03250641
TEMP.18 = "= cast them VARCHAR/CLOB, and use the", 03250642
"corresponding DB2 MQSeries =" 03250643
TEMP.19 = "= MQI-based function to send the composed", 03250644
"XML document to a MQSeries =" 03250645
TEMP.20 = "= queue. ", 03250646
" =" 03250647
TEMP.21 = "= * Convert callers of DB2 MQSeries XML", 03250648
"decomposition stored =" 03250649
TEMP.22 = "= procedures to use DB2 MQSeries MQI-based", 03250650
"functions to retrieve =" 03250651
TEMP.23 = "= messages from MQSeries queues and then", 03250652
"call DB2 XML decomposition =" 03250653
TEMP.24 = "= functions to shred retrieved messages", 03250654
"to DB2 tables. =" 03250655
TEMP.25 = "= Note: If you are migrating to V10 from", 03250656
"V9, you can convert users of =" 03250657
TEMP.26 = "= DB2 MQSeries XML routines before you", 03250658
"migrate to V10. =" 03250659
TEMP.27 = COPIES('=',72) 03250660
TEMP.28 = "SCHEMA.NAME" 03250661
TEMP.29 = COPIES('-',257) 03250662
03250663
'EXECIO' 29 'DISKW REPORT31 (STEM TEMP.' 03250664
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03250665
, 'EXECIO DISKW REPORT31 rc=' rc 03250666
03250667
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03250668
address DSNREXX EXECSQL SQLSTMT 03250669
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03250670
03250671
SQLSTMT =, 03250672
"SELECT DISTINCT STRIP(SCHEMA) || '.' || STRIP(NAME)", 03250673
"FROM SYSIBM.SYSROUTINES", 03250674
"WHERE SCHEMA IN ( 'DMQXML1C', 'DMQXML2C' )" 03250675
03250676
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03250677
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03250678
03250679
address DSNREXX "EXECSQL OPEN C1" 03250680
if sqlcode<>0 then call errsqlca "OPEN C1" 03250681
03250682
address DSNREXX "EXECSQL FETCH C1", 03250683
"INTO :HV1" 03250684
DO WHILE SQLCODE = 0 03250685
TEMP.1 = HV1 03250686
'EXECIO' 1 'DISKW REPORT31 (STEM TEMP.' 03250687
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03250688
, 'EXECIO DISKW REPORT31 rc=' rc 03250689
address DSNREXX "EXECSQL FETCH C1", 03250690
"INTO :HV1" 03250691
END 03250692
03250693
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03250694
03250695
drop TEMP. HV1 03250696
'EXECIO 0 DISKW REPORT31 (FINIS' 03250697
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03250698
, 'EXECIO DISKW REPORT31 CLOSE rc=' rc 03250699
03250700
address DSNREXX "EXECSQL CLOSE C1" 03250701
if sqlcode<>0 then call errsqlca "CLOSE C1" 03250702
03250703
CALL IntMsg, 03250704
' Report 31 completed' 03250705
RETURN /* end GenerateReport31 */ 03250706
03250707
03250708
generateReport32: 03250709
/*****************************************************************/ 03250710
/* Generates premigration report 32 */ 03250711
/* Report multiple TCREATOR + TTNAME + TIMESTAMP in SYSTABAUTH */ 03250712
/*****************************************************************/ 03250713
"EXECIO 0 DISKW REPORT32 (OPEN" 03250714
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03250715
, 'EXECIO DISKW REPORT32 OPEN rc=' rc 03250716
03250717
TEMP.1 = "=== REPORT 32" COPIES('=',58) 03250718
TEMP.2 = "= More than one row exists in the", 03250719
"SYSIBM.SYSTABAUTH catalog table for =" 03250720
TEMP.3 = "= each combination of table owner,", 03250721
"table name, and timestamp listed =" 03250722
TEMP.4 = "= below. In DB2 V10, each combination", 03250723
"must be unique. To prevent =" 03250724
TEMP.5 = "= errors during V10 catalog tailoring", 03250725
"(DSNTIJTC/CATMAINT), contact IBM =" 03250726
TEMP.6 = "= for assistance with removing the", 03250727
"extraneous rows. =" 03250728
TEMP.7 = COPIES('=',72) 03250729
TEMP.8 = "TCREATOR.TTNAME.HEX(TIMESTAMP)" 03250730
TEMP.9 = COPIES('-',282) 03250731
03250732
'EXECIO' 9 'DISKW REPORT32 (STEM TEMP.' 03250733
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03250734
, 'EXECIO DISKW REPORT32 rc=' rc 03250735
03250736
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03250737
address DSNREXX EXECSQL SQLSTMT 03250738
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03250739
03250740
SQLSTMT =, 03250741
"SELECT STRIP(TCREATOR)", 03250742
"|| '.'", 03250743
"|| STRIP(TTNAME)", 03250744
"|| '.'", 03250745
"|| HEX(TIMESTAMP)", 03250746
"FROM SYSIBM.SYSTABAUTH", 03250747
"GROUP BY TCREATOR,TTNAME,TIMESTAMP", 03250748
"HAVING COUNT(*) > 1" 03250749
03250750
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03250751
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03250752
03250753
address DSNREXX "EXECSQL OPEN C1" 03250754
if sqlcode<>0 then call errsqlca "OPEN C1" 03250755
03250756
address DSNREXX "EXECSQL FETCH C1", 03250757
"INTO :HV1" 03250758
DO WHILE SQLCODE = 0 03250759
TEMP.1 = HV1 03250760
'EXECIO' 1 'DISKW REPORT32 (STEM TEMP.' 03250761
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03250762
, 'EXECIO DISKW REPORT32 rc=' rc 03250763
address DSNREXX "EXECSQL FETCH C1", 03250764
"INTO :HV1" 03250765
END 03250766
03250767
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03250768
03250769
drop TEMP. HV1 03250770
'EXECIO 0 DISKW REPORT32 (FINIS' 03250771
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03250772
, 'EXECIO DISKW REPORT32 CLOSE rc=' rc 03250773
03250774
address DSNREXX "EXECSQL CLOSE C1" 03250775
if sqlcode<>0 then call errsqlca "CLOSE C1" 03250776
03250777
CALL IntMsg, 03250778
' Report 32 completed' 03250779
RETURN /* end GenerateReport32 */ 03250780
03250781
03250782
generateReport33: 03250783
/*****************************************************************/ 03250784
/* Generates premigration report 33 */ 03250785
/* Report simple table spaces */ 03250786
/*****************************************************************/ 03250787
"EXECIO 0 DISKW REPORT33 (OPEN" 03250788
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03250789
, 'EXECIO DISKW REPORT33 OPEN rc=' rc 03250790
03250791
TEMP.1 = "=== REPORT 33" COPIES('=',58) 03250792
TEMP.2 = "= Each table space listed below is a simple", 03250793
"table space, meaning that =" 03250794
TEMP.3 = "= it is neither partitioned nor segmented. ", 03250795
"Although DB2 V10 can use =" 03250796
TEMP.4 = "= existing simple table spaces and allows you", 03250797
"to alter data, update =" 03250798
TEMP.5 = "= data, or retrieve data from them, it does not", 03250799
"allow you to create =" 03250800
TEMP.6 = "= them. If you accidentally drop a simple table", 03250801
"space in V10, you =" 03250802
TEMP.7 = "= will be unable to recreate it. Therefore, before", 03250803
"migrating to V10, =" 03250804
TEMP.8 = "= convert each table space listed below to a preferred", 03250805
"type of table =" 03250806
TEMP.9 = "= space. ", 03250807
" =" 03250808
TEMP.10 = COPIES('=',72) 03250809
TEMP.11 = "DBNAME.TSNAME" 03250810
TEMP.12 = COPIES('-',49) 03250811
03250812
'EXECIO' 12 'DISKW REPORT33 (STEM TEMP.' 03250813
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03250814
, 'EXECIO DISKW REPORT33 rc=' rc 03250815
03250816
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03250817
address DSNREXX EXECSQL SQLSTMT 03250818
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03250819
03250820
SQLSTMT =, 03250821
"SELECT STRIP(TS.DBNAME)", 03250822
"|| '.'", 03250823
"|| STRIP(TS.NAME)", 03250824
"FROM SYSIBM.SYSTABLESPACE TS", 03250825
"WHERE TS.PARTITIONS = 0", 03250826
"AND TS.SEGSIZE = 0", 03250827
"AND TS.TYPE <> 'O'", 03250828
"AND TS.DBNAME NOT IN ('DSNDB01', 'DSNDB06')", 03250829
"AND TS.DBNAME NOT IN", 03250830
"( SELECT DB.NAME", 03250831
"FROM SYSIBM.SYSDATABASE DB", 03250832
"WHERE DB.TYPE = 'W'", 03250833
")", 03250834
"AND TS.DBNAME NOT LIKE 'DSN8%'", 03250835
"ORDER BY TS.DBNAME, TS.NAME" 03250836
03250837
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03250838
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03250839
03250840
address DSNREXX "EXECSQL OPEN C1" 03250841
if sqlcode<>0 then call errsqlca "OPEN C1" 03250842
03250843
address DSNREXX "EXECSQL FETCH C1", 03250844
"INTO :HV1" 03250845
DO WHILE SQLCODE = 0 03250846
TEMP.1 = HV1 03250847
'EXECIO' 1 'DISKW REPORT33 (STEM TEMP.' 03250848
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03250849
, 'EXECIO DISKW REPORT33 rc=' rc 03250850
address DSNREXX "EXECSQL FETCH C1", 03250851
"INTO :HV1" 03250852
END 03250853
03250854
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03250855
03250856
drop TEMP. HV1 03250857
'EXECIO 0 DISKW REPORT33 (FINIS' 03250858
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03250859
, 'EXECIO DISKW REPORT33 CLOSE rc=' rc 03250860
03250861
address DSNREXX "EXECSQL CLOSE C1" 03250862
if sqlcode<>0 then call errsqlca "CLOSE C1" 03250863
03250864
CALL IntMsg, 03250865
' Report 33 completed' 03250866
RETURN /* end GenerateReport33 */ 03250867
03250868
03250869
generateReport34: 03250870
/*****************************************************************/ 03250871
/* Generates premigration report 34 */ 03250872
/* Report trigger packages that reference DB2 special registers*/ 03250873
/* and that were last bound prior to V8. */ 03250874
/*****************************************************************/ 03250875
"EXECIO 0 DISKW REPORT34 (OPEN" 03250876
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03250877
, 'EXECIO DISKW REPORT34 OPEN rc=' rc 03250878
03250879
TEMP.1 = "=== REPORT 34" COPIES('=',58) 03250880
TEMP.2 = "= Each package listed below is a trigger package", 03250881
"that references a DB2 =" 03250882
TEMP.3 = "= special register and that was last bound prior", 03250883
"to DB2 Version 8. =" 03250884
TEMP.4 = "= In V10, triggers that use these packages will fail", 03250885
"with SQLCODE -723 =" 03250886
TEMP.5 = "= (AN ERROR OCCURRED IN A TRIGGERED SQL STATEMENT", 03250887
"IN trigger-name) =" 03250888
TEMP.6 = "= and SQLCODE -909 (THE OBJECT HAS BEEN DELETED", 03250889
"OR ALTERED) until they =" 03250890
TEMP.7 = "= are rebound. To avoid interruptions, rebind", 03250891
"these packages prior to =" 03250892
TEMP.8 = "= migrating to V10. ", 03250893
" =" 03250894
TEMP.9 = COPIES('=',72) 03250895
TEMP.10 = "Collection ID . package name . HEX(CONTOKEN)", 03250896
COPIES(' ',206) 03250897
TEMP.11 = COPIES('-',250) || COPIES('-',24) 03250898
03250899
'EXECIO' 11 'DISKW REPORT34 (STEM TEMP.' 03250900
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03250901
, 'EXECIO DISKW REPORT34 rc=' rc 03250902
03250903
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03250904
address DSNREXX EXECSQL SQLSTMT 03250905
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03250906
03250907
SQLSTMT =, 03250908
"SELECT STRIP(P.COLLID)", 03250909
" , STRIP(P.NAME)", 03250910
" , HEX(P.CONTOKEN) AS HEX_CONTOKEN", 03250911
" FROM SYSIBM.SYSPACKAGE AS P", 03250912
" , SYSIBM.SYSTRIGGERS AS T", 03250913
" WHERE P.TYPE = 'T'", 03250914
" AND P.RELBOUND <= 'K'", 03250915
" AND P.COLLID = T.SCHEMA", 03250916
" AND P.NAME = T.NAME", 03250917
" AND P.CONTOKEN = P.CONTOKEN", 03250918
" AND ( T.TEXT LIKE '%CURRENT %APPLICATION", 03250919
"%ENCODING %SCHEME%'", 03250920
" OR T.TEXT LIKE '%CURRENT %DATE%'", 03250921
" OR T.TEXT LIKE '%CURRENT %DEGREE%'", 03250922
" OR T.TEXT LIKE '%CURRENT %LOCALE %LC_CTYPE%'", 03250923
" OR T.TEXT LIKE '%CURRENT %MEMBER%'", 03250924
" OR T.TEXT LIKE '%CURRENT %OPTIMIZATION %HINT%'", 03250925
" OR T.TEXT LIKE '%CURRENT %PACKAGESET%'", 03250926
" OR T.TEXT LIKE '%CURRENT %PATH%'", 03250927
" OR T.TEXT LIKE '%CURRENT %PRECISION%'", 03250928
" OR T.TEXT LIKE '%CURRENT %RULES%'", 03250929
" OR T.TEXT LIKE '%CURRENT %SERVER%'", 03250930
" OR T.TEXT LIKE '%CURRENT %SQLID%'", 03250931
" OR T.TEXT LIKE '%CURRENT %TIME%'", 03250932
" OR T.TEXT LIKE '%CURRENT %TIMESTAMP%'", 03250933
" OR T.TEXT LIKE '%CURRENT %TIMEZONE%'", 03250934
" OR T.TEXT LIKE '%USER%'", 03250935
" )", 03250936
" GROUP BY P.COLLID", 03250937
" , P.NAME", 03250938
" , P.CONTOKEN" 03250939
03250940
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03250941
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03250942
03250943
address DSNREXX "EXECSQL OPEN C1" 03250944
if sqlcode<>0 then call errsqlca "OPEN C1" 03250945
03250946
address DSNREXX "EXECSQL FETCH C1", 03250947
"INTO :HV1, :HV2, :HV3" 03250948
DO WHILE SQLCODE = 0 03250949
TEMP.1 = HV1 || '.' || HV2 || '.' || HV3 03250950
'EXECIO' 1 'DISKW REPORT34 (STEM TEMP.' 03250951
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03250952
, 'EXECIO DISKW REPORT34 rc=' rc 03250953
address DSNREXX "EXECSQL FETCH C1", 03250954
"INTO :HV1, :HV2, :HV3" 03250955
END 03250956
03250957
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03250958
03250959
drop TEMP. HV1 03250960
'EXECIO 0 DISKW REPORT34 (FINIS' 03250961
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03250962
, 'EXECIO DISKW REPORT34 CLOSE rc=' rc 03250963
03250964
address DSNREXX "EXECSQL CLOSE C1" 03250965
if sqlcode<>0 then call errsqlca "CLOSE C1" 03250966
03250967
CALL IntMsg, 03250968
' Report 34 completed' 03250969
RETURN /* end GenerateReport34 */ 03250970
03250971
03250972
generateReport35: 03250973
/*****************************************************************/ 03250974
/* Generates premigration report 35 */ 03250975
/* Report trigger packages that have an invalid SECTNOI */ 03250976
/*****************************************************************/ 03250977
"EXECIO 0 DISKW REPORT35 (OPEN" 03250978
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03250979
, 'EXECIO DISKW REPORT35 OPEN rc=' rc 03250980
03250981
TEMP.1 = "=== REPORT 35" COPIES('=',58) 03250982
TEMP.2 = "= The following are trigger packages", 03250984
"created in DB2 V8 that have a =" 03250985
TEMP.3 = "= negative statement section number", 03250986
"(SECTNOI) entry in the SYSIBM.- =" 03250987
TEMP.4 = "= SYSPACKSTMT catalog table. PTF", 03250988
"UK42129 (APAR PK72349) fixed the =" 03250989
TEMP.5 = "= probable cause but did not correct", 03250990
"existing trigger packages. To =" 03250991
TEMP.6 = "= avoid unpredictable results, you", 03250992
"should drop and recreate the =" 03250993
TEMP.7 = "= trigger for each package that was", 03250994
"created prior to applying PTF =" 03250995
TEMP.8 = "= UK42129. It is recommended that you", 03250996
"complete the cleanup before =" 03250997
TEMP.9 = "= beginning migration to DB2 10.", 03250998
" =" 03250999
TEMP.10 = COPIES('=',72) 03251000
TEMP.11 = "Collection ID . package name . HEX(CONTOKEN)", 03251001
COPIES(' ',206) 03251002
TEMP.12 = COPIES('-',250) || COPIES('-',24) 03251003
03251004
'EXECIO' 12 'DISKW REPORT35 (STEM TEMP.' 03251005
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03251006
, 'EXECIO DISKW REPORT35 rc=' rc 03251007
03251008
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03251009
address DSNREXX EXECSQL SQLSTMT 03251010
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03251011
/*<PI37038*/ 03251012
SQLSTMT =, 03251013
" SELECT STRIP(PKG.COLLID)", 03251014
" , STRIP(PKG.NAME)", 03251015
" , HEX(PKG.CONTOKEN)", 03251016
" FROM SYSIBM.SYSPACKAGE PKG", 03251017
" , SYSIBM.SYSPACKSTMT PST", 03251018
" WHERE PKG.TYPE= 'T'", 03251019
" AND PKG.RELBOUND = 'L'", 03251020
" AND PKG.LOCATION = PST.LOCATION", 03251021
" AND PKG.COLLID = PST.COLLID", 03251022
" AND PKG.NAME = PST.NAME", 03251023
" AND PKG.CONTOKEN = PST.CONTOKEN", 03251024
" AND PST.SECTNOI < 0", 03251025
" GROUP BY PKG.COLLID, PKG.NAME, PKG.CONTOKEN" 03251026
/*>PI37038*/ 03251027
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03251028
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03251029
03251030
address DSNREXX "EXECSQL OPEN C1" 03251031
if sqlcode<>0 then call errsqlca "OPEN C1" 03251032
03251033
address DSNREXX "EXECSQL FETCH C1", 03251034
"INTO :HV1, :HV2, :HV3" 03251035
DO WHILE SQLCODE = 0 03251036
TEMP.1 = HV1 || '.' || HV2 || '.' || HV3 03251037
'EXECIO' 1 'DISKW REPORT35 (STEM TEMP.' 03251038
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03251039
, 'EXECIO DISKW REPORT35 rc=' rc 03251040
address DSNREXX "EXECSQL FETCH C1", 03251041
"INTO :HV1, :HV2, :HV3" 03251042
END 03251043
03251044
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03251045
03251046
drop TEMP. HV1 03251047
'EXECIO 0 DISKW REPORT35 (FINIS' 03251048
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03251049
, 'EXECIO DISKW REPORT35 CLOSE rc=' rc 03251050
03251051
address DSNREXX "EXECSQL CLOSE C1" 03251052
if sqlcode<>0 then call errsqlca "CLOSE C1" 03251053
03251054
CALL IntMsg, 03251055
' Report 35 completed' 03251056
RETURN /* end GenerateReport35 */ 03251057
03251058
03251059
generateReport36: PROCEDURE 03251060
/*****************************************************************/ 03251061
/* Generates premigration report 36: */ 03251062
/* Report problem with catalog table space version numbers. */ 03251063
/*****************************************************************/ 03251064
"EXECIO 0 DISKW REPORT36 (OPEN" 03251065
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03251066
, 'EXECIO DISKW REPORT36 OPEN rc=' rc 03251067
03251068
TEMP.1 = "=== REPORT 36" COPIES('=',58) 03251069
TEMP.2 = "= Following is a list of DB2 catalog table spaces", 03251070
"for which the oldest", 03251071
"=" 03251072
TEMP.3 = "= version is greater than the current version. Such", 03251073
"table spaces", 03251074
RIGHT("=",7) 03251075
TEMP.4 = "= may cause migration to V10 conversion mode to", 03251076
"fail during execution ", 03251077
"=" 03251078
TEMP.5 = "= of job DSNTIJTC (catalog tailoring). Before", 03251079
"beginning your migration", 03251080
"=" 03251081
TEMP.6 = "= use MODIFY RECOVERY followed by REORG to correct", 03251082
"the versioning", 03251083
RIGHT("=",6) 03251084
TEMP.7 = "= of all these table spaces. See the Utility Guide", 03251085
"for information", 03251089
RIGHT("=",5) 03251093
TEMP.8 = "= about these utilities.", 03251097
RIGHT("=",47) 03251101
TEMP.9 = COPIES('=',72) 03251105
03251109
TEMP.10 = "CREATOR.NAME.OLDEST_VERSION.CURRENT_VERSION" 03251113
TEMP.11 = COPIES('-',72) 03251117
03251121
'EXECIO' 11 'DISKW REPORT36 (STEM TEMP.' 03251125
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03251129
, 'EXECIO DISKW REPORT36 rc=' rc 03251133
03251137
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03251141
address DSNREXX EXECSQL SQLSTMT 03251145
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03251149
03251153
SQLSTMT =, 03251157
" SELECT STRIP(CREATOR),", 03251161
" SUBSTR(NAME, 1, 8),", 03251167
" OLDEST_VERSION,", 03251169
" CURRENT_VERSION", 03251173
" FROM SYSIBM.SYSTABLESPACE", 03251177
" WHERE DBID = 6", 03251181
" AND (CURRENT_VERSION < OLDEST_VERSION)" 03251185
03251189
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03251193
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03251197
03251201
address DSNREXX "EXECSQL OPEN C1" 03251205
if sqlcode<>0 then call errsqlca "OPEN C1" 03251209
03251213
address DSNREXX "EXECSQL FETCH C1", 03251217
"INTO :HV1, :HV2, :HV3, :HV4" 03251221
03251225
DO WHILE SQLCODE = 0 03251229
TEMP.1 = HV1 || '.' || HV2 || '.' || HV3 || '.' || HV4 03251233
'EXECIO' 1 'DISKW REPORT36 (STEM TEMP.' 03251237
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03251241
, 'EXECIO DISKW REPORT36 rc=' rc 03251245
address DSNREXX "EXECSQL FETCH C1", 03251249
"INTO :HV1, :HV2, :HV3, :HV4" 03251253
END 03251257
03251261
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03251265
03251269
drop TEMP. HV1 03251273
'EXECIO 0 DISKW REPORT36 (FINIS' 03251277
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03251281
, 'EXECIO DISKW REPORT36 CLOSE rc=' rc 03251285
03251289
address DSNREXX "EXECSQL CLOSE C1" 03251293
if sqlcode<>0 then call errsqlca "CLOSE C1" 03251297
03251301
CALL IntMsg, 03251305
' Report 36 completed' 03251309
03251313
RETURN /* end generateReport36 */ 03251317
03251321
03251325
generateReport37: PROCEDURE 03251336
/*****************************************************************/ 03251343
/* Generates premigration report 37: */ 03251350
/* Report packages with dependency on SYSPKAGE table space */ 03251357
/*****************************************************************/ 03251364
"EXECIO 0 DISKW REPORT37 (OPEN" 03251371
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03251378
, 'EXECIO DISKW REPORT37 OPEN rc=' rc 03251385
03251392
TEMP.1 = "=== REPORT 37" COPIES('=',58) 03251399
TEMP.2 = "= The following packages are recorded", 03251406
"as being dependent on the =" 03251413
TEMP.3 = "= DSNDB06.SYSPKAGE table space. This", 03251420
"is most likely because the =" 03251427
TEMP.4 = "= package refers to a CGTT. This", 03251434
"dependency is unnecessary. Recent =" 03251441
TEMP.5 = "= maintenance no longer records this", 03251448
"dependency during bind. If these =" 03251455
TEMP.6 = "= dependencies persist until ENFM, when", 03251462
"the ENFM0097 step of the =" 03251469
TEMP.7 = "= DSNTIJEN job drops the DSNDB06.SYSPKAGE", 03251476
"table space, these packages =" 03251483
TEMP.8 = "= will be invalidated at that time. It", 03251490
"is recommended that these =" 03251497
TEMP.9 = "= packages be rebound prior to running", 03251504
"the DSNTIJEN job for ENFM. =" 03251511
TEMP.10 = "= These rebinds can be done either prior", 03251518
"to migrating to V10 or while =" 03251525
TEMP.11 = "= in CM8 or CM9 in V10. ", 03251532
" =" 03251539
TEMP.12 = COPIES('=',72) 03251546
03251553
TEMP.13 = "Collection-ID.Package-name.Hex-contoken" 03251560
TEMP.14 = COPIES('-',274) 03251567
03251574
'EXECIO' 14 'DISKW REPORT37 (STEM TEMP.' 03251581
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03251588
, 'EXECIO DISKW REPORT37 rc=' rc 03251595
03251602
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03251609
address DSNREXX EXECSQL SQLSTMT 03251616
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03251623
03251630
SQLSTMT =, 03251637
"SELECT STRIP(DCOLLID)", 03251644
"|| '.' || STRIP(DNAME)", 03251651
"|| '.' || HEX(DCONTOKEN)", 03251658
"FROM SYSIBM.SYSPACKDEP", 03251665
"WHERE BQUALIFIER = 'DSNDB06'", 03251672
"AND BNAME = 'SYSPKAGE'", 03251679
"AND BTYPE = 'R'", 03251686
"AND DTYPE NOT IN( 'O', 'P' )", 03251689
"ORDER BY 1" 03251693
03251700
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03251707
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03251714
03251721
address DSNREXX "EXECSQL OPEN C1" 03251728
if sqlcode<>0 then call errsqlca "OPEN C1" 03251735
03251742
address DSNREXX "EXECSQL FETCH C1", 03251749
"INTO :HV1" 03251756
03251763
DO WHILE SQLCODE = 0 03251770
TEMP.1 = HV1 03251777
'EXECIO' 1 'DISKW REPORT37 (STEM TEMP.' 03251784
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03251791
, 'EXECIO DISKW REPORT37 rc=' rc 03251798
address DSNREXX "EXECSQL FETCH C1", 03251805
"INTO :HV1" 03251812
END 03251819
03251826
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03251833
03251840
drop TEMP. HV1 03251847
'EXECIO 0 DISKW REPORT37 (FINIS' 03251854
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03251861
, 'EXECIO DISKW REPORT37 CLOSE rc=' rc 03251868
03251875
address DSNREXX "EXECSQL CLOSE C1" 03251882
if sqlcode<>0 then call errsqlca "CLOSE C1" 03251889
03251896
CALL IntMsg, 03251903
' Report 37 completed' 03251910
03251917
RETURN /* end generateReport37 */ 03251924
03251931
03251938
generateReport38: PROCEDURE 03251946
/*****************************************************************/ 03251947
/* Generates premigration report 38: */ 03251948
/* Report extraneous text in SYSIBM.SYSTRIGGERS.TEXT */ 03251949
/*****************************************************************/ 03251950
"EXECIO 0 DISKW REPORT38 (OPEN" 03251951
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03251952
, 'EXECIO DISKW REPORT38 OPEN rc=' rc 03251953
03251954
TEMP.1 = "=== REPORT 38" COPIES('=',58) 03251955
TEMP.2 = "= Extraneous text in TEXT column of", 03251956
"SYSIBM.SYSTRIGGERS =" 03251957
TEMP.3 = COPIES('=',72) 03251958
TEMP.4 = "= For each trigger listed below, the", 03251959
"TEXT column of SYSIBM.SYSTRIGGERS =" 03251960
TEMP.5 = "= contains additional or extraneous SQL", 03251961
"text after the CREATE TRIGGER =" 03251962
TEMP.6 = "= statement. Such triggers cannot be", 03251963
"rebuilt by the REPAIR DBD REBUILD =" 03251964
TEMP.7 = "= utility after you migrate to DB2 10. ", 03251965
"In response, drop and recreate =" 03251966
TEMP.8 = "= these triggers before you migrate to", 03251967
"DB2 10. Note: The extraneous =" 03251968
TEMP.9 = "= SQL text can result when a create", 03251969
"trigger statement that contains a =" 03251970
TEMP.10 = "= BEGIN ATOMIC clause is improperly", 03251971
"terminated by a semicolon instead =" 03251972
TEMP.11 = "= of an alternative statement terminator.", 03251973
" If you recreate a trigger =" 03251974
TEMP.12 = "= using the CREATE TRIGGER statement in", 03251975
"the TEXT column of SYSIBM.- =" 03251976
TEMP.13 = "= SYSTRIGGERS, be sure to exclude the", 03251977
"extraneous text. If the CREATE =" 03251978
TEMP.14 = "= TRIGGER statement processes with", 03251979
"SQLCODE +098, drop the trigger and =" 03251980
TEMP.15 = "= reinspect the statement for improper", 03251981
"use of the semicolon. =" 03251982
TEMP.16 = COPIES('=',72) 03251983
03251984
TEMP.17 = "Schema.Name" 03251985
TEMP.18 = COPIES('-',257) 03251986
03251987
'EXECIO' 18 'DISKW REPORT38 (STEM TEMP.' 03251988
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03251989
, 'EXECIO DISKW REPORT38 rc=' rc 03251990
03251991
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03251992
address DSNREXX EXECSQL SQLSTMT 03251993
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03251994
03251995
SQLSTMT =, 03251996
"SELECT RTRIM(SCHEMA) || '.' || RTRIM(NAME)", 03251997
"FROM SYSIBM.SYSTRIGGERS", 03251998
"WHERE TEXT LIKE '%CREATE TRIGGER % BEGIN ATOMIC %;%END%; %'", 03251999
"ORDER BY SCHEMA, NAME" 03252000
03252001
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03252002
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03252003
03252004
address DSNREXX "EXECSQL OPEN C1" 03252005
if sqlcode<>0 then call errsqlca "OPEN C1" 03252006
03252007
address DSNREXX "EXECSQL FETCH C1", 03252008
"INTO :HV1" 03252009
03252010
DO WHILE SQLCODE = 0 03252011
TEMP.1 = HV1 03252012
'EXECIO' 1 'DISKW REPORT38 (STEM TEMP.' 03252013
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03252014
, 'EXECIO DISKW REPORT38 rc=' rc 03252015
address DSNREXX "EXECSQL FETCH C1", 03252016
"INTO :HV1" 03252017
END 03252018
03252019
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03252020
03252021
drop TEMP. HV1 03252022
'EXECIO 0 DISKW REPORT38 (FINIS' 03252023
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03252024
, 'EXECIO DISKW REPORT38 CLOSE rc=' rc 03252025
03252026
address DSNREXX "EXECSQL CLOSE C1" 03252027
if sqlcode<>0 then call errsqlca "CLOSE C1" 03252028
03252029
CALL IntMsg, 03252030
' Report 38 completed' 03252031
03252032
RETURN /* end generateReport38 */ 03252033
03252034
03252035
generateReport39: PROCEDURE 03252044
/*****************************************************************/ 03252052
/* Generates premigration report 39 */ 03252060
/* Report link names found in SYSRELS */ 03252068
/*****************************************************************/ 03252076
"EXECIO 0 DISKW REPORT39 (OPEN" 03252084
if rc<>0 then call Dsn_Error 'Write_source_dsn', 03252092
, 'EXECIO DISKW REPORT39 OPEN rc=' rc 03252100
03252108
TEMP.1 = "=== REPORT 39" COPIES('=',58) 03252116
TEMP.2 = "= LINK names found in the SYSRELS catalog table", 03252124
"may interfere with V10 =" 03252132
TEMP.3 = "= ENFM processing. To prevent errors during V10", 03252140
"catalog ENFM tailoring =" 03252148
TEMP.4 = "= (DSNTIJEN/CATENFM), contact IBM for assistance", 03252156
"with removing any =" 03252164
TEMP.5 = "= extraneous rows listed below. It is recommended", 03252172
"that you complete =" 03252180
TEMP.6 = "= the cleanup prior to beginning the migration to", 03252188
"V10. =" 03252196
TEMP.7 = COPIES('=',72) 03252204
TEMP.8 = "CREATOR.TBNAME.RELNAME" 03252212
TEMP.9 = COPIES('-',257) 03252220
03252228
'EXECIO' 9 'DISKW REPORT39 (STEM TEMP.' 03252236
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03252244
, 'EXECIO DISKW REPORT39 rc=' rc 03252252
03252260
SQLSTMT = "DECLARE C1 CURSOR FOR S1" 03252268
address DSNREXX EXECSQL SQLSTMT 03252276
if sqlcode <> 0 then call errsqlca 'DECLARE C1 CURSOR FOR S1' 03252284
03252292
SQLSTMT =, 03252300
"SELECT STRIP(CREATOR)", 03252308
"|| '.'", 03252316
"|| STRIP(TBNAME)", 03252324
"|| '.'", 03252332
"|| STRIP(RELNAME)", 03252340
"FROM SYSIBM.SYSRELS", 03252348
"WHERE CREATOR = 'SYSIBM'", 03252356
"AND RELOBID1 = 0", 03252365
"AND NOT EXISTS", 03252366
" (SELECT * FROM SYSIBM.SYSTABLES T", 03252367
" WHERE T.CREATOR = 'SYSIBM'", 03252368
" AND T.NAME = 'SYSLINKS')" 03252369
03252372
address DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT" 03252380
if sqlcode<>0 then call errsqlca "PREPARE S1 FROM :SQLSTMT" 03252388
03252396
address DSNREXX "EXECSQL OPEN C1" 03252404
if sqlcode<>0 then call errsqlca "OPEN C1" 03252412
03252420
address DSNREXX "EXECSQL FETCH C1", 03252428
"INTO :HV1" 03252436
DO WHILE SQLCODE = 0 03252444
TEMP.1 = HV1 03252452
'EXECIO' 1 'DISKW REPORT39 (STEM TEMP.' 03252460
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03252468
, 'EXECIO DISKW REPORT39 rc=' rc 03252476
address DSNREXX "EXECSQL FETCH C1", 03252484
"INTO :HV1" 03252492
END 03252500
03252508
if sqlcode<>100 then call errsqlca "FETCH FROM C1" 03252516
03252524
drop TEMP. HV1 03252532
'EXECIO 0 DISKW REPORT39 (FINIS' 03252540
if rc <> 0 then call Dsn_Error 'Write_source_dsn', 03252548
, 'EXECIO DISKW REPORT39 CLOSE rc=' rc 03252556
03252564
address DSNREXX "EXECSQL CLOSE C1" 03252572
if sqlcode<>0 then call errsqlca "CLOSE C1" 03252580
03252588
CALL IntMsg, 03252596
' Report 39 completed' 03252604
03252612
RETURN /* end generateReport39 */ 03252620
03252628
03252636
IntMsg: PROCEDURE expose debug ownmsg.; TRACE O 03252644
PARSE ARG msg 03252652
SAY msg 03252660
RETURN /* end IntMsg */ 03252668
03252676
03252684
/********************************************************************/03252692
/* Got a dataset allocation or I/O error, print out message & abort.*/03252700
/********************************************************************/03252708
Dsn_Error: 03252716
if debug<3 then trace O 03252724
/* "ARG"(1) is the code section name, "ARG"(2) the event text. */03252732
call IntMsg 'I/O error occurred in "'"ARG"(1)'". Event:' "ARG"(2) 03252740
call Abort 23 03252800
return /* end Dsn_Error */ 03253500
03254200
03254900
/********************************************************************/03255600
/* Got a failure SQLCODE, write diagnostics to result set and abort.*/03256300
/********************************************************************/03257000
ERRSQLCA: 03257700
IF debug<3 THEN TRACE O 03258400
03259100
CALL IntMsg '** Error SQL statement -' "ARG"(1) 03259800
/* If this is a CREATE, show the statement we are working with. */ 03260500
IF "WORD"("ARG"(1),1) = 'CREATE' THEN DO 03261200
CALL IntMsg 'SQL statement follows:' 03261900
CALL IntMsg sqlstmt 03262600
END 03263300
03264000
CALL IntMsg 'SQLCODE ='SQLCODE 03264700
CALL IntMsg 'SQLERRMC='||"TRANSLATE"(SQLERRMC,';','FF'x) 03265400
CALL IntMsg 'SQLERRP ='SQLERRP 03266100
CALL IntMsg 'SQLERRD ='SQLERRD.1','SQLERRD.2','SQLERRD.3, 03266800
||','SQLERRD.4','SQLERRD.5','SQLERRD.6 03267500
03268200
CALL IntMsg 'SQLWARN ='SQLWARN.0','SQLWARN.1','SQLWARN.2, 03268900
||','SQLWARN.3','SQLWARN.4','SQLWARN.5, 03269600
||','SQLWARN.6','SQLWARN.7','SQLWARN.8, 03270300
||','SQLWARN.9','SQLWARN.10 03271000
CALL IntMsg 'SQLSTATE='SQLSTATE 03271700
03272400
ADDRESS DSNREXX "EXECSQL ROLLBACK" 03273100
03273800
CALL Abort 27 03274500
RETURN /* end ERRSQLCA */ 03275200
03275900
03276600
/********************************************************************/03277300
/* Got a bad enough error to stop processing. Put an error message */03278000
/* into the result set and terminate with RC>=8. */03278700
/********************************************************************/03279400
Abort: 03280100
IF aborting=1 THEN RETURN; ELSE aborting=1 03280800
IF debug<3 THEN TRACE O 03281500
IF debug>0 THEN SAY 'Subroutine: Abort' 03282200
03282900
PARSE ARG errorid . 03283600
SELECT /* errorid */ 03284300
WHEN errorid=23 THEN DO 03285000
CALL IntMsg 'Aborting due to I/O errors.' 03285700
high_rc = 8 03286400
END 03287100
WHEN errorid=27 THEN DO 03287800
CALL IntMsg 'Aborting due to unexpected SQLCODE.' 03288500
high_rc = 8 03289200
END 03289900
WHEN errorid=44 THEN DO 03290600
CALL IntMsg 'Aborting due to more table spaces requested than', 03291300
|| 'could be added.' 03292000
high_rc = 8 03292700
END 03293400
WHEN errorid=54 THEN DO 03294100
CALL IntMsg 'Aborting due to unexpected parameter setting.' 03294800
high_rc = 8 03295500
END 03296200
OTHERWISE DO 03296900
CALL IntMsg 'ABORT: invalid error id' errorid 03297600
high_rc = 999 03298300
END 03299000
END /* SELECT errorid */ 03299700
03300400
IF "WORDPOS"( high_rc, '0 4 8 999' ) > 0 /* An expected value ?..*/ 03301100
THEN high_rc = 8 /* Yes, normal abort rc=8 */ 03301800
ELSE high_rc = 999 /* No, force internal err */ 03302500
03303200
EXIT Finis() /* end Abort */ 03303900
03304600
03305300
/********************************************************************/03306000
/* Do clean up processing and exit. Put all internally generated */03306700
/* messages into global temp table for result set. Open the result */03307400
/* set cursor. Set the highest return code. Close all files and */03308100
/* exit */03308800
/********************************************************************/03309500
Finis: 03310200
SAY '*** End RC='high_rc 03310900
RETURN high_rc /* normal end of DSNTPMQ */ 03311600
03312300
//* 03313000
//DSNTPMQ EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(4,LT) 03314000
//SYSEXEC DD DSN=&&TEMPPDS,DISP=(OLD,DELETE) 03315000
//SYSTSPRT DD SYSOUT=* 03316000
//SYSPRINT DD SYSOUT=* 03317000
//SYSUDUMP DD SYSOUT=* 03318000
//SYSTSIN DD * 03319000
DSNTPMQ !DSN! !SYSADM! 03320490
//REPORT01 DD SYSOUT=* 03321000
//REPORT02 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=257) 03322490
//REPORT03 DD SYSOUT=* 03323000
//REPORT04 DD SYSOUT=* 03324000
//REPORT05 DD SYSOUT=* 03325000
//REPORT06 DD SYSOUT=* 03326000
//REPORT07 DD SYSOUT=* 03327000
//REPORT08 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=338) 03328000
//REPORT09 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=338) 03329000
//REPORT10 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=163) 03330000
//REPORT11 DD SYSOUT=* 03331000
//REPORT12 DD SYSOUT=* 03332000
//REPORT13 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=274) 03333000
//REPORT14 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=274) 03334000
//REPORT15 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=274) 03334200
//REPORT16 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=274) 03334400
//REPORT17 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=274) 03334600
//REPORT18 DD SYSOUT=* 03334680
//REPORT19 DD SYSOUT=* 03334760
//REPORT20 DD SYSOUT=* 03334840
//REPORT21 DD SYSOUT=* 03334920
//REPORT22 DD SYSOUT=* 03334960
//REPORT23 DD SYSOUT=* 03334980
//REPORT24 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=274) 03334990
//REPORT25 DD SYSOUT=* 03334995
//REPORT26 DD SYSOUT=* 03334997
//REPORT27 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=274) 03334998
//REPORT28 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=274) 03334999
//REPORT29 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=274) 03335290
//REPORT30 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=274) 03335380
//REPORT31 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=274) 03335470
//REPORT32 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=282) 03335520
//REPORT33 DD SYSOUT=* 03335530
//REPORT34 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=274) 03335540
//REPORT35 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=274) 03335550
//REPORT36 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=72) 03335560
//REPORT37 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=274) 03335570
//REPORT38 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=274) 03335575
//REPORT39 DD SYSOUT=*,DCB=(RECFM=FB,LRECL=274) 03335577
//* 03335580