TechTip: Addressing the Issue PDF Print E-mail
Written by David Abramowitz   
Thursday, 19 April 2007

Having trouble determining a user's email address for SNDDST? Read on.

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 e-mail address is being protected from spam bots, you need JavaScript enabled to view it .


Last Updated ( Thursday, 19 April 2007 )
 
Discuss (7 posts)
David Abramowitz
TechTip: Addressing the Issue
Apr 25 2007 15:45:00
Many Thanks, <p>Dave
#115483

V.Mack
TechTip: Addressing the Issue
Apr 24 2007 09:37:00
My apologies about the missing links to the code. I've made the correction in the article. <p>Victoria Mack, Executive Editor
#115482
David Abramowitz
TechTip: Addressing the Issue
Apr 24 2007 08:56:00
I have informed Victoria, that the code was not posted. <p>Hopefully it will soon appear. <p>Dave
#115481
David Abramowitz
TechTip: Addressing the Issue
Apr 23 2007 09:27:00
The comments here are a great example of the dissemination of ideas, concepts and techniques. I thank everyone for their input. <p>I did receive a request for the code. It was supposed to have been posted. Hopefully Victoria will read this and point everyone in the right direction. <p>Dave
#115480
Guest.Visitor
TechTip: Addressing the Issue
Apr 20 2007 13:02:00
I appreciated the way you explained your thought process at each step. It shows what can be achieved with persistence. Good article! <p>Alan
#115479
DaleB63
TechTip: Addressing the Issue
Apr 20 2007 10:37:00
You don't need to know the SMTP name to use it. SNDDST is perfectly happy with TOUSRID((johndoe mysys)). You must have a directory entry with: 1) an SMTP name, 2) mail service level is 2 (system message store), and 3) preferred address is 3 (SMTP name). <p>So, you can use DSPDIRE to an output file. The only problem I've run into, is that it's possible for a user profile to have more than one directory entry. Try this on for size: <p><!--mccodelink_begin--> <BR>
<!-- do not remove --> <BR>
<hr width=50 align=left><small><a href='http://www.mcpressonline.com/mc/showcode@@.6b4f3310/0' target='_blank'>Code</a></small> <BR>
<!--mccodelink_end-->
#115478
MC Press Web Site Staff
TechTip: Addressing the Issue
Apr 25 2007 15:45:00
This is a discussion about <B>TechTip: Addressing the Issue</b>.<p align='center'><a href=http://www.mcpressonline.com/mc?1@232.1KNKfHX1eQT.17@.6b4f1b0d>Click here for the article</a>.</p>
#115477


Discuss...
User Rating: / 0
PoorBest 
Related Articles
Next >

The following White Papers can be found at the MC White Paper Center


The following trial software can be found at the MC Press Software Center.   



   MC-STORE.COM