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

Need to write record of PS File in excel format


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Chandan1993

New User


Joined: 21 May 2017
Posts: 6
Location: India

PostPosted: Wed Jun 07, 2017 1:35 am
Reply with quote

Hi All,

I have unloaded the record from table in to PS file and now i want write the record in excel format in PS file. is it possible ?
Reason why i am doing this i need to send email of unloaded file records and records should be written as tabular format in email.

Thanks You !
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Jun 07, 2017 1:48 am
Reply with quote

Quote:
now i want write the record in excel format in PS file. is it possible ?
Yes. The EASY way is to write the data as a comma-delimited data set, transfer to a server, and open the .csv with Excel. This does not allow any fonts or special formatting, however.

If your site has purchased SAS, SAS can read the data set and produce an Excel output for transfer to a server. This allows some special formatting to be done.

If your site has purchased a spreadsheet package for the mainframe that does generate Excel format, you could use that to process the data set and transfer the output to a server.

The other option is to read the Microsoft file specifications document for Excel (the last time I looked 4 years ago it was well over 1,000 pages) and write a program on the mainframe to generate the .xlsx or .xls directly. An accomplished team of 4 to 6 programmers could probably get this done within a year if they focus on it.

And, by the way, even if the data is transferred as Excel data the email may or may not be tabular; that would depend more upon your email client and how it formats data.
Back to top
View user's profile Send private message
jasorn
Warnings : 1

Active User


Joined: 12 Jul 2006
Posts: 191
Location: USA

PostPosted: Wed Aug 08, 2018 1:15 am
Reply with quote

What I do if I want to send formatted spreadsheets from a batch job(note I NEVER have access to commercial program designed for this) is use Excel as a painter for the layout and save it as xml. The trick is populating placeholder fields so you can better parse the xml.

Then it's just a matter of creating the program to either replace all of the placeholders if you used a static layout, or copy the data rows if the number of rows will change. Name it xls so that it will open in Excel.

The only downside is that with recent versions of Excel you get a warning that the file is not in the same format as the extension. But it opens in excel just fine.

Been doing this for years and it's never let me down. Started doing this in dbasevi when Excel first had the save as html, which also works fine. But saving as html doesn't work from the mainframe because Excels, html format includes characters which don't translate from ascii to ebcdic.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Wed Aug 08, 2018 2:21 am
Reply with quote

Quote:
I have unloaded the record from table in to PS file
How complex it is to write comma or tab separated SELECT query ? I advise to use CONCAT or || in SELECT query it self the way you would like the data to be seen and delimited instead of post patch work
Back to top
View user's profile Send private message
jasorn
Warnings : 1

Active User


Joined: 12 Jul 2006
Posts: 191
Location: USA

PostPosted: Wed Aug 08, 2018 2:26 am
Reply with quote

Quote:
How complex it is to write comma or tab separated SELECT query ? I advise to use CONCAT or || in SELECT query it self the way you would like the data to be seen and delimited instead of post patch work


For some cases it's not a matter of it being hard to create a CSV file but a matter of user friendliness. If your users need to then format it, it's less friendly. And sometimes you want even more than just a report. You might want other fancy 'Excel' stuff.

So, while CSV is the method I prefer most, there are cases where it's not sufficient and another option needs to be used.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Wed Aug 08, 2018 2:33 am
Reply with quote

Quote:
For some cases it's not a matter of it being hard to create a CSV file but a matter of user friendliness. If your users need to then format it, it's less friendly. And sometimes you want even more than just a report. You might want other fancy 'Excel' stuff.
One can still play around the raw data after its being given in CSV or excel format with. I am all saying is to get that raw data into file by comma or tab delimited in SELECT query itself, which is simpler to do.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Thu Aug 09, 2018 7:31 pm
Reply with quote

Chandan1993 wrote:
...send email of unloaded file records and records should be written as tabular format in email....

Option 1: send mail in HTML format with <table></table> tags.
Option 2: Use DIF (Data Interchange Format) instead of CSV.

DIF is not as friendly as CSV, some things won't stick (like column width or "Freeze Top Row") but it can contain formulas, which is already a big improvement !
Back to top
View user's profile Send private message
phunsoft

New User


Joined: 19 Jul 2018
Posts: 11
Location: Switzerland

PostPosted: Thu Aug 09, 2018 9:46 pm
Reply with quote

In a former job, we wrote a program to generate an XML-format Excel file directly. I don't have the code handy, but I seem to remember that this wasn't difficult at all. There is probably more programming effort to parse an XML and do variable subsituition.
Back to top
View user's profile Send private message
jasorn
Warnings : 1

Active User


Joined: 12 Jul 2006
Posts: 191
Location: USA

PostPosted: Sat Aug 11, 2018 12:38 am
Reply with quote

phunsoft wrote:
There is probably more programming effort to parse an XML and do variable subsituition.

Perhaps, and it's not a bad idea regardless.

But I would think this becomes less true the more fancy the formatting becomes. The more fancy the formatting becomes the nicer it is to use excel as a painter. And often it's simply a matter of creating string replacements parameters.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top