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.
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:
|
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.