473,406 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

UDB Migration from LUW - Mainframe DB2

Hi.

We have UDB 8.2 on Windows and we want it to be migrated to V8 of DB2
on Mainframe.
1. Can a SQL FUNCTION contains SELECT statements in RETURN Clause in
Mainframe? below function compiles in UDB.. Will it compile on
Mainframe DB2 V8?

create FUNCTION X.IsHoliday(dDate TIMESTAMP , HolidaySched varchar(12))
Returns INTEGER

READS SQL DATA
NOT DETERMINISTIC
LANGUAGE SQL
BEGIN ATOMIC

RETURN
SELECT count(1)
FROM XXX
WHERE XXcode = HolidaySched
and country = 0
and holidaydate = dDate;

END
2) CAN A READ STORED PROCEDURE BE CALLED FROM A SQL FUNCTION? Any
example?

Nov 12 '05 #1
3 1520
db*****@yahoo.com wrote:
Hi.

We have UDB 8.2 on Windows and we want it to be migrated to V8 of DB2
on Mainframe.
1. Can a SQL FUNCTION contains SELECT statements in RETURN Clause in
Mainframe? below function compiles in UDB.. Will it compile on
Mainframe DB2 V8?

create FUNCTION X.IsHoliday(dDate TIMESTAMP , HolidaySched varchar(12))
Returns INTEGER

READS SQL DATA
NOT DETERMINISTIC
LANGUAGE SQL
BEGIN ATOMIC

RETURN
SELECT count(1)
FROM XXX
WHERE XXcode = HolidaySched
and country = 0
and holidaydate = dDate;

END Remove the BEGIN ATOMIC .. END
Also you need to add braces around the SELECT (I thought DB2 for LUW
also requires them....)
2) CAN A READ STORED PROCEDURE BE CALLED FROM A SQL FUNCTION? Any
example?

In DB2 V8 for zOS only the RETURN statement is allowed.
So the answer is no.

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #2
Serge,

The Mainframe DB2 manual says nothing about RETURN statement having a
SELECT clause.

Nov 12 '05 #3
db*****@yahoo.com wrote:
Serge,

The Mainframe DB2 manual says nothing about RETURN statement having a
SELECT clause.

CREATE FUNCTION (SQL scalar)
http://publib.boulder.ibm.com/infoce...jnrmstr390.htm
introduces the RETURN statement. It also specified READS SQL DATA as an
option (a required, but not sufficient sign)
RETURN statement speficies expression
expression specifies "scalar subselect".
A quick (I confess) browse trhough CREATE function, return statement and
expression does not yield an exception.
Thus to me the docs support the notion that:
CRAEET FUNCTION ...
RETURNS INT
READS SQL DATA
RETURN (SELECT count(*) FROM T)

is legal in DB2 V8 for zOS
I don't have ready access to a DB2 zOS system... so I can't validate.

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Erik-Jan Bakker | last post by:
Hi I am not a javascript expert and I have a problem that the guru's in this newsgroup probably can solve quickly. ;-) I've made a webpage with three frames: top, left and mainframe. I...
8
by: Scott | last post by:
I have written windows applications using MFC for several years and have frequently used MFC techniques. Now I'm moving to C# .NET WinForm. Mostly C# books describes C# language (sometimes...
1
by: rob | last post by:
Dear All, I have a very small test project to convert asp to asp.net using the Microsoft/Artisan ASP to ASP.NET Migration Assistant...
7
by: pkr | last post by:
Hi, In my shop, we have database in diverse platforms like mainframe, Linux, Windows 2000. We are planning to consolidate all iDB in a single platform and build one big monster DB, this monster...
1
by: uli2003wien | last post by:
Dear group, i am a seasoned DB2-veteran (6 years exp.) on the Windows- and Linux-Server platform. Once in a while i had a look into DB2 on the mainframe but mostly only watching other people do...
1
by: Thureen | last post by:
I just started using the mainframe (z/OS) 2 days ago, so I am very inexperienced in it. However, I need to write c++ programs for mainframe. Right now, the other mainframe programmers have showed...
0
by: vaibhavrajvanshi | last post by:
we are migrating our system from mainframe to AIX . what are the steps to be taken to migrate data from mainframe db2 to AIX UDB
36
by: t3chn0n3rd | last post by:
are most IT shops migrating from db2 to oracle?
2
by: t3chn0n3rd | last post by:
Hi, I am an old-time mainframe programmer. MVS, JCL, JES, DB2. I notice alot of my colleagues are migrating their mainframe applications to newer client/server. However I am happy...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.