You can use the Function editor to create and maintain the user-defined functions in a DB2 physical model.
To define a DB2 function
The Function Editor opens.
Note: Click New on the toolbar to create a function. Use the Enter filter text text box to filter a large list of functions to locate the one you want to work with.
Specifies the name of the function.
Specifies the schema to associate with the function. Select a schema name from the drop-down list.
Specifies if the function is at the Model Level or Table Level. Select a type from the drop-down list.
Specifies the type of function. Select a value from the drop-down list: SQL Scalar, External Scalar, External Table, or Sourced.
Specifies if upon creating a new (table-level only) table, this function will automatically be attached to it.
Specifies whether or not to generate DDL for this object during Forward Engineering.
Specifies the input parameters of the function. Specify one entry for each parameter that the function will receive.
Specifies the physical data type of the parameter.
Specifies whether the data type is for binary data.
Specifies the coded character set identifier (CCSId) for the Character or Graphic data types. Select from the drop-down list; valid values are ASCII, EBCDIC, and UNICODE.
Specifies a unique name for the instance of the function that is being defined. This name can be used when sourcing on this function, dropping the function, or commenting on the function. However, this name cannot be used to invoke the function.
Return Options:
Specifies the data type for the value returned by the function. Select a data type from the drop-down list.
Specifies the character type that will be returned. Make a selection from the drop-down list: For Bit Data, For Mixed Data, or For Single Byte Character Set.
Specifies the coded character set identifier. Select from the drop-down list. Valid values are ASCII, EBCDIC, and UNICODE.
Specifies the name of the external table, when the type is set to External Table. Select a table name from the drop-down list.
Specifies the data type to which the result returned from the function is casted. This option appears when the type is set to External Scalar.
Specifies the character type of the casted data type returned by the function. This option displays when the type is set to External Scalar.
Specifies the coded character set identifier. Select from the drop-down list; valid values are ASCII, EBCDIC, and UNICODE.
Specifies whether or not the load module for the function is to stay in memory when the function ends. This option is ignored if you have specified JAVA for Language.
Specifies the type of the function. Select from the drop-down list; valid values are Main Routine and Subroutine.
Specifies the language in which the function is written. Select from the drop-down list; valid values are ASSEMBLE, C, COBOL, Java, and PLI.
Specifies the coded character set identifier. Select from the drop-down list; valid values are ASCII and UNICODE.
Specifies that the representation of the values of varying length character string-parameters, including, if applicable, the output of the function, for functions that specify LANGUAGE C.
Specifies whether the function always returns the same results for given argument values. Clear the check box to indicate NOT DETERMINISTIC.
Specifies the type of SQL statements that can be executed. Select a value from the drop-down list; valid values are Modifies SQL Data, Reads SQL Data, and Contains SQL Data.
Specifies whether or not at function resolution time, DB2 chooses a function based on the static types (declared types) of the parameters of the function.
Specifies that the function is called regardless of whether any of its arguments are null. It can return a null value or a non-null value. Select a value from the drop-down list. Valid values are Called or Returns Null.
Specifies how special registers are set on entry to the routine. Select a value from the drop-down list: Inherit (Special Registers) or Default (Special Registers).
Specifies the conventions used for passing parameters to and returning the value from functions. Select a value from the drop-down list. Valid values are DB2 General, Java, SQL and DB2 SQL.
Specifies that the function runs in an external address space to prevent user programs from corrupting DB2 storage.
Specifies whether a final call is to be made to an external function. This option enables the external function to free any system resources it is using.
Specifies that parallel processing is allowed. Clear the check box to indicate NO.
Specifies whether or not status information known by DB2 is passed to the stored procedure when it is invoked. Clear the check box to indicate NO DBINFO.
Specifies an estimate of the expected number of rows that the function returns. Enter an integer in the text box.
Specifies that the new function is being defined as a source function.
Specifies a unique name for the instance of the function that is being defined.
Specifies the schema to associate with the function. Select a schema name from the drop-down list.
Specifies the maximum amount of processor time, in CPU service units, that a single invocation of the function can run.
Specifies the Language Environment runtime options that you want to use for the function. Type a character string in this field.
Specifies whether or not the function should be stopped executing after a certain type or number of failures. Select from the drop-down list; valid values are System Default, Specific Number, and Continue.
Specifies the number of failures after which the routine should be stopped executing.
Specifies how special registers are set upon entry to the routine. Select from the drop-down list; valid values are Inherit and Default.
Specifies whether or not you want to use the static types of function parameters to resolve the function.
Identifies the user-written code that implements the stored procedure.
Specifies the file name of the file containing the function. Select from the drop-down list or create a file using the DBE for LUW File Editor.
Specifies the class identifier, which the database manager invokes to execute the user-defined function being created.
Specifies the method identifier, which the database manager invokes to execute the user-defined function being created.
Indicates that when the function is invoked for the first time, DB2 allocates memory for a scratchpad. Clear the check box to indicate NO SCRATCHPAD.
When using the Scratch Pad option, indicates the SCRATCHPAD length.
Specifies the workload manager (WLM) environment. Enter the WLM name in the text box.
Specifies whether or not to use the environment of the procedure that calls this function.
Specifies how the stored procedure interacts with an external security product. Select from the drop-down list; valid values are DB2, User, and Definer.
Specifies whether or not the function can change the state of an object that the database manager does not manage.
Indicates to use the package collection id indicated in the next field.
Identifies the package collection to be used when the stored procedure is executed. Enter the collection id in the text box.
Indicates to use the package path entered in the following field.
Indicates the package path.
The DB2 for z/OS Function Editor closes.
Copyright © 2012 CA. All rights reserved. | Tell Technical Publications how we can improve this information |