473,418 Members | 2,368 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,418 software developers and data experts.

DB2 z/OS procedures - Nested Block error in Exception Block

Hello,

Could anybody please explain me why DB2 z/OS 8.1 fails on the simple
procedure below:

Error: DSNHSMS2 LINE 12 COL 6 NESTED COMPOUND STATEMENTS NOT ALLOWED

It failes on

DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
DECLARE L_SYSMSG VARCHAR(512);
GET DIAGNOSTICS EXCEPTION 1 L_SYSMSG = MESSAGE_TEXT;
CALL DB2_RAISERROR (SQLCODE,VAR_PI_COD_EOD_PROCESS||'failed',13,
L_SYSMSG);
END;

Does not DB2 for z/OS allow multiple statements in exception block?

Thank you,

Best regards, Dmitry Tolpeko
Ispirer Systems Ltd, Product Manager
su*****@ispirer.com

---

CREATE PROCEDURE test_sp2 (
VAR_PI_COD_EOD_PROCESS VARCHAR ( 40 ) ,
VAR_PI_COD_PROC_CATEGORY SMALLINT,
OUT VAR_PO_RESTART_POSTN VARCHAR ( 256 ) ,
OUT VAR_PO_CTR_UPDAT_SRLNO INTEGER,
OUT RETURN_VAL INTEGER )
LANGUAGE SQL
BEGIN
DECLARE VAR_SHELL_STATUS SMALLINT;
DECLARE SQLCODE INTEGER DEFAULT 0;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
DECLARE L_SYSMSG VARCHAR(512);
GET DIAGNOSTICS EXCEPTION 1 L_SYSMSG = MESSAGE_TEXT;
CALL DB2_RAISERROR (SQLCODE,VAR_PI_COD_EOD_PROCESS||'failed',13,
L_SYSMSG);
END;
DECLARE EXIT HANDLER FOR SQLWARNING
BEGIN
DECLARE L_SYSMSG VARCHAR(512);
GET DIAGNOSTICS EXCEPTION 1 L_SYSMSG = MESSAGE_TEXT;
CALL DB2_RAISERROR (SQLCODE,VAR_PI_COD_EOD_PROCESS||'failed',13,
L_SYSMSG);
END;
DECLARE EXIT HANDLER FOR NOT FOUND
BEGIN
DECLARE L_SYSMSG VARCHAR(512);
GET DIAGNOSTICS EXCEPTION 1 L_SYSMSG = MESSAGE_TEXT;
CALL DB2_RAISERROR (SQLCODE,VAR_PI_COD_EOD_PROCESS||'failed',13,
L_SYSMSG);
END;

SELECT CTR_UPDAT_SRLNO,
RESTART_POSTN
INTO VAR_PO_CTR_UPDAT_SRLNO, VAR_PO_RESTART_POSTN
FROM BA_SHELL_RESTART
WHERE COD_EOD_PROCESS = VAR_PI_COD_EOD_PROCESS
AND COD_PROC_CATEGORY = VAR_PI_COD_PROC_CATEGORY ;

COMMIT;
SET RETURN_VAL = 0;
RETURN 0;
END


Nov 12 '05 #1
0 2937

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

Similar topics

3
by: Mourad | last post by:
Hi all, This is an example of a nested block, however it seems Oracle doesn't like the syntax. see the error below: declare begin declare begin
7
by: Anthony Robinson | last post by:
Have been encountering an odd issue. Every now and again, certain packages of stored procedures just become invalid. I'm aware that dropping or altering an underlying table would render a package...
2
by: Kent Lewandowski | last post by:
hi all, Recently I wrote some stored procedures using java jdbc code (admittedly my first stab) and then tried to implement the same within java packages (for code reuse). I encountered...
2
by: Quinnie | last post by:
Hi, I have a homework assignment that I'm so confused and really need help with. Here's the description, any help would be appreciated. Thanks! Assume we have a statically-scoped language...
5
by: Neil Zanella | last post by:
Hello, I am curious as to why the designers of C did not include support for Pascal-like nested procedures. I guess that it's because nested procedures in C would not buy you much other than...
40
by: Kevin Yu | last post by:
is it a bad programming design to throw exception in the try block then catch it??
9
by: John Sidney-Woollett | last post by:
Is it possible to use the dblink and dblink_exec features from inside pl/pgsql functions to mimic the behaviour of nested transactions by calling another function or executing some SQL via the...
28
by: mooreit | last post by:
The purpose for my questions is accessing these technologies from applications. I develop both applications and databases. Working with Microsoft C#.NET and Microsoft SQL Server 2000 Production and...
4
by: nishi57 | last post by:
I hope I can get some help regarding this issue, which has been going on for a while. I have a desktop user who is having problem running "Stored Procedures". The DB2 Connect application works fine...
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: 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...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.