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

Unload data from a table to a file : JCL


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

New User


Joined: 04 Oct 2007
Posts: 49
Location: Mumbai

PostPosted: Tue Mar 11, 2008 12:45 pm
Reply with quote

I want to unload some data from a table into a file.
Lets say a table has some 100000 records and i want to unload from
some 10000th record. Is there any JCL for this.....
There is any option in DB2 to take extract...but if there are many records in the table we cannot take extract from the option FILE-AID , 3.7.

I want the JCL for this unload.


Thanks for ur suggestions and valuable time.
Ravneet
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Mar 11, 2008 1:07 pm
Reply with quote

Hi,

If BMC utility is not installed at Your site, You can use IKJEFT01 for this purpose. Search the forum for 'IKJEFT01'.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Mar 11, 2008 2:05 pm
Reply with quote

you can use dsnutil if you are on vsn 6 or lower. You can use dnsuproc (load & unload) if you have vsn 7 or above. Here is unload:
Code:

//UNLOAD   EXEC DSNUPROC,
//             UID='STLETTER',UTPROC='',SYSTEM='VD0G'
//SYSREC   DD  DSN=ASTEX79.STLETTER.SYSREC,
//             DISP=(NEW,CATLG,CATLG),
//             UNIT=SYSDA,SPACE=(TRK,(2,1))
//SYSPUNCH DD  DSN=ASTEX79.STLETTER.SYSPUNCH,
//             DISP=(NEW,CATLG,CATLG),
//             UNIT=SYSDA,SPACE=(TRK,(1,1))
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DSN=ASTEX79.UNLOAD.SQL(STLETTER),
//             DISP=SHR


the parm system is for your db2 dsn.
uid is for the report. _ can be anything
sysrec contains the db2 data
syspunch contains the generated load parm after you have performed an unload. modifiy this to load a different table
sysin contains the 'WHEN' clause. you will need to know the tablespace name for your table.

Code:

//LOAD     EXEC DSNUPROC,
//             UID='STLETTER',UTPROC='',SYSTEM='VD0G'
//SYSREC   DD  DSN=ASTEX79.STLETTER.SYSREC,
//             DISP=SHR
//SYSPRINT DD  SYSOUT=*
//SORTWK01 DD  DSN=&&SORTWK01,
//             UNIT=SYSDA,SPACE=(CYL,(2,1))
//SORTWK02 DD  DSN=&&SORTWK02,
//             UNIT=SYSDA,SPACE=(CYL,(2,1))
//SORTOUT  DD  DSN=&&SORTOUT,
//             UNIT=SYSDA,SPACE=(CYL,(2,1))
//SYSMAP   DD  DSN=ASTEX79.SYSUT1,DISP=(MOD,CATLG,CATLG),
//             UNIT=SYSDA,SPACE=(CYL,(2,1))
//SYSUT1   DD  DSN=&&SYSUT1,DCB=BUFNO=10,
//             UNIT=SYSDA,SPACE=(CYL,(2,1))
//SYSDISC  DD  DSN=ASTEX79.SYSDISC,DISP=(MOD,CATLG,CATLG),
//             UNIT=SYSDA,SPACE=(CYL,(1,1))
//SYSERR   DD  DSN=&&SYSERR,


the above is load jcl. The documentation for this is contained in the Utility Guide and Reference, SC26-9945-01.
Back to top
View user's profile Send private message
chhabraravneet

New User


Joined: 04 Oct 2007
Posts: 49
Location: Mumbai

PostPosted: Tue Mar 11, 2008 2:18 pm
Reply with quote

Thanks Dick.........
Your suggestions are helpful.
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top