View previous topic :: View next topic
|
Author |
Message |
jerryte
Active User
Joined: 29 Oct 2010 Posts: 202 Location: Toronto, ON, Canada
|
|
|
|
Is there a ready made utility that can read an sql query from a dd, run it dynamically, and ouput the results in a CSV format? This is useful for importing into other tools such as Excel spreadsheets.
The DSNTIAUL utility will execute sql but it outputs the results as "raw" data. It is difficult to import this into other tools.
DSNTEP2 will do something similiar but it wraps a long row onto multiple pages. I want to have one row per line
I could cheat and code the sql to output the results as character strings and then insert a literal comma between each column. I would rather the utility does the work for me. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
I don't know of any. Which, of course, doesn't mean that there isn't any.
Do you have Rexx at your disposal? How about the OpenSoftware REXXTOOLS package? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
DSNTIAUL utility will execute sql but it outputs the results as "raw" data |
only if you just do select column
you can cast columns to the result that you want,
select int(col1)
, ';'
. char(col2)
...
DSNTIAUL is actually SPUFI in batch.
you can also use other formating techniques with the link that
Dick Scherrer. provided.
depends on what is easiest for you to generate. |
|
Back to top |
|
|
Eshwar CICS
New User
Joined: 18 May 2011 Posts: 47 Location: India
|
|
|
|
Hi Jerryte,
If you have access to RDZ, in data perspective you can save results of your query in CSV, HTML, XML and other supported options.Thanks. |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
Back to top |
|
|
jerryte
Active User
Joined: 29 Oct 2010 Posts: 202 Location: Toronto, ON, Canada
|
|
|
|
Thanks for the tips. I know about the UNLOAD delimited but this outputs the entire row for a single table and does not allow for SQL. Maybe someone at IBM can one day modify the DSNTIAUL to allow for CSV formatted output. It would be nice. |
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
Don't give up on UNLOAD until you have investigated the WHEN parameter.
WHEN allows you to code search conditions that might be enough to meet your requirement.
If not, then your best bet is to use the technique suggested by Dick. It's the one that I use when I want to produce delimited output from a complex query (i.e. one that is too complex to be satisfied by UNLOAD....WHEN). |
|
Back to top |
|
|
|