SET PATH *LIBL ; 

CREATE OR REPLACE FUNCTION CISTOOLS.HMS2TIME ( 
	HMS_TIME NUMERIC(6, 0) DEFAULT  0  ) 
	RETURNS TIME   
	LANGUAGE SQL 
	SPECIFIC CISTOOLS.HMS2TIME 
	NOT DETERMINISTIC 
	MODIFIES SQL DATA 
	CALLED ON NULL INPUT 
	SET OPTION  ALWBLK = *ALLREAD , 
	ALWCPYDTA = *OPTIMIZE , 
	COMMIT = *NONE , 
	DBGVIEW = *SOURCE , 
	DECRESULT = (31, 31, 00) , 
	DYNDFTCOL = *NO , 
	DYNUSRPRF = *USER , 
	SRTSEQ = *HEX   
	BEGIN 
DECLARE CHAR_TIME CHAR ( 6 ) ; 
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION RETURN NULL ; 
SET CHAR_TIME = LPAD ( HMS_TIME , 6 , '0' ) ; 
RETURN 
TIME ( 
SUBSTR ( CHAR_TIME , 1 , 2 ) || ':' || SUBSTR ( CHAR_TIME , 3 , 2 ) || ':' 
|| SUBSTR ( CHAR_TIME , 5 , 2 ) ) ; 
END  ; 

COMMENT ON PARAMETER SPECIFIC FUNCTION CISTOOLS.HMS2TIME 
( HMS_TIME IS 'HMS Time Format' ) ; 

LABEL ON SPECIFIC FUNCTION CISTOOLS.HMS2TIME 
	IS 'Hms To Time' ; 

GRANT EXECUTE   
ON SPECIFIC FUNCTION CISTOOLS.HMS2TIME 
TO PUBLIC ; 

GRANT ALTER , EXECUTE   
ON SPECIFIC FUNCTION CISTOOLS.HMS2TIME 
TO QSECOFR WITH GRANT OPTION ; 

