Help on understanding unload



IBM's flagship relational database management system

Help on understanding unload

Postby curios13579 » Tue Jul 21, 2009 12:18 pm

Hello, first of all I am new with DB2 and databases so please be patient if the questions seems to be stupid :(

Let's say I have to do this unload , if I did it once and RC was 0 so finished well, what happens if I do the step again?
will it unload it again cancel and write the file again or it will write over it?
In small words: will it duplicate the RECORDS WRITTEN in file ? because with the DISP=(,CATLG,DELETE), it shoul delete it only if abends right?

//*-------------------------------------------
//* UNLOAD TABEL
//*-------------------------------------------
//12345678 EXEC DB2HPU
//SYSPRINT DD SYSOUT=*
//UNLDDN1 DD DSN=xxx.xxx.xxxx.xxxxxxxx.xxxx,
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(300,150),RLSE),
// DSORG=PS,LRECL=1300,RECFM=FB
//LOADNDN1 DD DUMMY
//$ORTPARM DD *
OPTION FILSZ=U30000000
/*
//SYSIN DD *
UNLOAD TABLESPACE 12345678.1234567
DB2 NO LOCK NO
SELECT * FROM 1234.98765432 WHERE CIST = 33
OUTDDN (UNLDDN1)
FORMAT DSNTIAUL


thanks in advance
curios13579
 
Posts: 13
Joined: Mon May 05, 2008 4:57 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Help on understanding unload

Postby nayanpatra » Tue Jul 21, 2009 4:06 pm

The job will abend if you are using a simple sequential file. But if you are using a GDG version then a new version will be created. In order to reuse the PS you can use DISP = SHR
nayanpatra
 
Posts: 19
Joined: Mon Jul 06, 2009 4:35 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Help on understanding unload

Postby dick scherrer » Wed Jul 22, 2009 1:36 am

Hello,

This is more of a jcl question than a db2 question. . .

Suggest you review how the DISP paramater of the DD statement works.

This situation would exist if this was a sort, an iebgener, a user program, etc.

If the file is to be re-created at each execution, suggest you incorporate a "housekeeping" step to make sure the dataset does not exist before the (new,catlg,delete) is processed.

I suggest you NOT use disp=shr because shr has a completely different meaning and purpose.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post