I have a problem with the result of one function (F3) coming up as blanks in Microsoft's SQL Server Query Analyzer. I believe the problem to possibly be that the function references a service program written in SQLRPGLE.
Functions F1 and F2 are written with SQL statements, only. Their results show up fine.
F3 is created with the following SQL statement:
CREATE FUNCTION F3 (FLD1 DECIMAL(2,0), FLD2 DECIMAL(8,0))
RETURNS CHAR (60)
EXTERNAL NAME 'MYLIB/PGM1(PROC1)'
PARAMETER STYLE GENERAL;
We are at V5R2 and at the latest service pack.
My DSN uses the iSeries Access driver, and specifies all possible libraries in the library list section.
You need to ensure that your RPG program is returning the output value in the manner dictated by the GENERAL parameter style. Review your code to see if the parameter style specified is correctly implemented in your RPG code. The Redbook titled "Stored Procedures, Triggers and User Defined Functions on DB2 Universal Database for iSeries" is a good resource for UDFs and can be accessed online at here.
You should also determine if the RPG procedure is working correctly and it returning the result that you are expecting. Step through the code using the debugger to validate that it is returning the correct result.
There is an RPG UDF coding example available from the DB2 UDB for iSeries Web site.
MORE INFORMATION ON THIS TOPIC
Visit the ITKnowledge Exchange and get answers to your DB2 questions fast.
Check out this Search400.com Featured Topic: Expert advice on DB2
Search400.com's targeted search engine: Get relevant information on DB2/400.
The Best Web Links: Tips, tutorials and more.
Dig Deeper on DB2 UDB (universal databases)
Related Q&A from Kent Milligan
To solve the SQL error -321 on IBM i6.1, use the new values statement to overcome the error. If you are using an older release, declare a cursor ... Continue Reading
When working with DB2 files with columns that have both short and long names, there is no option choose which column names are returned via ODBC ... Continue Reading
When developing tables in a parent-child relationship, use a primary key and a foreign key along with a unique ID to make your database easier to ... Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.