Topic
1 reply Latest Post - ‏2013-01-05T09:05:18Z by SystemAdmin
Erlendur
Erlendur
1 Post
ACCEPTED ANSWER

Pinned topic begin atomic - error

‏2012-10-02T15:56:59Z |
Hi,

I am trying to execute a script against DB2 z/OS 10.1.5 via DB2 CLP.

Here is the content of the script (attached as well so that encoding issues and eol issues can be tested):
Content starts ...

echo start connecting#
connect to dbname user username using password#
echo connection established#

echo set schema#
set schema schemaname#
echo schema has been set#

echo atomic block starts#
begin atomic
select id from myTable;
INSERT INTO myTable
(
ID
)
VALUES
(
3
);

select id from myTable;

end#

echo atomic block ends#

echo disconnecting#
disconnect dbname#
echo connection closed#

... content ends

Before executing the script I substitute dbname, username, password and schemaname with real values.

Then I issue the following command in DB2 CLP:
db2 -td# -f TRUNCATE_AND_INSERT_FRESH_DATA_demo.db2

But I receive this output:
Output starts ...

start connecting

Database Connection Information

Database server = DB2 z/OS 10.1.5
SQL authorization ID = username
Local database alias = dbname
connection established
set schema
DB20000I The SQL command completed successfully.

schema has been set
atomic block starts
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0199N The use of the reserved word "ATOMIC" following "" is not valid.
Expected tokens may include: "DECLARE". SQLSTATE=42601

atomic block ends
disconnecting
DB20000I The SQL DISCONNECT command completed successfully.

connection closed

... output ends

Can somebody explain to me why I am receiving this error?

Regards, Erlendur
Updated on 2013-01-05T09:05:18Z at 2013-01-05T09:05:18Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    3105 Posts
    ACCEPTED ANSWER

    Re: begin atomic - error

    ‏2013-01-05T09:05:18Z  in response to Erlendur
    what exactly are you trying to do?
    i'm not familiar with the begin atomic command in db2 for zos
    in fact, as far as I know you can't script against db2 for zos at all so there are no begin and end statements