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: 5
Location: Germany

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: 261
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10408
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: 1268
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: 261
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: 662
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: 1268
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: 1268
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 load and delete table through JCL wit... ram_vizag JCL & VSAM 9 Thu Feb 01, 2018 12:47 am
No new posts Sum the fields in particular format f... sharana64 DFSORT/ICETOOL 9 Fri Jan 05, 2018 1:11 am
No new posts Format Last Record differently from r... Learncoholic DFSORT/ICETOOL 5 Tue Oct 24, 2017 12:01 pm
No new posts Format issues using XMITIP MSGDD ssdjp1 CLIST & REXX 5 Mon Oct 23, 2017 8:47 pm
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm

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