title: How to create user defined function in DB2 Z/OS 8.1 version?
body: <p>This is my code: I trying to create UDF function for z/os from Data Studio . I don't need to use External function or others. I need to execute this SQL Function .</p>
  
  <pre><code> CREATE FUNCTION FUNCTION5()
   RETURNS FLOAT
   language sql
   DETERMINISTIC
   READS SQL DATA 
   NO EXTERNAL ACTION
   BEGIN 
   DECLARE RANVAL FLOAT ;
   SELECT RAND() INTO RANVAL FROM SYSIBM.SYSDUMMY1;   
   RETURN RANVAL ;
   END
  </code></pre>
  
  <p>But, while executing the above code, i'm getting this error. Can yuou please help me to figure it out please.</p>
  
  <p>I want to develop nearly 20 Scalar UDF on DB2 Z/OS . kindly help me, please.</p>
  
  <pre><code> Deploy [MeDB]MeDB.FUNCTION5
  
  Running
  MeDB.FUNCTION5 - Deploy started.
  Create user-defined function returns SQLCODE: -199, SQLSTATE: 42601.
  MeDB.FUNCTION5: 0: DB2 SQL Error: SQLCODE=-199, SQLSTATE=42601,      SQLERRMC=DECLARE;ON AFTER &lt;INTEGER&gt;, DRIVER=4.18.60
  DB2 SQL Error: SQLCODE=-199, SQLSTATE=42601, SQLERRMC=DECLARE;ON AFTER &lt;INTEGER&gt;, DRIVER=4.18.60
  MeDB.FUNCTION5 - Deploy failed.
  MeDB.FUNCTION5 - Roll back completed successfully.
  </code></pre>