Sorry, I was out for the weekend and when I tried posting my reply to Sathyaram's question, the thread had a note saying it was closed!
Sathyaram: -310 on z/OS means "DECIMAL HOST VARIABLE OR PARAMETER number CONTAINS NON-DECIMAL DATA" but I can see I've got valid decimal data within the external Cobol routine (in and out of it)
--------------------------------------------------------------------------
My Original Post:
DB2 v7.2 on z/OS
Hello, I am new to UDF's and tried writing something ugly, it didn't work - so I thought I would start doing something simple: "Add +1 to a db2 column declared DEC(8,0)"
Here is my UDF:
Code:
CREATE FUNCTION DB2D1.TEST1(DECIMAL(8,0))
RETURNS DECIMAL(8,0)
EXTERNAL NAME TESTPGM2
LANGUAGE COBOL
PARAMETER STYLE DB2SQL
NO SQL
NO COLLID
WLM ENVIRONMENT DB2D_WLM_ENV
Here is my external Cobol code:
Code:
Data Division.
Working-Storage Section.
Linkage Section.
01 lk-parms pic s9(8)V comp-3.
Procedure Division using lk-parms.
Add +1 to lk-parms
Display 'out parm: ' lk-parms
Goback.
I can see the correct values displayed in the JOB SYSOUT by my external Cobol code when being called by my calling program, but my calling program itself which has "SELECT TEST1(col1)" returns -310 in the SQLCODE. I don't know how invalid decimal values are getting in here, when I can see the correct values in the SYSOUT... Any suggestions, let me know please
Thank you for your time
EK