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

Unloading DB2 table in CSV format along with header


IBM Mainframe Forums -> DB2
Post new topic   This topic is locked: you cannot edit posts or make replies.
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
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

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Sun Jan 28, 2018 6:32 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sun Jan 28, 2018 7:52 pm
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: 1353
Location: Israel

PostPosted: Sun Jan 28, 2018 8:57 pm
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

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Sun Jan 28, 2018 9:59 pm
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: 765
Location: Whitby, ON, Canada

PostPosted: Mon Jan 29, 2018 9:24 pm
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: 1353
Location: Israel

PostPosted: Mon Jan 29, 2018 9:43 pm
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: 1353
Location: Israel

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

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
rajendra05

New User


Joined: 22 Jan 2008
Posts: 4
Location: Hyderabad

PostPosted: Sat Nov 14, 2020 6:54 am
Reply with quote

Post deleted by moderator - Tailgating someone elses topic, resurrecting an old topic.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Need to convert date format DFSORT/ICETOOL 20
Search our Forums:

Back to Top