* SET_DB_I.TXT HARASAWA (IBM DB2)
=IF{_DB!='I'}JUMP{I_SKIP};
************( CREATE DATABASE )***********************
=WRITE_OPEN{1,?_TMP?SETUP_?_SYSTEM?.TXT,OT,/};
W+=SET{WC.DDAT_PATH=WC.DR1+':'};
W-=SET{WC.DDAT_PATH=WC.DDAT1};
=SET{WC='CREATE DATABASE I_?_SYSTEM? ON ?WC.DDAT_PATH? USING CODESET UTF-8 TERRITORY JP AUTOCONFIGURE APPLY DB AND DBM'};
=WRITE{1,WC};
************( CREATE BUFFERPOOL )***********************
=SET{WC='CONNECT TO I_?_SYSTEM?'};WRITE{1,WC};
=SET{WC='CREATE BUFFERPOOL I_?_SYSTEM?_BP32K PAGESIZE 32K'};WRITE{1,WC};
************( CREATE SYSTEM TEMPORARY )*****************
=SET{WC='CREATE SYSTEM TEMPORARY TABLESPACE I_?_SYSTEM?_ST32K PAGESIZE 32K'
=+' MANAGED BY AUTOMATIC STORAGE BUFFERPOOL I_?_SYSTEM?_BP32K'};WRITE{1,WC};
=IF{$ARCHIVE='YES'}WRITE{1,'UPDATE DB CFG USING LOGARCHMETH1 DISK:?WC.BLOG1?'};
=SET{WC='UPDATE DB CFG FOR I_?_SYSTEM? USING NEWLOGPATH ?WC.DLOG1?'};WRITE{1,WC};
=WRITE_CLOSE{1};
*(PERMISSION_BEGIN)*	
=IF{_DB!='I'}JUMP{I_SKIP};
=WRITE_OPEN{1,?_TMP?SETUP_?_SYSTEM?.BAT,OT,SHIFT_JIS};
W+=WRITE{1,'@ECHO OFF'};
=SET{WREAL_TEST='REAL'};
*(PERMISSION_END)*
W+=SET{WC.DB2='DB2CMD -I -C -W DB2',WC.DB2_END=};
W-=SET{WC.DB2='su - db2inst1 -c ''db2',WC.DB2_END=''''};
=SET{WC='?$WC.ECHO? LOG > ?_TMP?SETUP_?_SYSTEM?.LOG'};WRITE{1,WC};
W-=SET{WC='chmod 777      ?_TMP?SETUP_?_SYSTEM?.LOG'};WRITE{1,WC};
=SET{WC='?WC.DB2? -f ?_TMP?SETUP_?_SYSTEM?.TXT ?WC.DB2_END? >>?_TMP?SETUP_?_SYSTEM?.LOG'};
=WRITE{1,WC};
W+=SET{WC='NET LOCALGROUP DB2USERS /ADD'};
W-=SET{WC='cut -d: -f1 /etc/group|grep db2users>/dev/null;if test $?_Q? != 0;then groupadd db2users;fi'};
=WRITE{1,WC};
*(PERMISSION_BEGIN)*
**************( NET USER )***********************************
=IF{_DB!='I'}JUMP{I_SKIP};
REPEAT0=$W0.PERMISSION
REPEAT=2 (WC.M_W##)
****=SET{WC.PAS=WC.PASSWORD_?WC.REAL_TEST##?};
=SET{WC.LTR=WC.REAL_TEST##};
=SET{W0.REPEAT2CNT=0};
REPEAT2=4 (WC.DIOL--)
=COMPUTE{W0.REPEAT2CNT+=1};
=MESSAGE{NET USER (?WC.REAL_TEST##?,?WC.PER$$?)}; 
***=IF{W0.REPEAT2CNT=4}SET{WC.PAS=WC.PASSWORD_LINK};
=IF{W0.REPEAT2CNT=4}SET{WC.LTR='LINK'};
=SET{WC.DIOL=WC.DIOL?W0.REPEAT2CNT?};
=SET{WC.USER='?_SYSTEM??WC.R_T##??WC.DIOL??WC.PER$$?'}; 
=SET{WC.USER=WC.USER@LOWER}; 
**W+=SET{WC='NET USER ?WC.USER? ?WC.PAS? /ADD /EXPIRES:NEVER'
***W+=     +' /PASSWORDCHG:NO'};
***W+=WRITE{1,WC};
*** VER37.8.0.12 ***
=IF_ERROR_LOGIN_ZZ_ADDLOGIN{?WC.LTR?}{?WC.USER?}{}NOP{};
*W-=SET{WC='CUT -D: -F1 /ETC/PASSWD|GREP ?WC.USER?>/DEV/NULL'
***W-=};WRITE{1,WC@LOWER};
**W-=SET{WC='IF TEST $?_Q? != 0 ;THEN'};WRITE{1,WC@LOWER};
***W-=SET{_LOWER='   USERADD -G DB2USERS -D /HOME'};
***W-=SET{WC=_LOWER+'/I ?WC.USER?'};WRITE{1,WC};
***W-=SET{WC='   PASSWD ?WC.USER?<<END'};WRITE{1,WC@LOWER};
***W-=SET{WC='?WC.PAS?'};WRITE{1,WC};
***W-=SET{WC='?WC.PAS?'};WRITE{1,WC};
***W-=SET{WC='END'};WRITE{1,WC@LOWER};
***W-=SET{WC='FI'};WRITE{1,WC@LOWER};
W+=SET{WC='NET LOCALGROUP DB2USERS ?WC.USER? /ADD'};
W+=WRITE{1,WC};
W+=SET{WC='NET LOCALGROUP USERS ?WC.USER? /DELETE'};
W+=WRITE{1,WC};
W+=SET{WC='WMIC USERACCOUNT WHERE (NAME="?WC.USER?")'
W+=     +' SET PASSWORDEXPIRES=FALSE'};
W+=WRITE{1,WC};
REPEAT0=
*(PERMISSION_END)*
*****( DB2CMD )**********************************************
=SET{WC='?WC.DB2? TERMINATE ?WC.DB2_END? >>?_TMP?SETUP_?_SYSTEM?.LOG'};WRITE{1,WC};
W+=SET{WC.I_INS='DB2',WC.OSTYPE='WIN'};
W-=SET{WC.I_INS='db2inst1',WC.OSTYPE='LINUX'};
W+=SET{WC='NET STOP DB2 ?WC.DB2_END? >>?_TMP?SETUP_?_SYSTEM?.LOG'};WRITE{1,WC};
W-=SET{WC='?WC.DB2? DB2STOP ?WC.DB2_END? >>?_TMP?SETUP_?_SYSTEM?.LOG'};WRITE{1,WC};
W+=SET{WC='NET START DB2 ?WC.DB2_END? >>?_TMP?SETUP_?_SYSTEM?.LOG'};WRITE{1,WC};
W-=SET{WC='?WC.DB2? DB2START ?WC.DB2_END? >>?_TMP?SETUP_?_SYSTEM?.LOG'};WRITE{1,WC};
W+=SET{WC='@ECHO OFF'};WRITE{1,WC};
=IF{$ARCHIVE='NO'}JUMP{ARCHIVE_SKIP};
******( ARCHIVE='YES' は最初の１回のみ OFFLINE でバックアップをする必要が有り）**********
=MAKE_DIR{?_OS_DRIVE??_P?I?_P?TMP?_P?I.BACKUP.I.?_SYSTEM?.00000101};
=SET{WC='?WC.DB2? BACKUP DB I_?_SYSTEM? USER ?$LOGIN_ID? USING ?$PASSWORD_ADMIN? TO ?_OS_DRIVE??_P?I?_P?TMP?_P?I.BACKUP.I.?_SYSTEM?.00000101 ?WC.DB2_END? >>?_TMP?SETUP_?_SYSTEM?.LOG'};
=WRITE{1,WC};
=ARCHIVE_SKIP:
=WRITE_CLOSE{1};
W-=COMMAND{chmod 777 ?_TMP?SETUP_?_SYSTEM?.BAT};
=COMMAND{?_TMP?SETUP_?_SYSTEM?.BAT}NOP{};
=ERASE_DIR{I.BACKUP.I.?_SYSTEM?.00000101};
=MESSAGE{GRANT ...};
=IF_ERROR_LOGIN_SQL{GRANT DBADM,CREATE_NOT_FENCED,IMPLICIT_SCHEMA ON
=DATABASE TO USER ?WC.L_SYSTEM?rdzzzz}ERROR{?_DB_ERROR? ?_ERROR?};
=IF_ERROR_LOGIN_SQL{GRANT SELECT ON SYSIBM.SYSDUMMY1 TO PUBLIC}
=  IF{_DB_I_ERROR!='EXIST'}ERROR{?_DB_ERROR??_ERROR?};
=JUMP{SKIP};
*(PERMISSION_BEGIN)*
W+=SET{WC='@ECHO OFF'};WRITE{1,WC};
=WRITE_CLOSE{1};
*W+=EXE_WAIT{?_I?IROOT?_OS??_FRAMEWORK?.EXE,
*W+=  ?_TMP?SETUP_?_SYSTEM?.BAT};
W+=COMMAND{CALL ?_I?IROOT?_OS??_FRAMEWORK?.EXE
W+=  ?_TMP?SETUP_?_SYSTEM?.BAT};
W-=SET{WC.CHMOD='CHMOD'};
W-=COMMAND{?WC.CHMOD@LOWER? 777 ?_TMP?SETUP_?_SYSTEM?.BAT};
W-=COMMAND{?_TMP?SETUP_?_SYSTEM?.BAT};
=SKIP:
=ERASE_FILE{SETUP_?_SYSTEM?.BAT};
=MESSAGE{CREATE SCHEMA};
****( CREATE SCHEMA )****************************************
REPEAT0=$W0.PERMISSION
REPEAT=2  (WC.R_T##=R;T)
=SET{W0.REPEAT2CNT=0};
REPEAT2=2 (WC.M_W=M;W) 
=COMPUTE{W0.REPEAT2CNT+=1};
=SET{WC.M_W=WC.M_W?W0.REPEAT2CNT?};
=SET{WC.SCHEMA='?WC.IS??WC.R_T##?_?WC.M_W?_?WC.PER$$?'};
=SET{WC.AUTH='?_SYSTEM??WC.R_T##?D?WC.PER$$?'};
=SET{WC.AUTH =WC.AUTH@LOWER};
=IF_ERROR_LOGIN_SQL{
=   CREATE SCHEMA ?WC.SCHEMA? AUTHORIZATION ?WC.AUTH?}
=  IF{_DB_I_ERROR!='EXIST'}ERROR{?_DB_ERROR? ?_ERROR?};
REPEAT0=
*************************************************************
=MESSAGE{GRANT ...};
REPEAT0=$W0.PERMISSION
REPEAT=3
=SET{W0.REPEAT2CNT=0}; 
REPEAT2=2 (WC.PER--(ZZZZ;自分))
=COMPUTE{W0.REPEAT2CNT+=1};
=SET{WC.PERX=WC.PER?W0.REPEAT2CNT?};
=SET{WC.G='GRANT ALTERIN,CREATEIN,DROPIN ON SCHEMA'
=        +' ?WC.IS??WC.RTT##?_'};
=SET{_LOWER='?_SYSTEM?RDZZZZ',WC.USER=_LOWER};
=LOGIN_SQL{?WC.G?M_?WC.PER$$? TO USER ?WC.USER?};
=SET{_LOWER='?_SYSTEM??WC.RRT##?D?WC.PERX?',WC.USER=_LOWER};
=LOGIN_SQL{?WC.G?M_?WC.PER$$? TO USER ?WC.USER?};
=LOGIN_SQL{?WC.G?W_?WC.PER$$? TO USER ?WC.USER?};
=SET{_LOWER='?_SYSTEM??WC.RRT##?I?WC.PERX?',WC.USER=_LOWER};
=LOGIN_SQL{?WC.G?W_?WC.PER$$? TO USER ?WC.USER?};
=SET{_LOWER='?_SYSTEM??WC.RRT##?O?WC.PERX?',WC.USER=_LOWER};
=LOGIN_SQL{?WC.G?W_?WC.PER$$? TO USER ?WC.USER?};
=SET{WC.G='GRANT CONNECT ON DATABASE TO USER'};
=SET{_LOWER='?_SYSTEM??WC.RRT##?L?WC.PERX?',WC.USER=_LOWER};
=LOGIN_SQL{?WC.G? ?WC.USER?};
=IF{WC.PER$$='ZZZZ'}JUMP{SKIP};
REPEAT2= 
=SKIP:
REPEAT0=
=JUMP{I_SKIP};
********( OBJECT_VIEW )**************************************
NAME=I_OBJECT_VIEW
=SET{WC.I=WC.INSERT+'''I'','};
COPY=ADD10
=SQL{?WC?'(SYSTEM_KIND,SYSTEM_REAL,SYSTEM_WORK')};
COPY=ADD10
=SQL{?WC?',SYSTEM_USER_X,SYSTEM_NAME,SYSTEM_TEXT')};
COPY=ADD10
=SQL{?WC?',SYSTEM_ADD_DATE17,SYSTEM_CHANGE_DATE17)')};
COPY=ADD10
=SQL{?WC?' AS SELECT CAST(''TABLE'' AS CHAR(5))')};
COPY=ADD10
=SQL{?WC?',CAST(''?_Q?_REAL_TEST?_Q?'' AS CHAR(4))')};
COPY=ADD10
=SQL{?WC?',CAST(''?WC.MAST_WORK?'' AS CHAR(4))')};
COPY=ADD10
=SQL{?WC?',CAST(SUBSTR(DEFINER,LENGTH(DEFINER)-4,1)')};
COPY=ADD10
=SQL{?WC?' AS CHAR(1))')};
COPY=ADD10
=SQL{?WC?',CAST(NAME AS CHAR(90))')};
COPY=ADD10
=SQL{?WC?',CAST(NULL AS VARCHAR(12000))')};
COPY=ADD10
=SQL{?WC?',CAST(REPLACE(REPLACE(CHAR(CTIME)')};
COPY=ADD10
=SQL{?WC?',''-'',''''),''.'','''') AS CHAR(17))')};
COPY=ADD10
=SQL{?WC?',CAST('' '' AS CHAR(17))')};
COPY=ADD10
=SQL{?WC?' FROM SYSIBM.SYSTABLES')};
COPY=ADD10
=SQL{?WC?' WHERE CREATOR=''?WC.I_DB?''')};
COPY=ADD10
=SQL{?WC?' AND TYPE=''T''')};
COPY=ADD10
=SQL{?WC?' UNION ALL SELECT CAST(''VIEW'' AS CHAR(5))')};
COPY=ADD10
=SQL{?WC?',CAST(''?_Q?_REAL_TEST?_Q?'' AS CHAR(4))')};
COPY=ADD10
=SQL{?WC?',CAST(''?WC.MAST_WORK?'' AS CHAR(4))')};
COPY=ADD10
=SQL{?WC?',CAST(SUBSTR(T.DEFINER,LENGTH(T.DEFINER)-4,1)')};
COPY=ADD10
=SQL{?WC?' AS CHAR(1))')};
COPY=ADD10
=SQL{?WC?',CAST(V.NAME AS CHAR(90))')};
COPY=ADD10
=SQL{?WC?',CAST(V.TEXT AS VARCHAR(12000))')};
COPY=ADD10
=SQL{?WC?',CAST(REPLACE(REPLACE(CHAR(T.CTIME)')};
COPY=ADD10
=SQL{?WC?',''-'',''''),''.'','''') AS CHAR(17))')};
COPY=ADD10
=SQL{?WC?',CAST('' '' AS CHAR(17))')};
COPY=ADD10
=SQL{?WC?' FROM SYSIBM.SYSVIEWS V')};
COPY=ADD10
=SQL{?WC?',SYSIBM.SYSTABLES T WHERE')};
COPY=ADD10
=SQL{?WC?' V.CREATOR=''?WC.I_DB?''')};
COPY=ADD10
=SQL{?WC?' AND V.NAME=T.NAME')};
COPY=ADD10
=SQL{?WC?' AND T.CREATOR=''?WC.I_DB?''')};
COPY=ADD10
=SQL{?WC?' UNION ALL SELECT CAST(''FUNC'' AS CHAR(5))')};
COPY=ADD10
=SQL{?WC?',CAST(''?_Q?_REAL_TEST?_Q?'' AS CHAR(4))')};
COPY=ADD10
=SQL{?WC?',CAST(''?WC.MAST_WORK?'' AS CHAR(4))')};
COPY=ADD10
=SQL{?WC?',CAST(SUBSTR(DEFINER,LENGTH(DEFINER)-4,1)')};
COPY=ADD10
=SQL{?WC?' AS CHAR(1))')};
COPY=ADD10
=SQL{?WC?',CAST(NAME AS CHAR(90))')};
COPY=ADD10
=SQL{?WC?',CAST(BODY AS VARCHAR(12000))')};
COPY=ADD10
=SQL{?WC?',CAST(REPLACE(REPLACE(CHAR(CREATE_TIME)')};
COPY=ADD10
=SQL{?WC?',''-'',''''),''.'','''') AS CHAR(17))')};
COPY=ADD10
=SQL{?WC?',CAST('' '' AS CHAR(17))')};
COPY=ADD10
=SQL{?WC?' FROM SYSIBM.SYSFUNCTIONS')};
COPY=ADD10
=SQL{?WC?' WHERE SCHEMA=''?WC.I_DB?''')};
COPY=ADD10
=SQL{?WC?' UNION ALL SELECT CAST(''PROC'' AS CHAR(5))')};
COPY=ADD10
=SQL{?WC?',CAST(''?_Q?_REAL_TEST?_Q?'' AS CHAR(4))')};
COPY=ADD10
=SQL{?WC?',CAST(''?WC.MAST_WORK?'' AS CHAR(4))')};
COPY=ADD10
=SQL{?WC?',CAST(SUBSTR(DEFINER,LENGTH(DEFINER)-4,1)')};
COPY=ADD10
=SQL{?WC?' AS CHAR(1))')};
COPY=ADD10
=SQL{?WC?',CAST(PROCNAME AS CHAR(90))')};
COPY=ADD10
=SQL{?WC?',CAST(TEXT AS VARCHAR(12000))')};
COPY=ADD10
=SQL{?WC?',CAST(REPLACE(REPLACE(CHAR(CREATE_TIME)')};
COPY=ADD10
=SQL{?WC?',''-'',''''),''.'','''') AS CHAR(17))')};
COPY=ADD10
=SQL{?WC?',CAST('' '' AS CHAR(17))')};
COPY=ADD10
=SQL{?WC?' FROM  SYSIBM.SYSPROCEDURES')};
COPY=ADD10
=SQL{?WC?' WHERE PROCSCHEMA=''?WC.I_DB?'' ')};
COPY=ADD10
=SQL{?WC?' UNION ALL SELECT CAST(''TRIG'' AS CHAR(5))')};
COPY=ADD10
=SQL{?WC?',CAST(''?_Q?_REAL_TEST?_Q?'' AS CHAR(4))')};
COPY=ADD10
=SQL{?WC?',CAST(''?WC.MAST_WORK?'' AS CHAR(4))')};
COPY=ADD10
=SQL{?WC?',CAST(SUBSTR(DEFINER,LENGTH(DEFINER)-4,1)')};
COPY=ADD10
=SQL{?WC?' AS CHAR(1))')};
COPY=ADD10
=SQL{?WC?',CAST(NAME AS CHAR(90))')};
COPY=ADD10
=SQL{?WC?',CAST(TEXT AS VARCHAR(12000))')};
COPY=ADD10
=SQL{?WC?',CAST(REPLACE(REPLACE(CHAR(CREATE_TIME)')};
COPY=ADD10
=SQL{?WC?',''-'',''''),''.'','''') AS CHAR(17))')};
COPY=ADD10
=SQL{?WC?',CAST('' '' AS CHAR(17))')};
COPY=ADD10
=SQL{?WC?' FROM SYSIBM.SYSTRIGGERS')};
COPY=ADD10
=SQL{?WC?' WHERE SCHEMA=''?WC.I_DB?'' ')};
*****( COLUMN_VIEW )*****************************************
NAME=I_COLUMN_VIEW
=SET{WC.I=WC.INSERT+'''I'','};
COPY=ADD10
=SQL{?WC?'(SYSTEM_KIND,SYSTEM_REAL,SYSTEM_WORK')};
COPY=ADD10
=SQL{?WC?',SYSTEM_USER_X,SYSTEM_NAME,SYSTEM_SEQ')};
COPY=ADD10
=SQL{?WC?',SYSTEM_DATA_NAME,SYSTEM_DEFAULT_TYPE')};
COPY=ADD10
=SQL{?WC?',SYSTEM_DEFAULT_LENGTH1')};
COPY=ADD10
=SQL{?WC?',SYSTEM_DEFAULT_LENGTH2,SYSTEM_DEFAULT')};
COPY=ADD10
=SQL{?WC?',SYSTEM_NULL)AS SELECT')};
COPY=ADD10
=SQL{?WC?' CAST(CASE T.TYPE WHEN ''V''')};
COPY=ADD10
=SQL{?WC?' THEN ''VIEW'' ELSE ''TABLE'' END AS CHAR(5))')};
COPY=ADD10
=SQL{?WC?',CAST(''?_Q?_REAL_TEST?_Q?'' AS CHAR(4))')};
COPY=ADD10
=SQL{?WC?',CAST(''?WC.MAST_WORK?'' AS CHAR(4))')};
COPY=ADD10
=SQL{?WC?',CAST(SUBSTR(DEFINER,LENGTH(DEFINER)-4,1)')};
COPY=ADD10
=SQL{?WC?' AS CHAR(1))')};
COPY=ADD10
=SQL{?WC?',CAST(C.TBNAME AS CHAR(90))')};
COPY=ADD10
=SQL{?WC?',COLNO+1,CAST(C.NAME AS CHAR(90))')};
COPY=ADD10
=SQL{?WC?',CAST(CASE C.COLTYPE')};
COPY=ADD10
=SQL{?WC?' WHEN ''INTEGER'' THEN ''INT''')};
COPY=ADD10
=SQL{?WC?' WHEN ''SMALLINT'' THEN ''INT''')};
COPY=ADD10
=SQL{?WC?' WHEN ''TIMESTMP'' THEN ''DATETIME''')};
COPY=ADD10
=SQL{?WC?' WHEN ''DOUBLE'' THEN ''FLOAT''')};
COPY=ADD10
=SQL{?WC?' WHEN ''CHAR''    THEN')};
COPY=ADD10
=SQL{?WC?' CASE SYSTEM_DEFAULT_TYPE')};
COPY=ADD10
=SQL{?WC?' WHEN ''NCHAR''    THEN ''NCHAR''')};
COPY=ADD10
=SQL{?WC?' ELSE C.COLTYPE END')};
COPY=ADD10
=SQL{?WC?' WHEN ''VARCHAR''  THEN ')};
COPY=ADD10
=SQL{?WC?' CASE SYSTEM_DEFAULT_TYPE')};
COPY=ADD10
=SQL{?WC?' WHEN ''NVARCHAR'' THEN ''NVARCHAR''')};
COPY=ADD10
=SQL{?WC?' ELSE C.COLTYPE END')};
COPY=ADD10
=SQL{?WC?' ELSE C.COLTYPE END AS CHAR(9))')};
COPY=ADD10
=SQL{?WC?',CAST(CASE C.COLTYPE')};
COPY=ADD10
=SQL{?WC?' WHEN ''DECIMAL'' THEN C.LENGTH ')};
COPY=ADD10
=SQL{?WC?' WHEN ''CHAR''    THEN')};
COPY=ADD10
=SQL{?WC?' CASE SYSTEM_DEFAULT_TYPE')};
COPY=ADD10
=SQL{?WC?' WHEN ''NCHAR''')};
COPY=ADD10
=SQL{?WC?' THEN C.LENGTH/?_UTF8_SET?')};
COPY=ADD10
=SQL{?WC?' ELSE C.LENGTH END')};
COPY=ADD10
=SQL{?WC?' WHEN ''VARCHAR'' THEN')};
COPY=ADD10
=SQL{?WC?' CASE SYSTEM_DEFAULT_TYPE')};
COPY=ADD10
=SQL{?WC?' WHEN ''NVARCHAR''')};
COPY=ADD10
=SQL{?WC?' THEN C.LENGTH/?_UTF8_SET?')};
COPY=ADD10
=SQL{?WC?' ELSE C.LENGTH END')};
COPY=ADD10
=SQL{?WC?' WHEN ''TEXT'' THEN 4000')};
COPY=ADD10
=SQL{?WC?' WHEN ''CLOB'' THEN 4000 ')};
COPY=ADD10
=SQL{?WC?' WHEN ''TIMESTMP'' THEN 17')};
COPY=ADD10
=SQL{?WC?' WHEN ''DATE'' THEN 8')};
COPY=ADD10
=SQL{?WC?' ELSE 9 END AS INT)')};
COPY=ADD10
=SQL{?WC?',CAST(CASE C.COLTYPE')};
COPY=ADD10
=SQL{?WC?' WHEN ''DECIMAL'' THEN C.SCALE')};
COPY=ADD10
=SQL{?WC?' ELSE 0 END AS INT)')};
COPY=ADD10
=SQL{?WC?',CAST(C.DEFAULT AS CHAR(90))')};
COPY=ADD10
=SQL{?WC?',CAST(CASE C.NULLS WHEN ''N'' ')};
COPY=ADD10
=SQL{?WC?' THEN ''0'' ELSE ''1'' END AS CHAR(1))')};
COPY=ADD10
=SQL{?WC?' FROM SYSIBM.SYSCOLUMNS C')};
COPY=ADD10
=SQL{?WC?' INNER JOIN SYSIBM.SYSTABLES T')};
COPY=ADD10
=SQL{?WC?' ON C.TBNAME=T.NAME')};
COPY=ADD10
=SQL{?WC?' AND C.TBCREATOR=T.CREATOR')};
COPY=ADD10
=SQL{?WC?' LEFT OUTER JOIN')};
COPY=ADD10
=SQL{?WC?' I_?_Q?_SYSTEM?_Q?_R_M_ZZZZ')};
COPY=ADD10
=SQL{?WC?'.ZZZZZZ_I_DICTIONARY_TABLE')};
COPY=ADD10
=SQL{?WC?' ON C.NAME=SYSTEM_DATA_NAME')};
COPY=ADD10
=SQL{?WC?' AND SYSTEM_PERMISSION=''?WC.PER?''')};
COPY=ADD10
=SQL{?WC?' AND SYSTEM_LANG=''?_LANG_SYSTEM?''')};
COPY=ADD10
=SQL{?WC?' WHERE C.TBCREATOR=''?WC.I_DB?''')};
*****( INDEX_VIEW )***************************************
NAME=I_INDEX_VIEW
=SET{WC.I=WC.INSERT+'''I'','};
COPY=ADD10
=SQL{?WC?'(SYSTEM_REAL,SYSTEM_WORK,SYSTEM_USER_X')};
COPY=ADD10
=SQL{?WC?',SYSTEM_NAME,SYSTEM_DATA_NAME')};
COPY=ADD10
=SQL{?WC?',SYSTEM_IX,SYSTEM_NO)AS SELECT')};
COPY=ADD10
=SQL{?WC?' CAST(''?_Q?_REAL_TEST?_Q?'' AS CHAR(4))')};
COPY=ADD10
=SQL{?WC?',CAST(''?WC.MAST_WORK?'' AS CHAR(4))')};
COPY=ADD10
=SQL{?WC?',CAST(SUBSTR(DEFINER,LENGTH(DEFINER)-4,1)')};
COPY=ADD10
=SQL{?WC?' AS CHAR(1))')};
COPY=ADD10
=SQL{?WC?',CAST(TBNAME AS CHAR(90))')};
COPY=ADD10
=SQL{?WC?',CAST(COLNAME AS CHAR(90))')};
COPY=ADD10
=SQL{?WC?',CAST(SUBSTR(NAME,2,1) AS CHAR(1))')};
COPY=ADD10
=SQL{?WC?',CAST(COLSEQ-CASE WHEN UNIQUERULE<>''D''')};
COPY=ADD10
=SQL{?WC?' THEN 1 ELSE 0 END AS INT)')};
COPY=ADD10
=SQL{?WC?' FROM SYSIBM.SYSINDEXES')};
COPY=ADD10
=SQL{?WC?' INNER JOIN SYSIBM.SYSINDEXCOLUSE')};
COPY=ADD10
=SQL{?WC?' ON NAME=INDNAME')};
COPY=ADD10
=SQL{?WC?' AND CREATOR=INDSCHEMA')};
COPY=ADD10
=SQL{?WC?' LEFT JOIN SYSIBM.SYSCONSTDEP')};
COPY=ADD10
=SQL{?WC?' ON NAME=BNAME')};
COPY=ADD10
=SQL{?WC?' AND CREATOR=BCREATOR')};
COPY=ADD10
=SQL{?WC?' AND DTBCREATOR=''?WC.I_DB?''')};
COPY=ADD10
=SQL{?WC?' WHERE SUBSTR(NAME,1,2)')};
COPY=ADD10
=SQL{?WC?' IN(''X0'',''X1'',''X2'',''X3'',''X4''')};
COPY=ADD10
=SQL{?WC?',''X5'',''X6'',''X7'',''X8'',''X9'')')};
COPY=ADD10
=SQL{?WC?' AND TBCREATOR=''?WC.I_DB?''')};
*****( GRANT_VIEW )***************************************
NAME=I_GRANT_VIEW
=SET{WC.I=WC.INSERT+'''I'','};
COPY=ADD10
=SQL{?WC?'(SYSTEM_KIND,SYSTEM_REAL,SYSTEM_WORK')};
COPY=ADD10
=SQL{?WC?',SYSTEM_USER_X,SYSTEM_NAME,SYSTEM_GRANT')};
COPY=ADD10
=SQL{?WC?',SYSTEM_SELECT,SYSTEM_INSERT')};
COPY=ADD10
=SQL{?WC?',SYSTEM_UPDATE,SYSTEM_DELETE')};
COPY=ADD10
=SQL{?WC?',SYSTEM_EXECUTE)AS SELECT')};
COPY=ADD10
=SQL{?WC?' CAST(CASE T.TYPE')};
COPY=ADD10
=SQL{?WC?' WHEN ''V'' THEN ''VIEW''')};
COPY=ADD10
=SQL{?WC?' ELSE ''TABLE'' END AS CHAR(5))')};
COPY=ADD10
=SQL{?WC?',CAST(''?_Q?_REAL_TEST?_Q?'' AS CHAR(4))')};
COPY=ADD10
=SQL{?WC?',CAST(''?WC.MAST_WORK?'' AS CHAR(4))')};
COPY=ADD10
=SQL{?WC?',CAST(SUBSTR(DEFINER,LENGTH(DEFINER)-4,1)')};
COPY=ADD10
=SQL{?WC?' AS CHAR(1))')};
COPY=ADD10
=SQL{?WC?',CAST(T.NAME AS CHAR(90))')};
COPY=ADD10
=SQL{?WC?',CAST(CASE WHEN LENGTH(RTRIM(G.GRANTEE))')};
COPY=ADD10
=SQL{?WC?' >6 THEN SUBSTR(G.GRANTEE')};
COPY=ADD10
=SQL{?WC?',LENGTH(RTRIM(G.GRANTEE))-4,1)')};
COPY=ADD10
=SQL{?WC?'||''_''||SUBSTR(G.GRANTEE')};
COPY=ADD10
=SQL{?WC?',LENGTH(RTRIM(G.GRANTEE))-3)')};
COPY=ADD10
=SQL{?WC?' ELSE G.GRANTEE END AS CHAR(6))')};
COPY=ADD10
=SQL{?WC?',CAST(CASE G.SELECTAUTH WHEN ''N''')};
COPY=ADD10
=SQL{?WC?' THEN '' '' ELSE ''S'' END AS CHAR(1))')};
COPY=ADD10
=SQL{?WC?',CAST(CASE G.INSERTAUTH WHEN ''N''')};
COPY=ADD10
=SQL{?WC?' THEN '' '' ELSE ''I'' END AS CHAR(1))')};
COPY=ADD10
=SQL{?WC?',CAST(CASE G.UPDATEAUTH WHEN ''N''')};
COPY=ADD10
=SQL{?WC?' THEN '' '' ELSE ''U'' END AS CHAR(1))')};
COPY=ADD10
=SQL{?WC?',CAST(CASE G.DELETEAUTH WHEN ''N''')};
COPY=ADD10
=SQL{?WC?' THEN '' '' ELSE ''D'' END AS CHAR(1))')};
COPY=ADD10
=SQL{?WC?',CAST('' '' AS CHAR(1))')};
COPY=ADD10
=SQL{?WC?' FROM SYSIBM.SYSTABLES T')};
COPY=ADD10
=SQL{?WC?',SYSIBM.SYSTABAUTH G')};
COPY=ADD10
=SQL{?WC?' WHERE T.CREATOR=''?WC.I_DB?''')};
COPY=ADD10
=SQL{?WC?' AND (G.GRANTEE LIKE')};
COPY=ADD10
=SQL{?WC?' ''?_Q?_SYSTEM?_Q??_Q?_REAL_TEST[1;1]?_Q?%''')};
COPY=ADD10
=SQL{?WC?' OR G.GRANTEE=''PUBLIC'')')};
COPY=ADD10
=SQL{?WC?' AND G.TCREATOR=''?WC.I_DB?''')};
COPY=ADD10
=SQL{?WC?' AND T.NAME=G.TTNAME')};
NAME=
*************************************************************
=I_SKIP:
*(PERMISSION_END)*
