IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Set Temporary Variable in DB2 Spufi Member


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Andi1982

New User


Joined: 27 Mar 2008
Posts: 42
Location: Karlsruhe / Germany

PostPosted: Mon Jun 16, 2008 3:29 pm
Reply with quote

Hi,

i hava a spufi member with several selects and deletes.

Code:
Delete from table.table1 where Keynumber = 1234 and Secondnumber = 54323;

insert into table.table1 (col1, col2, col3)
select col1, col2, col3
where Keynumber = 1234 and Secondnumber = 54323;

....
....


Is it possible to set a variable at first step so that i just have to change once the value of keynumber and secondnumber.

I tried something like that:

Code:
SET KEYNUM = 1234;
SET SECONNUM = 54323;


Delete from table.table1 where Keynumber = KEYNUM and Secondnumber = SECONNUM;

insert into table.table1 (col1, col2, col3)
select col1, col2, col3
where Keynumber = KEYNUM and Secondnumber = SECONNUM;

....
....


This example does not work, but is something like this possible in spufi? We have DB2 Version 8, and 9 will follow soon.

Regards
Andi
Back to top
View user's profile Send private message
birdy K

New User


Joined: 05 Mar 2008
Posts: 72
Location: chennai

PostPosted: Mon Jun 16, 2008 3:58 pm
Reply with quote

I guess In SPUFI member, You can use "CHG" or "CHG ALL" command to replace. I think this will work. Then why you need "SET" command
Back to top
View user's profile Send private message
Andi1982

New User


Joined: 27 Mar 2008
Posts: 42
Location: Karlsruhe / Germany

PostPosted: Mon Jun 16, 2008 4:06 pm
Reply with quote

Normally this was the way i did my changes. But sometimes
KEYNUM = 1234
and SECONNUM = 1234

but then
KEYNUM should be 5689
and SECONNUM should be 21454.

So the "change all" command is not possible anymore. I thought it would be easier to have one part in member where i can define the used variables.

My example is just a little one to show you my problem. I have much more Variables in my spufi. But i think i have to do this changes manual anymore.
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Tue Jun 17, 2008 12:24 am
Reply with quote

If I am remembering correctly, you can set variables if you wrap your SQL in a BEGIN and END SQL statement.
Back to top
View user's profile Send private message
Andi1982

New User


Joined: 27 Mar 2008
Posts: 42
Location: Karlsruhe / Germany

PostPosted: Tue Jun 17, 2008 11:11 am
Reply with quote

hm,

i can't find such syntax anywhere. I got an error when i tried this.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jun 17, 2008 2:00 pm
Reply with quote

if you would write your sql with conditions on separate lines, you could use a combination of x all, chg all nx.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Tue Jun 17, 2008 5:23 pm
Reply with quote

Hi !

As i remember, BEGINN & END encloses a series of Transact-SQL statements so that a group of Transact-SQL statements can be executed. BEGIN and END are control-of-flow language keywords for Transact-SQL.
Transact-SQL (T-SQL) is Microsoft's and Sybase's proprietary extension to the SQL language.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts DELETE SPUFI DB2 1
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Adding QMF and SPUFI to the ISPF menu DB2 20
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts How to copy the -1 version of a membe... TSO/ISPF 4
Search our Forums:

Back to Top