Home > AS/400 Tips > iSeries programmer tips > Send spreadsheets from AS/400 via e-mail
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES PROGRAMMER TIPS

Send spreadsheets from AS/400 via e-mail


Mike Tillison
01.08.2001
Rating: -3.76- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


It is possible to send a spreadsheet from the AS/400 via e-mail as an attachment. The following example uses a Qry/400 output file, but it could just as easily be done with a program output file, or Opnqryf output. There are a few simple rules to follow:

1. Each field within the file must be separated by a ',' (comma). In Qry/400, this can be done by defining result fields such as COM1, COM2, COM3, etc. -- each having an expression of ',' and placing these in between your data fields.

2. Numeric fields MUST be Zoned Decimal, NOT Packed. To do this in Qry/400, just use the field in a calculation. Define a Result field and use the file field in the expression, e.g. add zero to it or multiply by 1. Then use the Result field in the output file. Make SURE you specify a length for the Result field otherwise it will pack it. 'Summary' Result fields are always Zoned Decimal.

Once the file has been created, you need to convert it to ASCII by copying it to an AS/400 folder with the following command:

The 'TODOC' name can be any name, but it must have the prefix '.CSV', which is a file extension of 'Comma Separated V


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
RPG iSeries programming
Migrating from RPG to EGL on IBM i
Allow access to data from a stored procedure result set using COBOL or RPG
EGL Rich UI on IBM i: Do you Dojo?
Programming for the Web on the IBM i, what is possible
A taste of COMMON: ILE, IBM releases, Web applications and new products
Documenting nested program structures on the AS/400
How to: Sort arrays using RPGIV
How to: Create an RPGLE array
How to use an embedded SQL statement and display the result in a subfile
Eight steps for creating program documentation using AS/400 utilities

iSeries ILE programming
How to use an embedded SQL statement and display the result in a subfile
Eight steps for creating program documentation using AS/400 utilities
Searching fields for values
Searching part of a name or address in AS/400
Top 10 programmer tips YTD
How to use the binder language to manage service programs -- Part 3: Examples and pitfalls
Top 10 programmer tips of 2005
How to use the binder language to manage service programs -- Part 2: Understanding the binder language
How to use the binder language to manage service programs -- Part 1: Service program signatures
Display attributes made simple

iSeries programmer tips
Groovy programming on IBM i
EGL Rich UI on IBM i: Do you Dojo?
Running PHP open source applications: NOBODY needs authority
Programming for the Web on the IBM i, what is possible
Using geocoding on AS/400 to enhance your Web presence
The best technologies and tools for System i programmers in 2009
Seven IBM i project lessons learned in 2008
Documenting nested program structures on the AS/400
What is an integrated database?
An automated CL method of moving a query from AS/400 to Excel

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
Report Program Generator  (Search400.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


alues'.

Now, send it as an e-mail attachment with the following command:

The Recipient will get an e-mail message stating 'Attached is the data you requested,' along with the attached file called MYFILE.CSV.

When opened in Excel, there's all your data in nice neat rows and columns. (It should work the same in Lotus).

Comments and caveats

There is an obvious chance that you may have commas embedded within your text fields, which will skew the data columns in the spreadsheet. To prevent this, I wrote a small RPG program to convert any of these embedded commas to 'blank' before it gets converted to the folder.

There is a setting on the 400 that dictates how large a message can be. If this is set too small, your attachment will be sliced and diced into multiple garbled e-mail messages.

Check your POP Server Attributes (CHGPOPA) or see the IBM Support document, reference number 862565c2007cda23 for the fix.

The SNDDST can send to AS/400 user IDs as long as their SMTP addresses has been entered in the Directory Entries. The User ID will resolve to the actual SMTP address.


Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts