View previous topic :: View next topic
|
Author |
Message |
karthik3883
New User
Joined: 19 Oct 2007 Posts: 37 Location: chennai
|
|
|
|
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 |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Karthik,
Discussed earlier. Search the forum. |
|
Back to top |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
sachin_kaushik84
New User
Joined: 03 Oct 2008 Posts: 23 Location: noida
|
|
|
|
//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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi,
DSNTIAUL example program is well documented (with example) in the fine manual. |
|
Back to top |
|
|
|