MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Convert output file to Excel sheet

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Thu Jul 08, 2010 9:38 am    Post subject: Convert output file to Excel sheet Reply with quote

Hi,

We run a SQL query and get an output of LRECL of 100 with a min of 10 records and max of 25 records on daily basis. The output fiel contains 6 columns.

Would you please let me know how to convert this file into an Excel sheet using any of the utilities.

Thanks.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Thu Jul 08, 2010 10:10 am    Post subject: Reply with quote

what do you use to run the query? SPUFI, qmf, DSNUTIL?

the db2 unloads have provisions for inserting semi-colons <;> between each column value.

there was a recent topic (use the search function) where kolusu provided a solution,
(or provided a link to a solution).

normally,
create a flatfile,
download as csv (txt)
and then import (or open) to excel sheet.

I understand that there are utilities that can be BOUGHT that will do some or part of this.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
jim haire
Beginner


Joined: 30 Dec 2002
Posts: 140
Topics: 40

PostPosted: Thu Jul 08, 2010 10:32 am    Post subject: Reply with quote

You can also place tab characters between each field and save as a .prn file. This can be opened in Excel as well.

I like this approach because datasets can have commas as part of their data. TABs aren't nearly as common.

If the data you are returning contains character columns, you could concatenate your delimiters in the select clause and return a single string.

Example (with commas):
SELECT FIELD_1 || ',' || FIELD_2 || ',' || FIELD_3 FROM TABLE WHERE...

FTP the result to your C: drive and open in Excel. You would need to convert numerics using DIGITS function and dates using CHAR function to convert other types of data to character before concatenation.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Jul 08, 2010 10:48 am    Post subject: Reply with quote

ranga_subham,

Try this . X'05' is tab character, Now your unload file is created as tab delimited file. As jim mentioned if you want readable format of data , then you need to have CHAR scalar function for Varchar data and CHAR/DIGITS scalar function for numeric data

Code:

SELECT DB2_COL_1
      ,CHAR(X'05')
      ,DB2_COL_2
      ,CHAR(X'05')
      ,DB2_COL_3
      ,CHAR(X'05')
      ,DB2_COL_4
      ,CHAR(X'05')
      ,DB2_COL_5
      ,CHAR(X'05')
      ,DB2_COL_6
  FROM TABLE
 WHERE ...


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group