By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,610 Members | 2,310 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,610 IT Pros & Developers. It's quick & easy.

BEGIN ATOMIC, COMMAND CENTRE SCRIPT

P: n/a
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_SCHEMA = 'COMP' );

END
@

Randy

May 2 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a

"TheSpongebob" <ga*****@sympatico.ca> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.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_SCHEMA = 'COMP' );

END
@


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

--
Rhino
May 2 '06 #3

P: n/a
thanx guys. all excellent solutions.

May 2 '06 #4

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.