Previous Topic: Standard FunctionsNext Topic: Using Multiple SET Statements


User-Defined Functions

If you need a specific mathematical function which CA Dataquery does not provide as a standard function, site management can create a user-defined function (UDF) to meet your request.

The syntax diagram for the user-defined function follows:

►►─ UDF(arg1,arg2,...,argn) ──────────────────────────────────────────────────►◄

The first argument (arg1) is a numeric value which represents the number assigned to a particular mathematical function by site management. For example, if 14 functions have been defined, arg1 could be 10 and the arguments arg2 through argn would specify result names, column names or values for numeric literals to be used in the specified function.

Sample

This sample SET statement shows the use of a user-defined function as part of a calculation.

           SET A = (FLDB * FLDC) / AVG(X,Y,Z) + UDF(7,X,Y,Z)

In the example preceding, 7 represents the number of the mathematical function established by site management that you want to use. X, Y and Z specify the result name, column name or a numeric literal to be used in the mathematical function assigned to 7. The result A equals the result of the calculations performed in the UDF expression and the other expressions in the SET statement.