473,594 Members | 2,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BEGIN ATOMIC, COMMAND CENTRE SCRIPT

Hi,

Here is an example of what I am trying to do. Can I not access (echo or
print or dump to file) the variables within the "BEGIN ATOMIC" ? I get
the error "SQL0104N An unexpected token "ECHO" was found following "a
= cur.TABLE_NAME "

Constraint : I cannot create new tables or procedures.

BEGIN ATOMIC

DECLARE v_counter INTEGER DEFAULT 0;
DECLARE not_found CONDITION FOR SQLSTATE '02000';

DECLARE a VARCHAR(500);
FOR cur AS SELECT TABLE_NAME FROM SYSIBM.TABLES DO
SET a = cur.TABLE_NAME;
ECHO a; <----- Error
<-------------------------------------------
END FOR;

SET v_counter = (SELECT count(*) FROM SYSIBM.TABLES AS TABLE WHERE
TABLE.TABLE_SCH EMA = 'COMP' );

END
@

Randy

May 2 '06 #1
4 10083
Is this just for debugging? If it is, here's a couple ideas.

DECLARE a GLOBAL TEMPORARY TABLE and INSERT data INTO it. After
execution of the FUNCTION, you can read what it was.

User a CURSOR WITH RETURN TO CLIENT, for VALUES <variable name>. OPEN
the CURSOR and let the client display its data.

B.

May 2 '06 #2

"TheSpongeb ob" <ga*****@sympat ico.ca> wrote in message
news:11******** **************@ i39g2000cwa.goo glegroups.com.. .
Hi,

Here is an example of what I am trying to do. Can I not access (echo or
print or dump to file) the variables within the "BEGIN ATOMIC" ? I get
the error "SQL0104N An unexpected token "ECHO" was found following "a
= cur.TABLE_NAME "

Constraint : I cannot create new tables or procedures.

BEGIN ATOMIC

DECLARE v_counter INTEGER DEFAULT 0;
DECLARE not_found CONDITION FOR SQLSTATE '02000';

DECLARE a VARCHAR(500);
FOR cur AS SELECT TABLE_NAME FROM SYSIBM.TABLES DO
SET a = cur.TABLE_NAME;
ECHO a; <----- Error
<-------------------------------------------
END FOR;

SET v_counter = (SELECT count(*) FROM SYSIBM.TABLES AS TABLE WHERE
TABLE.TABLE_SCH EMA = 'COMP' );

END
@


Have a look at this article:
http://www-128.ibm.com/developerwork...0302izuha.html

--
Rhino
May 2 '06 #3
thanx guys. all excellent solutions.

May 2 '06 #4
Randy wrote:
thanx guys. all excellent solutions.

FYI: ECHO is a CLP command, not an SQL statement, that's why it can't be
used.
If you want to do client side scripting use a language of your choice
like PHP, Python, PERL, ....
IBM has made a choice not to add its own flavor.
Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
May 2 '06 #5

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

Similar topics

42
3330
by: Shayan | last post by:
Is there a boolean flag that can be set atomically without needing to wrap it in a mutex? This flag will be checked constantly by multiple threads so I don't really want to deal with the overhead of mutexes or semaphores. Thanks. Shayan
2
2595
by: gabriel | last post by:
Greetings, I am adding foreign keys to a database and saving the generated scripts. What I do not understand is that all script begin with empty transactions. Why ? Example follows : /*
2
4447
by: Lyn Duong | last post by:
Hi In SQL Server query analyser, I have the follwoing query if exists (select * from dbo.sysobjects where id = object_id(N'.') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table . GO
8
1855
by: Ben Young | last post by:
Hi there, I am having a problem with the following code: CREATE TABLE temp ( num integer UNIQUE ); INSERT INTO temp (num) VALUES (1); INSERT INTO temp (num) VALUES (2); INSERT INTO temp (num) VALUES (3); UPDATE temp SET num = num+1;
6
6242
by: blackstreetcat | last post by:
consider this code : int i; //gobal var Thread1: i=some value; Thread2: if (i==2) dosomething(); else dosomethingelse();
1
5255
by: mstraczynski | last post by:
Hello, I've written a procedure that extracts records from the source table and migrates them into several other tables. For each source record several records in destination tables have to be created and updated, so this operations need to be done in one UoW. Furthermore, the possible errors should be logged but they shouldn't stop the whole migration process. So if the migration fails for one source record, the migration should proceed...
10
6094
by: jimmy | last post by:
Hi again, sorry for posting two questions so close together but im working on a school project which is due in soon and running into some difficulties implementing the database parts. I have the code below which when executed generates the following error message: 'There is already an open datareader with this command which must be closed first' Private Sub MainMenu_Load(ByVal sender As System.Object, ByVal e As
2
2931
by: Freedom fighter | last post by:
Hello, Is a singleton class the same as an atomic class? I know that a singleton class can only be instantiated once, but does that concept apply to an atomic class? Thank you.
11
6323
by: Jon Harrop | last post by:
Can read locks on a data structure be removed safely when updates are limited to replacing a reference? In other words, is setting a reference an atomic operation? I have been assuming that all writes of <=1 word of data are atomic. Is this actually documented anywhere? -- Dr Jon D Harrop, Flying Frog Consultancy http://www.ffconsultancy.com/products/?u
0
7941
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7874
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8368
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6652
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5738
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5404
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3854
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1205
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.