Page 1 of 1

db2 unload via template

PostPosted: Wed Feb 22, 2012 2:06 pm
by p19689
I'm trying to setup a ad-hoc job to unload subset of tables (200) via a template in to a partition dataset using DB2 utility(DB2 v9 z/os). I would like to assign tablespace name as the member name on PUNCHDDN on a partition dataset.

Find it difficult to get the syntax right. ( Afterward I will copy those PUNCHDDN members to a sequential dataset and run the load as a single job on the target environment)

TEMPLATE PUNCHDS DSN '&USERID..TEST.&DB.(&TS.) '
UNIT SYSDA DISP (NEW,CATLG,DELETE)
SPACE (1,1) CYL

What's wrong with the above dataset allocation for a partition dataset.

Re: db2 unload via template

PostPosted: Thu Feb 23, 2012 9:27 pm
by BillyBoyo
No directory space.

Re: db2 unload via template

PostPosted: Fri Feb 24, 2012 7:15 pm
by p19689
Thanks Billyboyo, I had added directory space but still had the msg invalid template. Is it possible to define PDS via a template pl ?

TEMPLATE PUNCHDS DSN '&USERID..TEST.SYSPUNC(&TS.) '
UNIT SYSDA DISP (NEW,CATLG,DELETE)
SPACE (1,1) DIR(1) CYL

Re: db2 unload via template

PostPosted: Fri Feb 24, 2012 10:25 pm
by BillyBoyo
I don't know what the default DCB would be, maybe recfm=u? You're going to have to show us the message.

Thinking about it, I'm not certain you can define a PDS with a reference to a member at the same time. To put it another way, I don't think you can. Look up the message. If you think it might help, pre-allocate the PDS, and remove everything except DSN and DISP, which you change to OLD.

Re: db2 unload via template

PostPosted: Sun Feb 26, 2012 4:53 pm
by p19689
Thanks , I tried preallocating the PDS but had the same error 'INVALID QUALIFIER PUNCH(tablespacename TEMPLATE PUNCHDS ' .

Template used:
TEMPLATE PUNCHDS DSN 'Y#LJYR.TEST.PUNCH(&TS.)'
DISP (OLD,KEEP,KEEP)

Is this impossible to do ? I have seen before that some people had mentioned they use this method to unload many tables from the source and merge the SYSPUNCH and run as a single unload jon in the target environment. That's what I thought of give a try, if possible it's very efficient method.

Re: db2 unload via template

PostPosted: Sun Feb 26, 2012 5:37 pm
by BillyBoyo
I guess you need to look up the message and see what it is telling you.