Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Call DB2 user defined function from Cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Ziko13

New User


Joined: 19 Jul 2018
Posts: 10
Location: Greece

PostPosted: Thu Mar 14, 2019 4:46 pm    Post subject: Call DB2 user defined function from Cobol
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

Senior Member


Joined: 21 Sep 2010
Posts: 2319
Location: NY,USA

PostPosted: Thu Mar 14, 2019 6:02 pm    Post subject:
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: 10
Location: Greece

PostPosted: Thu Mar 14, 2019 7:11 pm    Post subject:
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: 10
Location: Greece

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

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

Senior Member


Joined: 21 Sep 2010
Posts: 2319
Location: NY,USA

PostPosted: Fri Mar 15, 2019 6:13 am    Post subject:
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
http://ibmmainframes.com/about42391.html#200049
Back to top
View user's profile Send private message
Ziko13

New User


Joined: 19 Jul 2018
Posts: 10
Location: Greece

PostPosted: Fri Mar 15, 2019 2:56 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. VSE COBOL - File Status 46 when readi... dennis larson COBOL Programming 8 Fri Jan 03, 2020 11:46 pm
No new posts Debug set up for COBOL module but ope... elixir1986 IBM Tools 1 Sun Dec 22, 2019 12:05 am
No new posts Reading the CSV data in COBOL and mov... wik123 COBOL Programming 4 Tue Dec 03, 2019 5:13 pm
No new posts ADDMONS function - conclusion after o... sergeyken SYNCSORT 1 Tue Nov 12, 2019 9:54 pm
This topic is locked: you cannot edit posts or make replies. ADDMONS function rnimmala SYNCSORT 24 Fri Nov 08, 2019 8:55 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us