0

I am looking for a way to attach a database file as an excel sheet in a mail and send it out from an IBM i server. Please advise if there is any way to do this using only native iseries commands. Our company restricts the use of open source tools available and hence looking for a native method.

I do have the esendmail utility available but it does not have this feature available.

  • A google turned this up: https://www.ibm.com/support/knowledgecenter/en/SSEPGG_9.7.0/com.ibm.db2.luw.sql.rtn.doc/doc/r0055177.html – Nick.Mc Dec 09 '18 at 07:48
  • Given link is for LUW paltforms. Not DB2 for i. Also, it does not have any references to attaching a db2 file as an excel in the mail. – MordernRPGSoldier Dec 09 '18 at 08:34
  • Does this need to be an automatic process, or is it a one off that you can do manually? – jmarkmurphy Dec 10 '18 at 21:32

2 Answers2

1

I'm on 7.3 and I don't know of an IBM command that will create a spreadsheet. One can create a CSV-like file with CPYTOIMPF, but not a full blown Excel spreadsheet.

You can submit an RFE to ask IBM to provide a native solution, but several similar requests have been turned down because IBM has given us the ability to port / use many existing open source packages. For example, Python 2 and 3 are available from the IBM open source repository via yum, and once Python is on the system, you can pip install any of several Python packages specifically meant to work with Excel.

This hybrid IBM / open source environment is not just the future; it's the present. And IBM is pushing that environment as fast as they can. If my management were to insist that we avoid using the IBM-recommended approach, I'd pretty much be forced to reverse engineer the .XLSX format and write it myself.

If you want to have a taste of what that might look like, take an existing Excel .XLSX file, rename it .ZIP, un-zip it, and poke around inside the folder hierarchy.

Buck Calabro
  • 7,558
  • 22
  • 25
  • This about covers it. For companies which have held fast to a "native IBM i only" stance (or more likely "native AS/400 only"!), I wonder what they will make of the fact that IBM itself is pushing and providing open source. – John Y Dec 10 '18 at 06:19
0

So the real issue I was facing was with how to send the .csv file over email with the correct formatting as I was getting only junk in the attachment while using snddst and esndmail

The SNDSMTPEMM EMAIL command sends the mail with the correct attachment as required.

  • As this is not an answer to the question, but additional information for the question, the question should be edited to include this information. Otherwise you could get downvoted here. – jmarkmurphy Dec 10 '18 at 21:30