If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > External Scalar UDF on z/OS

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-07-06, 10:59
ek1975 ek1975 is offline
Registered User
 
Join Date: Sep 2003
Posts: 44
External Scalar UDF on z/OS

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
Reply With Quote
  #2 (permalink)  
Old 04-07-06, 17:18
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
What does SQLCODE -310 on DB2 ZOS mean ?
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 04-10-06, 09:30
ek1975 ek1975 is offline
Registered User
 
Join Date: Sep 2003
Posts: 44
External Scalar UDF on z/OS - 2

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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On