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
 
Unloading DB2 table in CSV format along with header

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
grvtomar

New User


Joined: 29 Apr 2015
Posts: 7
Location: Sri Lanka

PostPosted: Sun Jan 28, 2018 2:05 am    Post subject: Unloading DB2 table in CSV format along with header
Reply with quote

Hi,

looking for an alternative option to unload a DB2 table with header(column name)in csv format. I have tried few of the options like

Unloaded a table with utilites like DSNTIAUL, IKJEFT01,DSNUTILB using JCL

1. using below select card...
Select 1 as ID, <"header-names"> from Sysibm.sysdummy
union
Select 2 as Id ,< Column-name> from Usertable
order by ID

2. write column name in different file delimited by ";" and merge it with unload file.

above solution are having some issue with my firm(Guidelines: issues with utilities, performance etc)
any alternate solution for this problem please ?

Thanks

icon_eek.gif
Back to top
View user's profile Send private message

sergeyken

Active User


Joined: 29 Apr 2008
Posts: 388
Location: Maryland

PostPosted: Sun Jan 28, 2018 6:32 pm    Post subject: Re: Unloading DB2 table in CSV format along with header
Reply with quote

grvtomar wrote:
Unloaded a table with utilites like DSNTIAUL, IKJEFT01, DSNUTILB using JCL

IKJEFT01 has nothing to do with DB2 or whatever. It can only execute TSO commands in batch environment.
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10541
Location: italy

PostPosted: Sun Jan 28, 2018 7:52 pm    Post subject: Reply to: Unloading DB2 table in CSV format along with header
Reply with quote

Quote:
IKJEFT01 has nothing to do with DB2 or whatever.


unfortunately that' s the current way of looking at things on most of the forums
( IKJEFT01 as a generic utility to do whatever task at hand -
disregarding the SYSTSIN control statements )

along with considering JCL anything that is not a cobol user program

No flames, nor kind suggestions will make the idtents change their ways

You ( all of us ) will have to live with this
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1303
Location: Israel

PostPosted: Sun Jan 28, 2018 8:57 pm    Post subject:
Reply with quote

To unload the data itself, I think DSNUTILB is the easiest way:
Code:
UNLOAD DATA FROM TABLE xxx.yyy DELIMITED COLDEL ';'


If you have SYNCSORT, you can use the DB2 Query Support (if enabled at your site), but then you have to squeeze the values and add separators, making the parameters difficult to read and maintain.

Anyway, both cases will not provide the header line, for which there is no obvious solution.
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 388
Location: Maryland

PostPosted: Sun Jan 28, 2018 9:59 pm    Post subject: Re: Reply to: Unloading DB2 table in CSV format along with header
Reply with quote

enrico-sorichetti wrote:
Quote:
IKJEFT01 has nothing to do with DB2 or whatever.


unfortunately that' s the current way of looking at things on most of the forums
( IKJEFT01 as a generic utility to do whatever task at hand -
disregarding the SYSTSIN control statements )

along with considering JCL anything that is not a cobol user program

No flames, nor kind suggestions will make the idtents change their ways

You ( all of us ) will have to live with this

Yes...
As well as "IEFBR14 is system utility to delete 'files'..." icon_pai.gif
Where "14" stands for "the maximum number of files to delete"? icon_rolleyes.gif
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 671
Location: Whitby, ON, Canada

PostPosted: Mon Jan 29, 2018 9:24 pm    Post subject:
Reply with quote

My favourite method is QMF's EXPORT DATA command. For example:
Code:
EXPORT DATA TO 'your .dataset.name.csv' (D=CSV CONFIRM=N
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1303
Location: Israel

PostPosted: Mon Jan 29, 2018 9:43 pm    Post subject: Re: Unloading DB2 table in CSV format along with header
Reply with quote

grvtomar wrote:
above solution are having some issue with my firm(Guidelines: issues with utilities, performance etc)
any alternate solution for this problem please ?

Only now I notice that we are in the "COBOL Programming" forum.
Is that the alternate solution your company seek ?
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1303
Location: Israel

PostPosted: Tue Jan 30, 2018 9:23 pm    Post subject:
Reply with quote

https://www.ibm.com/support/knowledgecenter/en/SSEPEK_11.0.0/apsg/src/tpc/db2z_samplecoboldynamicsql.html

Just wanted to keep this address, in case the answer to my question is Yes...
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is a table space in db2 for z/os? martin schlatter DB2 13 Sat Nov 24, 2018 11:19 pm
No new posts Code numeric format to display both '... Time2Live COBOL Programming 7 Wed Nov 21, 2018 10:20 pm
No new posts Modify the value of a extensionvariab... UmeySan CLIST & REXX 29 Wed Nov 14, 2018 11:48 pm
No new posts Facing Issue in Table Reorg satish.ms10 DB2 1 Tue Aug 07, 2018 2:44 am
No new posts SQL IN predicate using COBOL table jerryte DB2 16 Fri Jun 29, 2018 10:30 pm

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