473,385 Members | 1,320 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,385 software developers and data experts.

Creating function in Db2 (version 8) on mainframe

I have a function that contains 'if'. 'for'. I want to create this function in Db2 (vesion 8) on mainframe. Please let me know the basic steps to do that. I have tried to execute it through SPOFY and QFM and got errors. It seems like there should be some specific way to create function in DB2 (V8) on mainframe (db2 z/os).

Please check the function below -

create function desc_func( v_rpt_id integer, v_desc_typ_cde varchar(1))
RETURNS VARCHAR(32672)
begin atomic
DECLARE v_desc VARCHAR(32672) default '';
for1: FOR tmp_row AS
(
SELECT
desc_seq_num,varchar(evnt_desc_txt) evnt_desc_txt
FROM
t_flt_sfty_desc DES,t_flt_sfty_rpt rptin1
WHERE DES.EVNT_DTE=rptin1.EVNT_DTE
AND DES.EVNT_SEQ_NUM=rptin1.EVNT_SEQ_NUM
AND DES.RPT_EVNT_ORD_NUM = rptin1.RPT_EVNT_ORD_NUM
AND DES.RPTEE_TYP_CDE = rptin1.RPTEE_TYP_CDE
AND DES.View_typ_cde = 'D'
AND desc_typ_cde = v_desc_typ_cde
AND rpt_id= v_rpt_id
ORDER BY
desc_seq_num
)
DO
IF desc_seq_num =1 THEN
SET v_desc = tmp_row.evnt_desc_txt;
ELSE
SET v_desc = v_desc ||tmp_row.evnt_desc_txt;
END IF;
END FOR for1;
return v_desc;
END
Apr 5 '10 #1
0 1318

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Krista | last post by:
Hi, I wrote a php project 2 years ago. I am totally lost right now. what is differnt between $userName, $_GET and $_REQUEST? In my past project, I remember i can use $userName as a variable, but i...
0
by: Fred Zimmerman | last post by:
If a client's mainframe is DB2 6.1 and they have DB2 Connect Enterprise servers and clients 6.2, with newer clients running 7.2, would .NET integration be supported with the existing DB2 Connect,...
3
by: Fred Zimmerman | last post by:
My new client is running DB2 6.1 on IBM mainframe (z/OS). They are running DB2 Connect ver. 7.2 to connect to database. (If you cannot already tell, I'm new to DB2.) I'm not sure what DB2 Connect...
1
by: saravanan.r.chandran | last post by:
I have installed db2 connect personal edition 7.1 on my desktop (win2k pro) from where i need to access Mainframe db2. I have created a dsn using Client Configuration assistant but i am getting the...
17
by: Fabrice | last post by:
Hi ! I'm looking for a tutorial on how to create a DLL in C (not C++). I don't know whether i can use C for this purpose, but i didn't find any post telling me that i cannot use C. So, if it is...
3
by: rgb | last post by:
I've got Visual Studio 6.0 and I'm working on a Visual Basic applicaiton. There a couple parts that really require C. I've done C programming on a mainframe but nothing on a PC. So I'm trying to...
2
by: pshvarts | last post by:
(I'm new in SOAP) I get some wsdl file (from apache service ). I tried creating SOAP client with .NET - trying to add Web Reference and get error like: "Custom tool error: Unable to import...
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...
0
by: .nu | last post by:
#!/usr/bin/env python # -*- coding: utf-8 -*- # Name: Sleepy Hollow # Author: .nu import wx import os import sys
13
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
I am not accustomed to creating xml files programmatically. The big picture is this: This will be in VB/VS 2005/ winforms. I have a DTD, a sample XML, and an outside data source I will use to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.