Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ 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
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    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

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
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

Active User


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

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 Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
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: 23
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 Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Best IMS DB Unload Utility jjabez10 IMS DB/DC 12 Thu Sep 22, 2016 11:15 pm
No new posts Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm
No new posts Command UNIQUE CONSTRAINT on any tabl... rohanthengal DB2 2 Thu Aug 18, 2016 3:48 pm
No new posts DB2 Unload format options Susanta DB2 2 Fri Aug 12, 2016 5:42 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us