Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts PC (UTF-8) -> z/OS (EBCDIC) -> ... prino All Other Mainframe Topics 4 Fri Sep 01, 2017 1:47 am
No new posts Adding a userid to SMTP Security table Yolanda Harvey JCL & VSAM 1 Sun Aug 13, 2017 6:16 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us