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
 
Need to write record of PS File in excel format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Chandan1993

New User


Joined: 21 May 2017
Posts: 4
Location: India

PostPosted: Wed Jun 07, 2017 1:35 am    Post subject: Need to write record of PS File in excel format
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: 8391
Location: Dubuque, Iowa, USA

PostPosted: Wed Jun 07, 2017 1:48 am    Post subject: Reply to: Need to write record of PS File in excel format
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: 184
Location: USA

PostPosted: Wed Aug 08, 2018 1:15 am    Post subject: It's relatively easy if you use Excel as a layout painter
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

Senior Member


Joined: 21 Sep 2010
Posts: 2016
Location: NY,USA

PostPosted: Wed Aug 08, 2018 2:21 am    Post subject:
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: 184
Location: USA

PostPosted: Wed Aug 08, 2018 2:26 am    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 2016
Location: NY,USA

PostPosted: Wed Aug 08, 2018 2:33 am    Post subject:
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: 1298
Location: Israel

PostPosted: Thu Aug 09, 2018 7:31 pm    Post subject: Re: Need to write record of PS File in excel format
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    Post subject:
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: 184
Location: USA

PostPosted: Sat Aug 11, 2018 12:38 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ISPF 3.4 edit of a ps file, disp use... Carrie Da Silva TSO/ISPF 3 Fri Sep 21, 2018 3:01 am
No new posts SYNCSORT keep MIN/MAX record Cloink SYNCSORT 16 Mon Sep 17, 2018 3:00 pm
No new posts ICETOOL - Finding keys within a file nartcr DFSORT/ICETOOL 10 Mon Sep 17, 2018 6:39 am
No new posts Remove selected duplicate rows from t... hnharish DFSORT/ICETOOL 3 Wed Sep 05, 2018 3:11 am
No new posts Sort card to find duplicates, without... anand1204 DFSORT/ICETOOL 15 Fri Aug 31, 2018 12:13 am

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