IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Call DB2 user defined function from Cobol


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Ziko13

New User


Joined: 19 Jul 2018
Posts: 44
Location: Greece

PostPosted: Thu Mar 14, 2019 4:46 pm
Reply with quote

Hi all,

I am new to DB2 and I have the following question.
We have a requirement to get the result from a DB2 user defined function.
How do you embed the DB2 function into the cobol program?
A small example?

Please get back if my first message is vague.

Thank you in advance.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3109
Location: NYC,USA

PostPosted: Thu Mar 14, 2019 6:02 pm
Reply with quote

Anything related to DB2 must be wrapped in EXEC SQL.. END-EXEC.
You can query the function on SYSIBM.SYSDUMYY1 or use a SET.
Back to top
View user's profile Send private message
Ziko13

New User


Joined: 19 Jul 2018
Posts: 44
Location: Greece

PostPosted: Thu Mar 14, 2019 7:11 pm
Reply with quote

Thank you for the answer.
I assume the set you mention will be something like :

exec sql set :result = db2function end-exec
Back to top
View user's profile Send private message
Ziko13

New User


Joined: 19 Jul 2018
Posts: 44
Location: Greece

PostPosted: Thu Mar 14, 2019 8:00 pm
Reply with quote

A code example would be very helpful
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3109
Location: NYC,USA

PostPosted: Fri Mar 15, 2019 6:13 am
Reply with quote

Please do the research yourself next time and refer to the manuals if required which makes the learnings mutual.
See if this helps and if not then talk to DBA
ibmmainframes.com/about42391.html#200049
Back to top
View user's profile Send private message
Ziko13

New User


Joined: 19 Jul 2018
Posts: 44
Location: Greece

PostPosted: Fri Mar 15, 2019 2:56 pm
Reply with quote

program ok thank you for the valuable comments.
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts IBM IMU Utility for Easytrieve Code t... IBM Tools 0
No new posts Big Five Personality Test in COBOL - ... COBOL Programming 0
No new posts I wrote a Hallmark Movie Plot Generat... COBOL Programming 0
No new posts COBOL Text Adventure Engine for TK4- ... COBOL Programming 0
No new posts Avoid job abend on dataset held by us... JCL & VSAM 6
Search our Forums:


Back to Top