Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum 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 Member


Joined: 29 Apr 2008
Posts: 627
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: 10637
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: 1331
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 Member


Joined: 29 Apr 2008
Posts: 627
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: 684
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: 1331
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: 1331
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 File compare, where file has header a... VINAY PALLELA SYNCSORT 8 Thu Nov 07, 2019 5:05 pm
No new posts Convert mainframe data to .csv format... karan_reddy DFSORT/ICETOOL 10 Sat Nov 02, 2019 2:09 am
No new posts Parsing single liner XML into readabl... rohanthengal COBOL Programming 1 Fri Oct 18, 2019 8:41 pm
No new posts LOAD JCL for db2 table, taking too lo... Somnath Giri DB2 5 Mon Oct 14, 2019 3:35 pm
No new posts Adding FIND to ISPF Panel display of ... Harold Barnes TSO/ISPF 3 Mon Oct 07, 2019 5:46 pm

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