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

Copying DB2 table to Flat file


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

New User


Joined: 06 Feb 2007
Posts: 19
Location: Hyderabad

PostPosted: Wed Sep 05, 2007 7:37 pm
Reply with quote

Need to copy a DB2 table to a flat file.
Used the following job as mentioned in an earlier post

Code:

//STP0100  EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(4,LT)     
//SYSREC00 DD DSN=DOWLOAD.DATASET,
//         DISP=(,CATLG,DELETE),                         
//         UNIT=SYSDA,SPACE=(CYL,(100,100),RLSE)         
//SYSPUNCH DD  DUMMY                                     
//SYSTSPRT DD  SYSOUT=*                                 
//SYSPRINT DD  SYSOUT=*                                 
//SYSUDUMP DD  SYSOUT=*                                 
//SYSTSIN  DD  *                                         
 DSN SYSTEM(DB2S)                                       
 RUN  PROGRAM(DSNTIAUL) PLAN(DSNTIAUL) PARMS('SQL')     
 END                                                     
/*                                                       
//SYSIN    DD *                                         
  SELECT * FROM TABLE.NAME
    ;                                                   
/*                                     


It was giving a MAXCC12 saying DSN not found.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Wed Sep 05, 2007 7:56 pm
Reply with quote

If you've some third party tools like BMCADM, then there is another way as well.
Back to top
View user's profile Send private message
nithinlenin

New User


Joined: 06 Feb 2007
Posts: 19
Location: Hyderabad

PostPosted: Thu Sep 06, 2007 10:08 am
Reply with quote

no yaar ... have to write a jcl itselff..
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Thu Sep 06, 2007 10:57 am
Reply with quote

Can you post the complete message?

O.
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 Sep 06, 2007 2:11 pm
Reply with quote

nithinlenin wrote:
It was giving a MAXCC12 saying DSN not found.
Which DSN is not found? Post your SYSOUT messages, AS suggested. By the time try using PARM('SQL') instead of PARMS('SQL').
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Thu Sep 06, 2007 5:39 pm
Reply with quote

You did create DOWLOAD.DATASET before running this didn't you?
Back to top
View user's profile Send private message
Prasanthhere

Active User


Joined: 03 Aug 2005
Posts: 306

PostPosted: Fri Sep 07, 2007 6:26 pm
Reply with quote

Hi

Better you try this job

//jobcard
//*--------------------------------------
//* UNLOAD DEVELOPER DB2 TABLES EXTRACY QUERY
//*--------------------------------------
//*
//UNLD01 EXEC DB@IAUL,DB2ID=DB,SQLPARM=SQL
//SYSPUNCH DD DUMMY
//SYSREC00 DD DSN=DSNNAME
// DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(50,50),RLSE),
// UNIT=SYSDA
//SYSIN DD *

Select * from table name

DB2id shold be your db region
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Mon Sep 10, 2007 9:55 am
Reply with quote

Prasanth,
What you have posted may be a site specific thing.. it may not work for OP.

@OP,
In my site only DBAs have previlage to submit a DSNTIAUL JOB. Even for DEV tables.
In such cases I will suggest coding a DSNREXX exec. It will take some time in developing it for first time, but it will be a resuable code and you will learn many new things. icon_smile.gif
Back to top
View user's profile Send private message
Prasanthhere

Active User


Joined: 03 Aug 2005
Posts: 306

PostPosted: Mon Sep 10, 2007 10:09 am
Reply with quote

Hi ,

Actually the query posted by Nithin do have this DSNTIAUL utility , So he might be having the access to try that one in his shop. I suggested an easier way for doing this .

I don't See a particular benifit in coding coding a DSNREXX exec. May be in your view point it could be a way to learn many new things . Any way let him try and reply icon_biggrin.gif
Back to top
View user's profile Send private message
bosalting

New User


Joined: 02 Jun 2007
Posts: 4
Location: Philippines

PostPosted: Mon Sep 10, 2007 11:21 am
Reply with quote

If you have QMF in your shop, issue the query you want to download in QMF. And then issue an export command to copy the result into a dataset.. This approach works well for me, instead of using UNLOAD jobs.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top