View previous topic :: View next topic
|
Author |
Message |
Claes Norreen
Active User
Joined: 20 Dec 2005 Posts: 137 Location: Denmark
|
|
|
|
Hi,
I've created this "script" (see below) for unloading all tables in our production environment - including PUNCH cards. The intent is to load these in our Demo environment. However, in our Demo environment, there may be new columns in some tables. Therefore:
My question is: If I just wanted to create PUNCH cards using UNLOAD (and not the actual UNLOAD of data), will I have to do this table by table (using LIMIT 0)? It would be fantastic, if I had this option.
Another question: When I define the dynamic dataset names (using &DB and &TS) - how do I best avoid allocation errors (dataset already exists) when I run the job the 2nd time and on?
Code: |
OPTIONS EVENT (ITEMERROR,SKIP,WARNING,RC4)
LISTDEF LIST1
INCLUDE TABLE bla.blabla
TEMPLATE TUNLDDN
UNIT SYSDA
DISP(NEW,CATLG,DELETE)
SPACE CYL
PCTPRIME 50
MAXPRIME 1000
DSN('T.UNLOAD.&DB..&TS..DATA');
TEMPLATE TPUNCH
UNIT SYSDA
DISP(NEW,CATLG,DELETE)
SPACE(1,1)
DSN('T.UNLOAD.&DB..&TS..PUNCH');
UNLOAD LIST LIST1
PUNCHDDN TPUNCH
UNLDDN TUNLDDN
|
|
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
I think you have to do it table by table.
Regarding dynamic dataset names, you can define them as GDG with limit = 1 or any thing. |
|
Back to top |
|
|
Claes Norreen
Active User
Joined: 20 Dec 2005 Posts: 137 Location: Denmark
|
|
|
|
Thanks for a quick reply!
Is this the place to post suggestions for future enhancements? If so, please add this to your list:
Make it possible to just create PUNCH cards without actually unloading anything. |
|
Back to top |
|
|
Dsingh29
Active User
Joined: 16 Dec 2008 Posts: 132 Location: IBM
|
|
|
|
Add something like '.D&DT..T&TI' to add date and timestamp to avoid ds allocation errors. |
|
Back to top |
|
|
Claes Norreen
Active User
Joined: 20 Dec 2005 Posts: 137 Location: Denmark
|
|
|
|
No, &TS is TABLESPACE |
|
Back to top |
|
|
Claes Norreen
Active User
Joined: 20 Dec 2005 Posts: 137 Location: Denmark
|
|
|
|
Plus, I will only need ONE dataset for each table - I don't want to keep X number of generations, as this is of course very space consuming. |
|
Back to top |
|
|
Claes Norreen
Active User
Joined: 20 Dec 2005 Posts: 137 Location: Denmark
|
|
|
|
GDGLIMIT 1 seems to work just as I wanted - thanks again. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
What I have done is create a WHEN condition that will produce no rows returned.
Something like:
Code: |
UNLOAD LIST LIST1
WHEN (LIST = 'X' AND LIST <> 'X')
PUNCHDDN TPUNCH
UNLDDN TUNLDDN |
See if this works for you. |
|
Back to top |
|
|
Claes Norreen
Active User
Joined: 20 Dec 2005 Posts: 137 Location: Denmark
|
|
|
|
I tried, but didn't work? I'm on v10 - which version are you on?
Code: |
- INVALID OPERAND 'WHEN' FOR KEYWORD 'UNLOAD' |
|
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
How many tables are you Unloding with this?
After I posted, I noticed, my syntax was for the Unload of a single table, not a List of tables as you are doing.
This approach will not work I do not think.
PS - We are on DB2V9. |
|
Back to top |
|
|
Claes Norreen
Active User
Joined: 20 Dec 2005 Posts: 137 Location: Denmark
|
|
|
|
About 50
With single table syntax, it may be better to code LIMIT 0 instead. |
|
Back to top |
|
|
|