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

how to unload a DB2 table


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

New User


Joined: 19 Oct 2007
Posts: 37
Location: chennai

PostPosted: Thu Dec 27, 2007 1:51 pm
Reply with quote

Hi,


I have a query i want to unload the DB2 table in to a sequential file in that i want to see the first 100 records only,Could anyone tell me how to do that as am new to DB2


Thanks in Advance

Karthik
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu Dec 27, 2007 1:52 pm
Reply with quote

Karthik,

Discussed earlier. Search the forum.
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Thu Dec 27, 2007 4:36 pm
Reply with quote

Hi karthik,

write a Select query to extract data from DB2 table and move those values into file variables.

Hope you understood.

KSk
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Thu Dec 27, 2007 4:56 pm
Reply with quote

Hi Karthik,

As suggested you can search the forum on the key word "Unload Table", hopefully you will get some good hits. There can be many methods, if you would like to use JCL, below code can be handy.

Code:
//STEP030 EXEC PGM=IKJEFT01,                           
//             DYNAMNBR=20,                             
//             REGION=4M                               
//*                                                     
//STEPLIB  DD  DSN=DB2SYS1.VEND.LOADLIB,               
//             DISP=SHR                                 
//*                                                     
//SYSREC00 DD  DSN=XX1234.UNLOAD.FILE, 
//             DISP=(NEW,CATLG,CATLG),                 
//             UNIT=SYSDA                               
//*                                                     
//SYSPUNCH DD SYSOUT=*                                 
//*                                                     
//SYSTSPRT DD  SYSOUT=*                                 
//SYSPRINT DD  SYSOUT=*                                 
//SYSUDUMP DD  SYSOUT=*                                 
//SYSTSIN  DD  *                                       
  DSN SYSTEM(DB2D)                                     
  RUN PROGRAM(DSNTIAUL) PLAN(DSNTIAUL) -               
  PARM('SQL')                                           
/*                                                     
//*                                                     
//SYSIN    DD  *                                       
    SELECT *                                           
      FROM Table Name
      FETCH FIRST 100 ROW ONLY;
      ORDER BY column_name
     WITH UR;
/*           
//*         
Back to top
View user's profile Send private message
sachin_kaushik84

New User


Joined: 03 Oct 2008
Posts: 23
Location: noida

PostPosted: Thu Oct 16, 2008 4:25 pm
Reply with quote

//SYSTSIN DD *
DSN SYSTEM(DB2D)
RUN PROGRAM(DSNTIAUL) PLAN(DSNTIAUL) -
PARM('SQL')

hi anuj one short question to be asked here in this jcl the program name and a plan name mentioned here is system defined program or we have to give here the actual program name and a plan name whare a logic is written to perform some conditions.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Fri Oct 17, 2008 2:20 am
Reply with quote

Hi,

DSNTIAUL example program is well documented (with example) in the fine manual.
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 Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Remote Unload of CLOB Columns DB2 6
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top