Readme for JAVA and SQL replacement for SYSFUN.ROUND().
=======================================================

Problem Description:
-------------------

Since the provided SYSFUN.ROUND UDF only supports rounding decimals by
converting to floating point, rounding errors can both during the inital
and final conversions, as well as within the round UDF.

This results in seemingly random rounding results when the last digit is,
or is close to 5.

eg. round( 1.05, 1) may round up, while round( 1.005, 2) may round down.

Solution:
---------
The complete solution is to replace the SYSFUN ROUND function with a DB2
built-in decimal based function.  Since this solution will take some time
before it can be made available, an alternate solution is provided below.

Alternate Solution:
------------------
Both of the solutions below will create a user defined function, which will
only be used instead of the SYSFUN.ROUND if the function is found in the
CURRENT FUNCTION PATH before the SYSFUN schema.  Refer to
"SET CURRENT FUNCTION PATH" in the SQL Reference for details.


For 7.0 Beta,
an SQL UDF can be created by using the command line processor
to connect to the database, and then read in the roundSql.sql file.
eg.
- db2 connect to sample
- db2 -tf roundSql.sql

For V6,
a Java UDF can be created by using the command line processor
to connect to the database, and then read in the roundJava.sql file.
eg.
- db2 connect to sample
- db2 -tf RoundSql-v6.sql
- copy roundv6.class /sqllib/function
- db2 -f test.sql
You must then copy the roundv6.class file to the /sqllib/function directory.

For V5,
a Java UDF can be created by using the command line processor
to connect to the database, and then read in the roundJava.sql file.
eg.
- db2 connect to sample
- db2 -tf RoundSql-v5.sql
- copy roundv5.class /sqllib/function
- db2 -f test.sql
You must then copy the roundv5.class file to the /sqllib/function directory.

Files:
------

readme.txt      - this file.
roundSql.sql    - DB2 Commnand line processor text file to create sql round UDF.
roundJava-v6.sql- DB2 CLP text file to create java roundv6 UDF (parameter style java).
roundJava-v5.sql- DB2 CLP text file to create java roundv5 UDF (parameter style db2general).
roundv6.class   - Java class file for the java roundv6 UDF.  This must be copied
                  into /sqllib/function.
roundv5.class   - Java class file for the java roundv5 UDF.  This must be copied
                  into /sqllib/function.
roundJavav6.java- Java source code for the java round UDF.  This is only
                  included for reference, and is not required.
roundJavav5.java- Java source code for the java round UDF.  This is only
                  included for reference, and is not required.
test.sql        - DB2 Commnand line processor text file to test the round UDF.


