SET PATH *LIBL ; 

CREATE OR REPLACE FUNCTION CISTOOLS.GET_XA_TASKTOKEN ( ) 
	RETURNS CHAR(10)   
	LANGUAGE SQL 
	SPECIFIC CISTOOLS.GET_XA_TASKTOKEN 
	NOT DETERMINISTIC 
	MODIFIES SQL DATA 
	CALLED ON NULL INPUT 
	SET OPTION  ALWBLK = *ALLREAD , 
	ALWCPYDTA = *OPTIMIZE , 
	COMMIT = *NONE , 
	DECRESULT = (31, 31, 00) , 
	DYNDFTCOL = *NO , 
	DYNUSRPRF = *USER , 
	SRTSEQ = *HEX   
	BEGIN 
DECLARE XA_TOKEN CHAR ( 10 ) DEFAULT '' ; 
CREATE OR REPLACE PROCEDURE QTEMP . PSVTKN0R ( IN PROCESS CHAR ( 8 ) DEFAULT 
'*YES' , IN SHUTDOWN CHAR ( 8 ) DEFAULT '*NO' , 
IN TASK_TOKEN CHAR ( 10 ) DEFAULT '' , 
IN MSGID CHAR ( 7 ) DEFAULT '' ) 
LANGUAGE RPGLE 
SPECIFIC NOT 
DETERMINISTIC 
MODIFIES SQL DATA 
CALLED ON NULL INPUT 
EXTERNAL NAME PSVTKN0R 
PARAMETER STYLE GENERAL ; 
CALL QTEMP . PSVTKN0R ( TASK_TOKEN => XA_TOKEN ) ; 
RETURN XA_TOKEN ; 
END  ; 

LABEL ON SPECIFIC FUNCTION CISTOOLS.GET_XA_TASKTOKEN 
	IS 'Get Xa Task Token' ; 

GRANT ALTER , EXECUTE   
ON SPECIFIC FUNCTION CISTOOLS.GET_XA_TASKTOKEN 
TO AMAPICS WITH GRANT OPTION ; 

GRANT EXECUTE   
ON SPECIFIC FUNCTION CISTOOLS.GET_XA_TASKTOKEN 
TO PUBLIC ; 

