Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
how to unload a DB2 table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
karthik3883

New User


Joined: 19 Oct 2007
Posts: 16
Location: chennai

PostPosted: Thu Dec 27, 2007 1:51 pm    Post subject: how to unload a DB2 table
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
References
murmohk1

Senior Member


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

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

Karthik,

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

Senior Member


Joined: 08 Jun 2006
Posts: 315
Location: Pune, India

PostPosted: Thu Dec 27, 2007 4:36 pm    Post subject:
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 D.

Global Moderator


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

PostPosted: Thu Dec 27, 2007 4:56 pm    Post subject:
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: 18
Location: noida

PostPosted: Thu Oct 16, 2008 4:25 pm    Post subject: if you would like to use JCL, below code can be handy.
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 D.

Global Moderator


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

PostPosted: Fri Oct 17, 2008 2:20 am    Post subject:
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1