diff --git a/CISTOOLS/Functions/JSON_TYPE.sql b/CISTOOLS/Functions/JSON_TYPE.sql
index a58b217..87cac52 100644
--- a/CISTOOLS/Functions/JSON_TYPE.sql
+++ b/CISTOOLS/Functions/JSON_TYPE.sql
@@ -1 +1,103 @@
-âÅã@×ÁãÈ@\ÓÉÂÓ@^@
%
%ÃÙÅÁãÅ@ÖÙ@ÙÅ×ÓÁÃÅ@ÆäÕÃãÉÖÕ@ÃÉâãÖÖÓâKÑâÖÕmãè×Å@M@
%ÉÕÑâÖÕ@ÃÓÖÂMòðù÷ñõò]@]@
%ÙÅãäÙÕâ@åÁÙÃÈÁÙMòð]@@@
%ÓÁÕÇäÁÇÅ@âØÓ@
%â×ÅÃÉÆÉÃ@ÃÉâãÖÖÓâKÑâÖÕmãè×Å@
%ÄÅãÅÙÔÉÕÉâãÉÃ@
%ÙÅÁÄâ@âØÓ@ÄÁãÁ@
%ÃÁÓÓÅÄ@ÖÕ@ÕäÓÓ@ÉÕ×äã@
%ÕÖ@ÅçãÅÙÕÁÓ@ÁÃãÉÖÕ@
%âÅã@Ö×ãÉÖÕ@@ÁÓæÂÓÒ@~@\ÁÓÓÙÅÁÄ@k@
%ÁÓæÃ×èÄãÁ@~@\Ö×ãÉÔÉéÅ@k@
%ÃÖÔÔÉã@~@\ÕÖÕÅ@k@
%ÄÅÃÙÅâäÓã@~@Móñk@óñk@ðð]@k@
%ÄèÕÄÆãÃÖÓ@~@\ÕÖ@k@
%ÄèÕäâÙ×ÙÆ@~@\äâÅÙ@k@
%âÙãâÅØ@~@\ÈÅç@@@
%ÂÅÇÉÕ@
%ÄÅÃÓÁÙÅ@å@ÃÓÖÂ@M@ò@Ô@]@^@
%ÄÅÃÓÁÙÅ@ã@åÁÙÃÈÁÙ@M@òð@]@^@
%ÄÅÃÓÁÙÅ@ÄäÔÔèÃ@ÃÓÖÂ@M@ò@Ô@]@^@
%ÄÅÃÓÁÙÅ@ÄäÔÔèå@åÁÙÃÈÁÙ@M@ñ@]@^@
%ÄÅÃÓÁÙÅ@ÂÁÄ@âÔÁÓÓÉÕã@ÄÅÆÁäÓã@ð@^@
%``@ä“£™�`¢�†…z@•…¥…™@£ˆ™–¦k@�“¦�¨¢@™…£¤™•@�@£¨—…@M–™@}‰•¥�“‰„}]@
%ÄÅÃÓÁÙÅ@ÃÖÕãÉÕäÅ@ÈÁÕÄÓÅÙ@ÆÖÙ@âØÓÅçÃÅ×ãÉÖÕ@âÅã@ÂÁÄ@~@ñ@^@
%âÅã@å@~@ãÙÉÔ@M@ÉÕÑâÖÕ@]@^@
%ÉÆ@å@Éâ@ÕäÓÓ@
%ÖÙ@å@~@}}@ãÈÅÕ@
%ÙÅãäÙÕ@}•¤““}@^@
%ÅÕÄ@ÉÆ@^@
%``@â£™‰ƒ£@ÑâÖÕ@•¤““@’…¨¦–™„@
%ÉÆ@ÙÅÇÅç×mÓÉÒÅ@M@å@k@}°Mo‰]•¤““[}@]@ãÈÅÕ@
%ÙÅãäÙÕ@}•¤““}@^@
%ÅÕÄ@ÉÆ@^@
%a\@~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~@
%×ˆ�¢…@ñz@Æ�¢£@ÙÅÇÅç×@ƒ“�¢¢‰†‰ƒ�£‰–•@M¢ˆ�—…@N@¢ƒ�“�™@—�££…™•¢]@
%×ˆ�¢…@òz@å�“‰„�£…@¦‰£ˆ@ÑâÖÕ@—�™¢…™@MÑâÖÕmØäÅÙè@a@ÑâÖÕmåÁÓäÅ]@
%É†@—�™¢…™@†�‰“¢@~n@™…£¤™•@}‰•¥�“‰„}@
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~@\a@
%``@ÖÂÑÅÃã@
%ÉÆ@ÙÅÇÅç×mÓÉÒÅ@M@å@k@}°àÀK\àÐ[}@k@}•}@]@ãÈÅÕ@
%âÅã@ã@~@}–‚‘…ƒ£}@^@
%``@ÑâÖÕmØäÅÙè@™…£¤™•¢@ÑâÖÕ@£…§£@†–™@–‚‘…ƒ£¢a�™™�¨¢^@¦‰““@£ˆ™–¦@‰†@‰•¥�“‰„@ÑâÖÕ
%âÅã@ÄäÔÔèÃ@~@ÑâÖÕmØäÅÙè@M@å@k@}[}@]@^@
%ÉÆ@ÂÁÄ@~@ñ@
%ÖÙ@ÄäÔÔèÃ@Éâ@ÕäÓÓ@ãÈÅÕ@
%ÙÅãäÙÕ@}‰•¥�“‰„}@^@
%ÅÕÄ@ÉÆ@^@
%ÙÅãäÙÕ@ã@^@
%ÅÕÄ@ÉÆ@^@
%``@ÁÙÙÁè@
%ÉÆ@ÙÅÇÅç×mÓÉÒÅ@M@å@k@}°àºK\à»[}@k@}•}@]@ãÈÅÕ@
%âÅã@ã@~@}�™™�¨}@^@
%âÅã@ÄäÔÔèÃ@~@ÑâÖÕmØäÅÙè@M@å@k@}[}@]@^@
%ÉÆ@ÂÁÄ@~@ñ@
%ÖÙ@ÄäÔÔèÃ@Éâ@ÕäÓÓ@ãÈÅÕ@
%ÙÅãäÙÕ@}‰•¥�“‰„}@^@
%ÅÕÄ@ÉÆ@^@
%ÙÅãäÙÕ@ã@^@
%ÅÕÄ@ÉÆ@^@
%``@âãÙÉÕÇ@MÑâÖÕ`…¢ƒ�—…„]@
%ÉÆ@ÙÅÇÅç×mÓÉÒÅ@M@å@k@}°MààKOº°àà»]\[}@]@ãÈÅÕ@
%âÅã@ã@~@}¢£™‰•‡}@^@
%``@ÑâÖÕmåÁÓäÅ@—�™¢…¢@¢ƒ�“�™@�•„@™…£¤™•¢@âØÓ@¢ƒ�“�™^@£ˆ™–¦¢@–•@‰•¥�“‰„@ÑâÖÕ@
%âÅã@ÄäÔÔèå@~@âäÂâãÙ@M@ÃÖÁÓÅâÃÅ@M@ÑâÖÕmåÁÓäÅ@M@å@k@}[}@]@k@}}@]@k@ñ@k@ñ@]@^@
%ÉÆ@ÂÁÄ@~@ñ@ãÈÅÕ@
%ÙÅãäÙÕ@}‰•¥�“‰„}@^@
%ÅÕÄ@ÉÆ@^@
%ÙÅãäÙÕ@ã@^@
%ÅÕÄ@ÉÆ@^@
%``@ÂÖÖÓÅÁÕ@
%ÉÆ@ÙÅÇÅç×mÓÉÒÅ@M@å@k@}°Mo‰z£™¤…O†�“¢…][}@]@ãÈÅÕ@
%âÅã@ã@~@}‚––“…�•}@^@
%âÅã@ÄäÔÔèå@~@âäÂâãÙ@M@ÃÖÁÓÅâÃÅ@M@ÑâÖÕmåÁÓäÅ@M@å@k@}[}@]@k@}}@]@k@ñ@k@ñ@]@^@
%ÉÆ@ÂÁÄ@~@ñ@ãÈÅÕ@
%ÙÅãäÙÕ@}‰•¥�“‰„}@^@
%ÅÕÄ@ÉÆ@^@
%ÙÅãäÙÕ@ã@^@
%ÅÕÄ@ÉÆ@^@
%``@ÕäÔÂÅÙ@MÙÆÃ`“‰’…]@
%ÉÆ@ÙÅÇÅç×mÓÉÒÅ@M@å@k@}°`oMðOºñ`ù»ºð`ù»\]MàKºð`ù»N]oMº…Å»ºN`»oºð`ù»N]o[}@]@
%ãÈÅÕ@
%âÅã@ã@~@}•¤”‚…™}@^@
%``@å�“‰„�£…@�¢@ÑâÖÕ@¢ƒ�“�™@
%âÅã@ÄäÔÔèå@~@âäÂâãÙ@M@ÃÖÁÓÅâÃÅ@M@ÑâÖÕmåÁÓäÅ@M@å@k@}[}@]@k@}}@]@k@ñ@k@ñ@]@^@
%ÉÆ@ÂÁÄ@~@ñ@ãÈÅÕ@
%ÙÅãäÙÕ@}‰•¥�“‰„}@^@
%ÅÕÄ@ÉÆ@^@
%ÙÅãäÙÕ@ã@^@
%ÅÕÄ@ÉÆ@^@
%``@Á•¨£ˆ‰•‡@…“¢…@‰¢@•–£@¥�“‰„@ÑâÖÕ@£…§£@
%ÙÅãäÙÕ@}‰•¥�“‰„}@^@
%ÅÕÄ@@^@
%
%ÇÙÁÕã@ÁÓãÅÙ@k@ÅçÅÃäãÅ@@@
%ÖÕ@â×ÅÃÉÆÉÃ@ÆäÕÃãÉÖÕ@ÃÉâãÖÖÓâKÑâÖÕmãè×Å@
%ãÖ@ÁÔÁ×ÉÃâ@æÉ
\ No newline at end of file
+SET PATH *LIBL ; 
+
+CREATE OR REPLACE FUNCTION CISTOOLS.JSON_TYPE ( 
+	INJSON CLOB(2097152) ) 
+	RETURNS VARCHAR(20)   
+	LANGUAGE SQL 
+	SPECIFIC CISTOOLS.JSON_TYPE 
+	DETERMINISTIC 
+	READS SQL DATA 
+	CALLED ON NULL INPUT 
+	NO EXTERNAL ACTION 
+	SET OPTION  ALWBLK = *ALLREAD , 
+	ALWCPYDTA = *OPTIMIZE , 
+	COMMIT = *NONE , 
+	DECRESULT = (31, 31, 00) , 
+	DYNDFTCOL = *NO , 
+	DYNUSRPRF = *USER , 
+	SRTSEQ = *HEX   
+	BEGIN 
+DECLARE V CLOB ( 2 M ) ; 
+DECLARE T VARCHAR ( 20 ) ; 
+DECLARE DUMMYC CLOB ( 2 M ) ; 
+DECLARE DUMMYV VARCHAR ( 1 ) ; 
+DECLARE BAD SMALLINT DEFAULT 0 ; 
+-- Ultra-safe: never throw, always return a type (or 'invalid') 
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET BAD = 1 ; 
+SET V = TRIM ( INJSON ) ; 
+IF V IS NULL 
+OR V = '' THEN 
+RETURN 'null' ; 
+END IF ; 
+-- Strict JSON null keyword 
+IF REGEXP_LIKE ( V , '^(?i)null$' ) THEN 
+RETURN 'null' ; 
+END IF ; 
+/* ============================================================ 
+Phase 1: Fast REGEXP classification (shape + scalar patterns) 
+Phase 2: Validate with JSON parser (JSON_QUERY / JSON_VALUE) 
+If parser fails => return 'invalid' 
+============================================================ */ 
+-- OBJECT 
+IF REGEXP_LIKE ( V , '^\{.*\}$' , 'n' ) THEN 
+SET T = 'object' ; 
+-- JSON_QUERY returns JSON text for objects/arrays; will throw if invalid JSON
+SET DUMMYC = JSON_QUERY ( V , '$' ) ; 
+IF BAD = 1 
+OR DUMMYC IS NULL THEN 
+RETURN 'invalid' ; 
+END IF ; 
+RETURN T ; 
+END IF ; 
+-- ARRAY 
+IF REGEXP_LIKE ( V , '^\[.*\]$' , 'n' ) THEN 
+SET T = 'array' ; 
+SET DUMMYC = JSON_QUERY ( V , '$' ) ; 
+IF BAD = 1 
+OR DUMMYC IS NULL THEN 
+RETURN 'invalid' ; 
+END IF ; 
+RETURN T ; 
+END IF ; 
+-- STRING (JSON-escaped) 
+IF REGEXP_LIKE ( V , '^"(\\.|[^"\\])*"$' ) THEN 
+SET T = 'string' ; 
+-- JSON_VALUE parses scalar and returns SQL scalar; throws on invalid JSON 
+SET DUMMYV = SUBSTR ( COALESCE ( JSON_VALUE ( V , '$' ) , '' ) , 1 , 1 ) ; 
+IF BAD = 1 THEN 
+RETURN 'invalid' ; 
+END IF ; 
+RETURN T ; 
+END IF ; 
+-- BOOLEAN 
+IF REGEXP_LIKE ( V , '^(?i:true|false)$' ) THEN 
+SET T = 'boolean' ; 
+SET DUMMYV = SUBSTR ( COALESCE ( JSON_VALUE ( V , '$' ) , '' ) , 1 , 1 ) ; 
+IF BAD = 1 THEN 
+RETURN 'invalid' ; 
+END IF ; 
+RETURN T ; 
+END IF ; 
+-- NUMBER (RFC-like) 
+IF REGEXP_LIKE ( V , '^-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?$' ) 
+THEN 
+SET T = 'number' ; 
+-- Validate as JSON scalar 
+SET DUMMYV = SUBSTR ( COALESCE ( JSON_VALUE ( V , '$' ) , '' ) , 1 , 1 ) ; 
+IF BAD = 1 THEN 
+RETURN 'invalid' ; 
+END IF ; 
+RETURN T ; 
+END IF ; 
+-- Anything else is not valid JSON text 
+RETURN 'invalid' ; 
+END  ; 
+
+GRANT ALTER , EXECUTE   
+ON SPECIFIC FUNCTION CISTOOLS.JSON_TYPE 
+TO AMAPICS WITH GRANT OPTION ; 
+
+GRANT EXECUTE   
+ON SPECIFIC FUNCTION CISTOOLS.JSON_TYPE 
+TO PUBLIC ; 
+
