diff --git a/CISTOOLS/Functions/GENERATE_SQL.sql b/CISTOOLS/Functions/GENERATE_SQL.sql
index d6cf790..c7de98f 100644
--- a/CISTOOLS/Functions/GENERATE_SQL.sql
+++ b/CISTOOLS/Functions/GENERATE_SQL.sql
@@ -1 +1,106 @@
-âÅã@×ÁãÈ@\ÓÉÂÓ@^@
%
%ÃÙÅÁãÅ@ÖÙ@ÙÅ×ÓÁÃÅ@ÆäÕÃãÉÖÕ@ÃÉâãÖÖÓâKÇÅÕÅÙÁãÅmâØÓ@M@
%ÉÕÖÂÑ@åÁÙÃÈÁÙMòõö]@k@
%ÉÕÓÉÂ@åÁÙÃÈÁÙMñòø]@ÄÅÆÁäÓã@@}\ÁÓÓ}@@k@
%ÉÕãè×@åÁÙÃÈÁÙMñòø]@ÄÅÆÁäÓã@@}\ÁÓÓ}@@]@
%ÙÅãäÙÕâ@åÁÙÃÈÁÙMóòððð]@@@
%ÓÁÕÇäÁÇÅ@âØÓ@
%â×ÅÃÉÆÉÃ@ÃÉâãÖÖÓâKÇÅÕÅÙÁãÅmâØÓ@
%ÕÖã@ÄÅãÅÙÔÉÕÉâãÉÃ@
%ÔÖÄÉÆÉÅâ@âØÓ@ÄÁãÁ@
%ÃÁÓÓÅÄ@ÖÕ@ÕäÓÓ@ÉÕ×äã@
%âÅã@Ö×ãÉÖÕ@@ÁÓæÂÓÒ@~@\ÁÓÓÙÅÁÄ@k@
%ÁÓæÃ×èÄãÁ@~@\Ö×ãÉÔÉéÅ@k@
%ÃÖÔÔÉã@~@\ÕÖÕÅ@k@
%ÄÅÃÙÅâäÓã@~@Móñk@óñk@ðð]@k@
%ÄèÕÄÆãÃÖÓ@~@\ÕÖ@k@
%ÄèÕäâÙ×ÙÆ@~@\ÖæÕÅÙ@k@
%âÙãâÅØ@~@\ÈÅç@@@
%ÂÅÇÉÕ@
%ÄÅÃÓÁÙÅ@Ùâ@ÙÅâäÓãmâÅãmÓÖÃÁãÖÙ@åÁÙèÉÕÇ@^@
%ÄÅÃÓÁÙÅ@ÕÖãmÆÖäÕÄ@åÁÙÃÈÁÙ@M@òõö@]@^@
%ÄÅÃÓÁÙÅ@ÙÅãäÙÕmåÁÓ@åÁÙÃÈÁÙ@M@óòððð@]@^@
%ÄÅÃÓÁÙÅ@â×ÓÉãm×Öâ@âÔÁÓÓÉÕã@ÄÅÆÁäÓã@ð@^@
%ÄÅÃÓÁÙÅ@ÓÉÂ@k@ãè×@k@ÖÂÑ@åÁÙÃÈÁÙ@M@ñòø@]@ÄÅÆÁäÓã@}}@^@
%ÄÅÃÓÁÙÅ@ÃÖÕãÉÕäÅ@ÈÁÕÄÓÅÙ@ÆÖÙ@âØÓâãÁãÅ@}ðñõóò}@
%ÂÅÇÉÕ@
%âÅã@ÙÅãäÙÕmåÁÓ@~@ÕÖãmÆÖäÕÄ@^@
%ÅÕÄ@^@
%âÅã@M@ÓÉÂ@k@ãè×@k@ÖÂÑ@]@~@M@ä××ÅÙ@M@ÉÕÓÉÂ@]@k@ä××ÅÙ@M@ÉÕãè×@]@k@ä××ÅÙ@M@ÉÕÖÂÑ@]]@^@
%âÅã@â×ÓÉãm×Öâ@~@ÙÅÇÅç×mÉÕâãÙ@M@ÖÂÑ@k@}ºKOa»}@]@^@
%ÉÆ@â×ÓÉãm×Öâ@n@ð@
%ÁÕÄ@M@ÓÉÂ@Éâ@ÕäÓÓ@
%ÖÙ@ãÙÉÔ@M@ÓÉÂ@]@~@}}@
%ÖÙ@ãÙÉÔ@M@ÓÉÂ@]@~@}\ÁÓÓ}@]@ãÈÅÕ@
%âÅã@ÓÉÂ@~@âäÂâãÙ@M@ÖÂÑ@k@ñ@k@â×ÓÉãm×Öâ@`@ñ@]@^@
%âÅã@ÖÂÑ@~@âäÂâãÙ@M@ÖÂÑ@k@â×ÓÉãm×Öâ@N@ñ@]@^@
%ÅÕÄ@ÉÆ@^@
%âÅÓÅÃã@ÖÂÑÓÖÕÇÕÁÔÅ@k@ÖÂÑÓÉÂ@k@âØÓmÖÂÑÅÃãmãè×Å@
%ÉÕãÖ@ÖÂÑ@k@ÓÉÂ@k@ãè×@
%ÆÙÖÔ@
%ãÁÂÓÅ@M@
%âÅÓÅÃã@\@
%ÆÙÖÔ@ãÁÂÓÅ@M@
%åÁÓäÅâ@M@
%ÃÁâÅ@ÓÉÂ@
%æÈÅÕ@}\ÁÓÓ}@ãÈÅÕ@}}@
%ÅÓâÅ@ÓÉÂ@
%ÅÕÄ@]@
%äÕÉÖÕ@ÁÓÓ@
%âÅÓÅÃã@âÃÈÅÔÁmÕÁÔÅ@
%ÆÙÖÔ@ÓÉÂÓÉâã@
%äÕÉÖÕ@ÁÓÓ@
%åÁÓäÅâ@M@
%ÃÁâÅ@ÓÉÂ@
%æÈÅÕ@}\ÁÓÓ}@ãÈÅÕ@ÓÉÂ@
%ÅÓâÅ@}}@
%ÅÕÄ@]@
%]@
%]@ç@M@ÓÉÂmÕÁÔÅ@]@
%ÑÖÉÕ@ãÁÂÓÅ@M@
%Øâèâò@K@ÖÂÑÅÃãmâãÁãÉâãÉÃâ@M@
%ÓÉÂmÕÁÔÅ@k@}\ÁÓÓ}@k@ÕäÓÓÉÆ@M@ÖÂÑ@k@}}@]@]@
%]@
%ÖÕ@ñ@~@ñ@
%æÈÅÙÅ@âØÓmÖÂÑÅÃãmãè×Å@Éâ@ÕÖã@ÕäÓÓ@
%ÁÕÄ@ÓÉÂmÕÁÔÅ@Ln@}}@
%ÁÕÄ@âØÓmÖÂÑÅÃãmãè×Å@~@ÃÖÁÓÅâÃÅ@M@
%ÕäÓÓÉÆ@M@ãè×@k@}\ÁÓÓ}@]@k@âØÓmÖÂÑÅÃãmãè×Å@]@
%ÁÕÄ@ÖÂÑ@~@ÃÖÁÓÅâÃÅ@M@ÖÂÑÓÖÕÇÕÁÔÅ@k@ÖÂÑÕÁÔÅ@]@
%ÓÉÔÉã@ñ@^@
%ÃÁÓÓ@Øâèâò@K@ÇÅÕÅÙÁãÅmâØÓ@M@ÄÁãÁÂÁâÅmÖÂÑÅÃãmÕÁÔÅ@~n@ÖÂÑ@k@
%ÄÁãÁÂÁâÅmÖÂÑÅÃãmÓÉÂÙÁÙèmÕÁÔÅ@~n@ÓÉÂ@k@ÄÁãÁÂÁâÅmÖÂÑÅÃãmãè×Å@~n@ãè×@k@
%ÃÙÅÁãÅmÖÙmÙÅ×ÓÁÃÅmÖ×ãÉÖÕ@~n@}ñ}@]@^@
%ÁââÖÃÉÁãÅ@ÙÅâäÓã@âÅã@ÓÖÃÁãÖÙ@M@Ùâ@]@æÉãÈ@×ÙÖÃÅÄäÙÅ@ÇÅÕÅÙÁãÅmâØÓ@^@
%ÁÓÓÖÃÁãÅ@âØÓmÃäÙ@ÃäÙâÖÙ@ÆÖÙ@ÙÅâäÓã@âÅã@Ùâ@^@
%âÅã@ÃÉâãÖÖÓâ@K@âØÓmâãÁãÅÔÅÕã@~@ÕäÓÓ@^@
%âÅã@ÃÉâãÖÖÓâ@K@âØÓmâãÁãÅÔÅÕã@~@M@
%âÅÓÅÃã@ãÙÉÔ@M@ÓÉâãÁÇÇ@M@ÃÁâã@M@ãÙÉÔ@M@âÙÃÄãÁ@]@Áâ@åÁÙÃÈÁÙ@M@óòððð@]@]@]@]@
%ÆÙÖÔ@ØãÅÔ×@K@ØmÇÅÕâØÓ@
%æÈÅÙÅ@ãÙÉÔ@M@âÙÃÄãÁ@]@Ln@}}@
%ÁÕÄ@âÙÃâÅØ@n@ö@]@^@
%ÉÆ@ÃÉâãÖÖÓâ@K@âØÓmâãÁãÅÔÅÕã@Éâ@ÕäÓÓ@ãÈÅÕ@
%âÅã@ÙÅãäÙÕmåÁÓ@~@}Ö‚‘…ƒ£@Õ–£@Æ–¤•„}@^@
%ÅÕÄ@ÉÆ@^@
%âÅã@ÙÅãäÙÕmåÁÓ@~@ÃÉâãÖÖÓâ@K@âØÓmâãÁãÅÔÅÕã@^@
%ÃÓÖâÅ@âØÓmÃäÙ@^@
%ÙÅãäÙÕ@ÙÅãäÙÕmåÁÓ@^@
%ÅÕÄ@@^@
%
%ÃÖÔÔÅÕã@ÖÕ@×ÁÙÁÔÅãÅÙ@â×ÅÃÉÆÉÃ@ÆäÕÃãÉÖÕ@ÃÉâãÖÖÓâKÇÅÕÅÙÁãÅmâØÓ@
%M@ÉÕÖÂÑ@Éâ@}Ö‚‘…ƒ£@Õ�”…}@k@
%ÉÕÓÉÂ@Éâ@}Ó‰‚™�™¨@Õ�”…}@k@
%ÉÕãè×@Éâ@}âØÓ@Ö‚‘…ƒ£@ã¨—…}@]@^@
%
%ÓÁÂÅÓ@ÖÕ@â×ÅÃÉÆÉÃ@ÆäÕÃãÉÖÕ@ÃÉâãÖÖÓâKÇÅÕÅÙÁãÅmâØÓ@
%Éâ@}Ç…•…™�£…@âØÓ@Æ™–”@Ö‚‘…ƒ£}@^@
%
%ÇÙÁÕã@
\ No newline at end of file
+SET PATH *LIBL ; 
+
+CREATE OR REPLACE FUNCTION CISTOOLS.GENERATE_SQL ( 
+	INOBJ VARCHAR(256) , 
+	INLIB VARCHAR(128) DEFAULT  '*ALL'  , 
+	INTYP VARCHAR(128) DEFAULT  '*ALL'  ) 
+	RETURNS VARCHAR(32000)   
+	LANGUAGE SQL 
+	SPECIFIC CISTOOLS.GENERATE_SQL 
+	NOT DETERMINISTIC 
+	MODIFIES SQL DATA 
+	CALLED ON NULL INPUT 
+	SET OPTION  ALWBLK = *ALLREAD , 
+	ALWCPYDTA = *OPTIMIZE , 
+	COMMIT = *NONE , 
+	DECRESULT = (31, 31, 00) , 
+	DYNDFTCOL = *NO , 
+	DYNUSRPRF = *OWNER , 
+	SRTSEQ = *HEX   
+	BEGIN 
+DECLARE RS RESULT_SET_LOCATOR VARYING ; 
+DECLARE NOT_FOUND VARCHAR ( 256 ) ; 
+DECLARE RETURN_VAL VARCHAR ( 32000 ) ; 
+DECLARE SPLIT_POS SMALLINT DEFAULT 0 ; 
+DECLARE LIB , TYP , OBJ VARCHAR ( 128 ) DEFAULT '' ; 
+DECLARE CONTINUE HANDLER FOR SQLSTATE '01532' 
+BEGIN 
+SET RETURN_VAL = NOT_FOUND ; 
+END ; 
+SET ( LIB , TYP , OBJ ) = ( UPPER ( INLIB ) , UPPER ( INTYP ) , UPPER ( INOBJ )) ; 
+SET SPLIT_POS = REGEXP_INSTR ( OBJ , '[.|/]' ) ; 
+IF SPLIT_POS > 0 
+AND ( LIB IS NULL 
+OR TRIM ( LIB ) = '' 
+OR TRIM ( LIB ) = '*ALL' ) THEN 
+SET LIB = SUBSTR ( OBJ , 1 , SPLIT_POS - 1 ) ; 
+SET OBJ = SUBSTR ( OBJ , SPLIT_POS + 1 ) ; 
+END IF ; 
+SELECT OBJLONGNAME , OBJLIB , SQL_OBJECT_TYPE 
+INTO OBJ , LIB , TYP 
+FROM 
+TABLE ( 
+SELECT * 
+FROM TABLE ( 
+VALUES ( 
+CASE LIB 
+WHEN '*ALL' THEN '' 
+ELSE LIB 
+END ) 
+UNION ALL 
+SELECT SCHEMA_NAME 
+FROM LIBLIST 
+UNION ALL 
+VALUES ( 
+CASE LIB 
+WHEN '*ALL' THEN LIB 
+ELSE '' 
+END ) 
+) 
+) X ( LIB_NAME ) 
+JOIN TABLE ( 
+QSYS2 . OBJECT_STATISTICS ( 
+LIB_NAME , '*ALL' , NULLIF ( OBJ , '' ) ) 
+) 
+ON 1 = 1 
+WHERE SQL_OBJECT_TYPE IS NOT NULL 
+AND LIB_NAME <> '' 
+AND SQL_OBJECT_TYPE = COALESCE ( 
+NULLIF ( TYP , '*ALL' ) , SQL_OBJECT_TYPE ) 
+AND OBJ = COALESCE ( OBJLONGNAME , OBJNAME ) 
+LIMIT 1 ; 
+CALL QSYS2 . GENERATE_SQL ( DATABASE_OBJECT_NAME => OBJ , 
+DATABASE_OBJECT_LIBRARY_NAME => LIB , DATABASE_OBJECT_TYPE => TYP , 
+CREATE_OR_REPLACE_OPTION => '1' ) ; 
+ASSOCIATE RESULT SET LOCATOR ( RS ) WITH PROCEDURE GENERATE_SQL ; 
+ALLOCATE SQL_CUR CURSOR FOR RESULT SET RS ; 
+SET CISTOOLS . SQL_STATEMENT = NULL ; 
+SET CISTOOLS . SQL_STATEMENT = ( 
+SELECT TRIM ( LISTAGG ( CAST ( TRIM ( SRCDTA ) AS VARCHAR ( 32000 ) ) ) ) 
+FROM QTEMP . Q_GENSQL 
+WHERE TRIM ( SRCDTA ) <> '' 
+AND SRCSEQ > 6 ) ; 
+IF CISTOOLS . SQL_STATEMENT IS NULL THEN 
+SET RETURN_VAL = 'Object Not Found' ; 
+END IF ; 
+SET RETURN_VAL = CISTOOLS . SQL_STATEMENT ; 
+CLOSE SQL_CUR ; 
+RETURN RETURN_VAL ; 
+END  ; 
+
+COMMENT ON PARAMETER SPECIFIC FUNCTION CISTOOLS.GENERATE_SQL 
+( INOBJ IS 'Object Name' , 
+	INLIB IS 'Library Name' , 
+	INTYP IS 'SQL Object Type' ) ; 
+
+LABEL ON SPECIFIC FUNCTION CISTOOLS.GENERATE_SQL 
+	IS 'Generate SQL From Object' ; 
+
+GRANT ALTER , EXECUTE   
+ON SPECIFIC FUNCTION CISTOOLS.GENERATE_SQL 
+TO AMAPICS WITH GRANT OPTION ; 
+
+GRANT EXECUTE   
+ON SPECIFIC FUNCTION CISTOOLS.GENERATE_SQL 
+TO PUBLIC ; 
+
