SET PATH *LIBL ; 

CREATE OR REPLACE FUNCTION CISTOOLS.SYS_PARMS ( 
	HTTP_HOST CHAR(50) ) 
	RETURNS TABLE ( 
	AMFLIB CHAR(10) , 
	AMTLIB CHAR(10) , 
	SFPLIB CHAR(10) , 
	CUSTOM CHAR(10) , 
	AMALIB CHAR(10) , 
	IFS CHAR(200) , 
	DTEFMT CHAR(3) , 
	MSGF CHAR(10) , 
	NE CHAR(1) , 
	ENDS CHAR(2) , 
	PPSLIB CHAR(10) , 
	PPSOBJ CHAR(10) , 
	PPSMSGF CHAR(10) , 
	PHYFILE CHAR(10) , 
	KANLIB CHAR(10) , 
	GPPHTML CHAR(10) , 
	OTHER1 CHAR(10) , 
	OTHER2 CHAR(10) , 
	OTHER3 CHAR(10) , 
	OTHER4 CHAR(10) )   
	LANGUAGE SQL 
	SPECIFIC CISTOOLS.SYS_PARMS 
	NOT DETERMINISTIC 
	READS 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 V_AMFLIB , V_AMTLIB , V_SFPLIB , V_CUSTOM , V_AMALIB , V_MSGF , V_PPSLIB, V_PPSOBJ , V_PPSMSGF , V_PHYFILE , V_KANLIB , V_GPPHTML , 
V_OTHER1 , V_OTHER2 , V_OTHER3 , V_OTHER4 CHAR ( 10 ) ; 
DECLARE V_IFS CHAR ( 200 ) ; 
DECLARE V_DTEFMT CHAR ( 3 ) ; 
DECLARE V_NE CHAR ( 1 ) ; 
DECLARE V_ENDS CHAR ( 2 ) ; 
SELECT MAX ( 
CASE 
WHEN PARKEY2 = 'MAPICSFILE' THEN PARALPH 
END ) , MAX ( 
CASE 
WHEN PARKEY2 = 'MAPICSFILET' THEN PARALPH 
END ) , MAX ( 
CASE 
WHEN PARKEY2 = 'SFPFILE' THEN PARALPH 
END ) , MAX ( 
CASE 
WHEN PARKEY2 = 'CUSTOMFILE' THEN PARALPH 
END ) , MAX ( 
CASE 
WHEN PARKEY2 = 'MAPICSPGM' THEN PARALPH 
END ) , MAX ( 
CASE 
WHEN PARKEY2 = 'DTEFMT   ' THEN PARALPH 
END ) , MAX ( 
CASE 
WHEN PARKEY2 = 'MSGF     ' THEN PARALPH 
END ) , MAX ( 
CASE 
WHEN PARKEY2 = 'NUMEDT   ' THEN PARALPH 
END ) , MAX ( 
CASE 
WHEN PARKEY2 = 'MAPICSENDS' THEN PARALPH 
END ) , MAX ( 
CASE 
WHEN PARKEY2 = 'PPSFILE   ' THEN PARALPH 
END ) , MAX ( 
CASE 
WHEN PARKEY2 = 'PPSOBJ    ' THEN PARALPH 
END ) , MAX ( 
CASE 
WHEN PARKEY2 = 'PPSMSGF   ' THEN PARALPH 
END ) , MAX ( 
CASE 
WHEN PARKEY2 = 'PHYFILE   ' THEN PARALPH 
END ) , MAX ( 
CASE 
WHEN PARKEY2 = 'KANFILE   ' THEN PARALPH 
END ) , MAX ( 
CASE 
WHEN PARKEY1 = 'SFPLUS    ' 
AND PARKEY2 = 'IFSPATH   ' THEN PARALPH 
END ) , MAX ( 
CASE 
WHEN PARKEY1 = 'SFPLUS    ' 
AND PARKEY2 = 'GPPHTML   ' THEN PARALPH 
END ) 
INTO V_AMFLIB , V_AMTLIB , V_SFPLIB , V_CUSTOM , V_AMALIB , V_DTEFMT , V_MSGF ,V_NE , V_ENDS , V_PPSLIB , V_PPSOBJ , V_PPSMSGF , 
V_PHYFILE , V_KANLIB , V_IFS , V_GPPHTML 
FROM $PARMGEN 
WHERE PARKEY3 = HTTP_HOST 
AND ( ( PARKEY1 = 'GENERAL' 
AND PARKEY2 IN ( 'MAPICSFILE' , 
'MAPICSFILET' , 'SFPFILE' , 'CUSTOMFILE' , 'MAPICSPGM' , 'DTEFMT   ' , 'MSGF' , 'NUMEDT   ' , 'MAPICSENDS' , 
'PPSFILE   ' , 'PPSOBJ    ' , 'PPSMSGF   ' , 'PHYFILE   ' , 'KANFILE   ' ) ) 
OR ( PARKEY1 = 'SFPLUS    ' 
AND PARKEY2 IN ( 'IFSPATH   ' , 'GPPHTML   ' ) ) ) ; 
SET V_OTHER1 = '' ; 
SET V_OTHER2 = '' ; 
SET V_OTHER3 = '' ; 
SET V_OTHER4 = '' ; 
PIPE ( 
V_AMFLIB , 
V_AMTLIB , V_SFPLIB , V_CUSTOM , V_AMALIB , V_IFS , V_DTEFMT , V_MSGF , V_NE , V_ENDS , V_PPSLIB , V_PPSOBJ , V_PPSMSGF , V_PHYFILE , 
V_KANLIB , V_GPPHTML , V_OTHER1 , V_OTHER2 , V_OTHER3 , V_OTHER4 ) ; 
RETURN ; 
END  ; 

COMMENT ON PARAMETER SPECIFIC FUNCTION CISTOOLS.SYS_PARMS 
( HTTP_HOST IS 'HTTP Host' ) ; 

LABEL ON SPECIFIC FUNCTION CISTOOLS.SYS_PARMS 
	IS 'Sys Parms' ; 

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

GRANT EXECUTE   
ON SPECIFIC FUNCTION CISTOOLS.SYS_PARMS 
TO PUBLIC ; 

