TechTip: Addressing the Issue

CL
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

As time passes, there appears (to me at least) to be a decreasing popularity in the standard printed report, particularly when green-bar paper is used. Accurate or not, some users associate paper of this nature with punch cards and anti-productivity. Rewriting entire applications is not necessarily among the available options, but delivering a document by email is quick and easy, and it satisfies the user community.

The scenario starts the way it always has. The user selects an option from a 5250-based menu. A small amount of extra programming converts the spool file into text, a Web page, a PDF, or another type of output. The output is then emailed to the user who pushed the button.

The question is how we determine the user's email address. For many years, I was in a shop where the user ID was the same as the first part of the email address. The last part was always the same. Determining the email address was as easy as concatenating the user ID to the domain. When I started working for another enterprise, I quickly discovered that not all shops work this way.

The good news is that in order for the user to use the Send Distribution (SNDDST) command to send an email, the user must have a directory entry and an SMTP name. The bad news is that there is no command to retrieve the SMTP name. I started researching Display Directory Entry (DSPDIRE) to an outfile, but no luck. Then, I came across a screen that displayed the SMTP name (Figure 1):

http://www.mcpressonline.com/articles/images/2002/Addressing%20the%20IssueV3--04200700.jpg

Figure 1: This screen displays the SMTP name. (Click image to enlarge.)

Despite i5/OS presenting this screen, there is no DSPNMESMTP command or anything like it. This screen is available only by pressing a function key from a Work with Directory Entry (WRKDIRE) screen.

Yet the user's email address was displayed. It was only a question of doing a little detective work to obtain the source. By pressing the System Request key and selecting option 14 to see what files are being used, the IBM-supplied file QSYS/QATMSMTPA is discovered. It's here that the email address is stored.

A problem remained: The email address was not being stored as an email address. The user portion and the domain portion were stored in separate fields, and the at sign (@) was nowhere to be found. The two small programs that are included with this article provided the finishing touches. RTVEMLRPG retrieves the appropriate data and formats that data into a proper email address. RTVEMLCLP determines the user ID and address in order to return the email address to a calling program.

There is a great deal of flexibility here:

  • I used 36 characters for the email address. You may choose to use more or less.
  • I chose not to create a command. There is no particular reason why this cannot be done.
  • RTVEMLRPG may be turned into a procedure.
  • You can retrieve the email address for any user, not necessarily the user calling the program. 

The results proved to be most satisfactory for those who were relying on the information contained therein. Now, everyone at this shop wants reports delivered by email, and I have more work to do.

David Abramowitz is an independent consultant. His email address can be found a bit easier: This email address is being protected from spambots. You need JavaScript enabled to view it..

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: