User-defined function samples that ship with DB2

To assist you in defining, implementing, and invoking your user-defined functions, DB2® provides a number of sample user-defined functions. All sample user-defined function code is in data set DSN1010.SDSNSAMP.

The following table summarizes the characteristics of the sample user-defined functions.

Table 1. User-defined function samples shipped with DB2
User-defined function name Language Member that contains source code Purpose
ALTDATE1 C DSN8DUAD Converts the current date to a user-specified format
ALTDATE2 C DSN8DUCD Converts a date from one format to another
ALTTIME3 C DSN8DUAT Converts the current time to a user-specified format
ALTTIME4 C DSN8DUCT Converts a time from one format to another
DAYNAME C++ DSN8EUDN Returns the day of the week for a user-specified date
MONTHNAME C++ DSN8EUMN Returns the month for a user-specified date
CURRENCY C DSN8DUCY Formats a floating-point number as a currency value
TABLE_NAME C DSN8DUTI Returns the unqualified table name for a table, view, or alias
TABLE_QUALIF C DSN8DUTI Returns the qualifier for a table, view, or alias
TABLE_LOCATION C DSN8DUTI Returns the location for a table, view, or alias
WEATHER C DSN8DUWF Returns a table of weather information from a EBCDIC data set
Notes:
  1. This version of ALTDATE has one input parameter, of type VARCHAR(13).
  2. This version of ALTDATE has three input parameters, of type VARCHAR(17), VARCHAR(13), and VARCHAR(13).
  3. This version of ALTTIME has one input parameter, of type VARCHAR(14).
  4. This version of ALTTIME has three input parameters, of type VARCHAR(11), VARCHAR(14), and VARCHAR(14).

Member DSN8DUWC contains a client program that shows you how to invoke the WEATHER user-defined table function.

Member DSNTEJ2U shows you how to define and prepare the sample user-defined functions and the client program.