diff --git a/RESTAPI/Functions/EXECUTE_SQL2.sql b/RESTAPI/Functions/EXECUTE_SQL2.sql
index b3431a4..53eed20 100644
--- a/RESTAPI/Functions/EXECUTE_SQL2.sql
+++ b/RESTAPI/Functions/EXECUTE_SQL2.sql
@@ -1 +1,118 @@
-âÅã@×ÁãÈ@\ÓÉÂÓ@^@
%
%ÃÙÅÁãÅ@ÖÙ@ÙÅ×ÓÁÃÅ@ÆäÕÃãÉÖÕ@ÙÅâãÁ×ÉKÅçÅÃäãÅmâØÓò@M@
%ÉÕÁ××åÅÙ@åÁÙÃÈÁÙMñð]@ÄÅÆÁäÓã@@}¥ñ}@@k@
%ÉÕÁ××ÕÁÔÅ@åÁÙÃÈÁÙMñòø]@ÄÅÆÁäÓã@@}}@@k@
%ÉÕÁ××ÆäÕÃ@åÁÙÃÈÁÙMñòø]@ÄÅÆÁäÓã@@}}@@k@
%ÉÕâäÂâãÉãäãÅ@åÁÙÃÈÁÙMñðòôð]@ÄÅÆÁäÓã@@ÕäÓÓ@@]@
%ÙÅãäÙÕâ@ÃÓÖÂMòñô÷ôøóöô÷]@@@
%ÓÁÕÇäÁÇÅ@âØÓ@
%â×ÅÃÉÆÉÃ@ÙÅâãÁ×ÉKÅçÅÃäãÅmâØÓò@
%ÕÖã@ÄÅãÅÙÔÉÕÉâãÉÃ@
%ÔÖÄÉÆÉÅâ@âØÓ@ÄÁãÁ@
%ÃÁÓÓÅÄ@ÖÕ@ÕäÓÓ@ÉÕ×äã@
%ÕÖã@ÆÅÕÃÅÄ@
%âÅã@Ö×ãÉÖÕ@@ÁÓæÂÓÒ@~@\ÁÓÓÙÅÁÄ@k@
%ÁÓæÃ×èÄãÁ@~@\Ö×ãÉÔÉéÅ@k@
%ÃÖÔÔÉã@~@\ÕÖÕÅ@k@
%ÄÂÇåÉÅæ@~@\âÖäÙÃÅ@k@
%ÄÅÃÙÅâäÓã@~@Móñk@óñk@ðð]@k@
%ÄèÕÄÆãÃÖÓ@~@\ÕÖ@k@
%ÄèÕäâÙ×ÙÆ@~@\ÖæÕÅÙ@k@
%âÙãâÅØ@~@\ÈÅç@@@
%ÂÅÇÉÕ@
%ÄÅÃÓÁÙÅ@âØÓmâãÁãÅÔÅÕã@åÁÙÃÈÁÙ@M@óòððð@]@ÄÅÆÁäÓã@ÕäÓÓ@^@
%ÄÅÃÓÁÙÅ@âØÓm×ÁÙÁÔâ@åÁÙÃÈÁÙ@M@ñðòôð@]@ÃÃâÉÄ@ñòðø@ÄÅÆÁäÓã@ÕäÓÓ@^@
%ÄÅÃÓÁÙÅ@ÃÖÕãÉÕäÅ@ÈÁÕÄÓÅÙ@ÆÖÙ@âØÓÅçÃÅ×ãÉÖÕ@
%ÂÅÇÉÕ@
%ÄÅÃÓÁÙÅ@åmâØÓâãÁãÅ@ÃÈÁÙ@M@õ@]@^@
%ÄÅÃÓÁÙÅ@åmÄÂòmÙÅãäÙÕmÃÖÄÅ@ÉÕã@^@
%ÄÅÃÓÁÙÅ@åmÄÂòmÔÅââÁÇÅmÉÄ@ÃÈÁÙ@M@÷@]@^@
%ÄÅÃÓÁÙÅ@åmÅÙÙÖÙmÔÅââÁÇÅ@ÃÓÖÂ@M@òðôø@]@^@
%ÇÅã@ÄÉÁÇÕÖâãÉÃâ@ÃÖÕÄÉãÉÖÕ@ñ@
%åmÄÂòmÙÅãäÙÕmÃÖÄÅ@~@ÄÂòmÙÅãäÙÕÅÄmâØÓÃÖÄÅ@k@
%åmâØÓâãÁãÅ@~@ÙÅãäÙÕÅÄmâØÓâãÁãÅ@k@
%åmÅÙÙÖÙmÔÅââÁÇÅ@~@ÔÅââÁÇÅmãÅçã@k@
%åmÄÂòmÔÅââÁÇÅmÉÄ@~@ÄÂòmÔÅââÁÇÅmÉÄ@^@
%ÙÅãäÙÕ@
%M@
%åÁÓäÅâ@ÑâÖÕmÖÂÑÅÃã@M@
%}¢¤ƒƒ…¢¢}@åÁÓäÅ@}†�“¢…}@k@}âØÓÉ•†–}@åÁÓäÅ@ÑâÖÕmÖÂÑÅÃã@M@
%}âØÓâ£�£…}@åÁÓäÅ@åmâØÓâãÁãÅ@k@
%}âØÓÃ–„…}@åÁÓäÅ@åmÄÂòmÙÅãäÙÕmÃÖÄÅ@k@
%}”…¢¢�‡…ÉÄ}@åÁÓäÅ@åmÄÂòmÔÅââÁÇÅmÉÄ@k@
%}”…¢¢�‡…}@åÁÓäÅ@åmÅÙÙÖÙmÔÅââÁÇÅ@k@
%}ƒ¤™™…•£ã‰”…¢£�”—}@åÁÓäÅ@ÃäÙÙÅÕãmãÉÔÅâãÁÔ×@
%]@k@}âØÓâ£�£…”…•£}@åÁÓäÅ@âØÓmâãÁãÅÔÅÕã@ÆÖÙÔÁã@ÑâÖÕ@
%]@]@^@
%ÅÕÄ@^@
%``@Ç…£@âØÓ@£…”—“�£…@
%âÅã@âØÓmâãÁãÅÔÅÕã@~@M@
%âÅÓÅÃã@âØÓâãÔã@
%ÆÙÖÔ@ÙÅâãÁ×É@K@âØÓâãÔãâ@
%æÈÅÙÅ@M@Á××åÅÙ@k@Á××ÕÁÔÅ@k@Á××ÆäÕÃ@]@~@M@ÉÕÁ××åÅÙ@k@
%ÉÕÁ××ÕÁÔÅ@k@ÉÕÁ××ÆäÕÃ@]@]@^@
%``@Õ–™”�“‰©…@¢¤‚¢£‰£¤£…@ÑâÖÕ@‰•£–@�™™�¨@†–™”@
%ÉÆ@ÉÕâäÂâãÉãäãÅ@Éâ@ÕÖã@ÕäÓÓ@
%ÁÕÄ@ãÙÉÔ@M@ÉÕâäÂâãÉãäãÅ@]@Ln@}}@ãÈÅÕ@
%ÉÆ@ÃÉâãÖÖÓâ@K@ÑâÖÕmãè×Å@M@ÉÕâäÂâãÉãäãÅ@]@~@}�™™�¨}@ãÈÅÕ@
%âÅã@âØÓm×ÁÙÁÔâ@~@ÉÕâäÂâãÉãäãÅ@^@
%ÅÓâÅ@
%âÅã@âØÓm×ÁÙÁÔâ@~@ÑâÖÕmÁÙÙÁè@M@ÉÕâäÂâãÉãäãÅ@ÆÖÙÔÁã@ÑâÖÕ@]@^@
%ÅÕÄ@ÉÆ@^@
%ÅÕÄ@ÉÆ@^@
%``@â¤‚¢£‰£¤£…@—�™�”…£…™¢@‰†@¦…@ˆ�¥…@‚–£ˆ@£…”—“�£…@�•„@¢¤‚¢@
%ÉÆ@âØÓmâãÁãÅÔÅÕã@Éâ@ÕÖã@ÕäÓÓ@
%ÁÕÄ@âØÓm×ÁÙÁÔâ@Éâ@ÕÖã@ÕäÓÓ@ãÈÅÕ@
%ÆÖÙ@âÅÓÅÃã@Á×××ÁÙÁÔ@
%ÆÙÖÔ@ãÁÂÓÅ@M@
%ÙÅâãÁ×É@K@ÇÅãm×ÁÙÁÔm×ÓÁÃÅÈÖÓÄÅÙâ@M@
%ÉÕÁ××åÅÙ@k@ÉÕÁ××ÕÁÔÅ@k@ÉÕÁ××ÆäÕÃ@]@
%]@
%ÄÖ@
%``@Æ‰‡¤™…@–¤£@£¨—…@–†@£ˆ‰¢@—�™�”@
%âÅã@âØÓmâãÁãÅÔÅÕã@~@ÙÅ×ÓÁÃÅ@M@
%âØÓmâãÁãÅÔÅÕã@k@}ÀÀ}@OO@ãÙÉÔ@M@Á×××ÁÙÁÔ@]@OO@}ÐÐ}@k@
%ÉÆÕäÓÓ@M@
%ÑâÖÕmØäÅÙè@M@âØÓm×ÁÙÁÔâ@k@
%}[º\»K}@OO@ãÙÉÔ@M@Á×××ÁÙÁÔ@]@]@k@}ÀÀ}@OO@
%ãÙÉÔ@M@Á×××ÁÙÁÔ@]@OO@}ÐÐ}@]@]@^@
%ÅÕÄ@ÆÖÙ@^@
%ÅÕÄ@ÉÆ@^@
%``@Å§…ƒ¤£…@„¨•�”‰ƒ�““¨@
%âÅã@ÃÉâãÖÖÓâ@K@âØÓmâãÁãÅÔÅÕã@~@âØÓmâãÁãÅÔÅÕã@^@
%âÅã@âØÓmâãÁãÅÔÅÕã@~@}å�“¤…¢@MM}@OO@âØÓmâãÁãÅÔÅÕã@OO@}]]@É•£–@o}@^@
%×ÙÅ×ÁÙÅ@âØÓm@ÆÙÖÔ@âØÓmâãÁãÅÔÅÕã@^@
%ÅçÅÃäãÅ@âØÓm@äâÉÕÇ@ÃÉâãÖÖÓâ@K@âØÓmÃÓÖÂ@^@
%``@Á†£…™@Å§…ƒ¤£…@â˜“m@ä¢‰•‡@Ã‰¢£––“¢Kâ˜“mÃ“–‚^@
%``@Ä…£…ƒ£@‰†@Ã
\ No newline at end of file
+SET PATH *LIBL ; 
+
+CREATE OR REPLACE FUNCTION RESTAPI.EXECUTE_SQL2 ( 
+	INAPPVER VARCHAR(10) DEFAULT  'v1'  , 
+	INAPPNAME VARCHAR(128) DEFAULT  ''  , 
+	INAPPFUNC VARCHAR(128) DEFAULT  ''  , 
+	INSUBSTITUTE VARCHAR(10240) DEFAULT  NULL  ) 
+	RETURNS CLOB(2147483647)   
+	LANGUAGE SQL 
+	SPECIFIC RESTAPI.EXECUTE_SQL2 
+	NOT DETERMINISTIC 
+	MODIFIES SQL DATA 
+	CALLED ON NULL INPUT 
+	NOT FENCED 
+	SET OPTION  ALWBLK = *ALLREAD , 
+	ALWCPYDTA = *OPTIMIZE , 
+	COMMIT = *NONE , 
+	DBGVIEW = *SOURCE , 
+	DECRESULT = (31, 31, 00) , 
+	DYNDFTCOL = *NO , 
+	DYNUSRPRF = *OWNER , 
+	SRTSEQ = *HEX   
+	BEGIN 
+DECLARE SQL_STATEMENT VARCHAR ( 32000 ) DEFAULT NULL ; 
+DECLARE SQL_PARAMS VARCHAR ( 10240 ) CCSID 1208 DEFAULT NULL ; 
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION 
+BEGIN 
+DECLARE V_SQLSTATE CHAR ( 5 ) ; 
+DECLARE V_DB2_RETURN_CODE INT ; 
+DECLARE V_DB2_MESSAGE_ID CHAR ( 7 ) ; 
+DECLARE V_ERROR_MESSAGE CLOB ( 2048 ) ; 
+GET DIAGNOSTICS CONDITION 1 
+V_DB2_RETURN_CODE = DB2_RETURNED_SQLCODE , 
+V_SQLSTATE = RETURNED_SQLSTATE , 
+V_ERROR_MESSAGE = MESSAGE_TEXT , 
+V_DB2_MESSAGE_ID = DB2_MESSAGE_ID ; 
+RETURN 
+( 
+VALUES JSON_OBJECT ( 
+'success' VALUE 'false' , 'SQLInfo' VALUE JSON_OBJECT ( 
+'SQLState' VALUE V_SQLSTATE , 
+'SQLCode' VALUE V_DB2_RETURN_CODE , 
+'messageID' VALUE V_DB2_MESSAGE_ID , 
+'message' VALUE V_ERROR_MESSAGE , 
+'currentTimestamp' VALUE CURRENT_TIMESTAMP 
+) , 'SQLStatement' VALUE SQL_STATEMENT FORMAT JSON 
+) ) ; 
+END ; 
+-- Get SQL template 
+SET SQL_STATEMENT = ( 
+SELECT SQLSTMT 
+FROM RESTAPI . SQLSTMTS 
+WHERE ( APPVER , APPNAME , APPFUNC ) = ( INAPPVER , 
+INAPPNAME , INAPPFUNC ) ) ; 
+-- Normalize substitute JSON into array form 
+IF INSUBSTITUTE IS NOT NULL 
+AND TRIM ( INSUBSTITUTE ) <> '' THEN 
+IF CISTOOLS . JSON_TYPE ( INSUBSTITUTE ) = 'array' THEN 
+SET SQL_PARAMS = INSUBSTITUTE ; 
+ELSE 
+SET SQL_PARAMS = JSON_ARRAY ( INSUBSTITUTE FORMAT JSON ) ; 
+END IF ; 
+END IF ; 
+-- Substitute parameters if we have both template and subs 
+IF SQL_STATEMENT IS NOT NULL 
+AND SQL_PARAMS IS NOT NULL THEN 
+FOR SELECT APPPARAM 
+FROM TABLE ( 
+RESTAPI . GET_PARAM_PLACEHOLDERS ( 
+INAPPVER , INAPPNAME , INAPPFUNC ) 
+) 
+DO 
+-- Figure out type of this param 
+SET SQL_STATEMENT = REPLACE ( 
+SQL_STATEMENT , '{{' || TRIM ( APPPARAM ) || '}}' , 
+IFNULL ( 
+JSON_QUERY ( SQL_PARAMS , 
+'$[*].' || TRIM ( APPPARAM ) ) , '{{' || 
+TRIM ( APPPARAM ) || '}}' ) ) ; 
+END FOR ; 
+END IF ; 
+-- Execute dynamically 
+SET CISTOOLS . SQL_STATEMENT = SQL_STATEMENT ; 
+SET SQL_STATEMENT = 'Values ((' || SQL_STATEMENT || ')) Into ?' ; 
+PREPARE SQL_ FROM SQL_STATEMENT ; 
+EXECUTE SQL_ USING CISTOOLS . SQL_CLOB ; 
+-- After Execute Sql_ Using Cistools.Sql_Clob; 
+-- Detect if Cistools.Sql_Clob is already JSON object with success/data/result
+IF LEFT ( LTRIM ( CISTOOLS . SQL_CLOB ) , 1 ) = '{' 
+AND ( LOCATE ( '"success"' , CISTOOLS . SQL_CLOB ) > 0 ) 
+AND ( LOCATE ( '"data"' , CISTOOLS . SQL_CLOB ) > 0 
+OR LOCATE ( '"result"' , CISTOOLS . SQL_CLOB ) > 0 
+OR LOCATE ( '"SQLInfo"' , CISTOOLS . SQL_CLOB ) > 0 ) THEN 
+IF LOCATE ( '"SQLInfo"' , CISTOOLS . SQL_CLOB ) > 0 THEN 
+RETURN 
+JSON_OBJECT ( 
+'SQLStatement' : SQL_STATEMENT , 'substitute' : SQL_PARAMS , 
+'error' : CISTOOLS . SQL_CLOB FORMAT JSON 
+) ; 
+END IF ; 
+-- Return raw JSON as is 
+RETURN CISTOOLS . SQL_CLOB ; 
+ELSE 
+-- Wrap in standard envelope 
+RETURN JSON_OBJECT ( 
+'success' : 'true' , 'data' : CISTOOLS . SQL_CLOB FORMAT JSON 
+) ; 
+END IF ; 
+END  ; 
+
+GRANT ALTER , EXECUTE   
+ON SPECIFIC FUNCTION RESTAPI.EXECUTE_SQL2 
+TO AMAPICS WITH GRANT OPTION ; 
+
+GRANT EXECUTE   
+ON SPECIFIC FUNCTION RESTAPI.EXECUTE_SQL2 
+TO PUBLIC ; 
+
