AS/400 Programming Tips, Tricks, & Techniques

Apr 17 2013   6:54PM GMT

Resolving a Common Issue: CPD90B1 – Distribution Limit of 9999 Reached

Eric Witham Eric Witham Profile: Eric Witham

Greetings Readers.

This being my first post, please allow me to introduce myself. My name is Eric and I am currently a Administrator/Senior Programmer for H&M International Transportation, Inc. in Central NJ. Although I have only been working here for 3 months now, I have been in the AS/400 World for about 15 years now. I started doing Programming at 19 and have loved the work ever since.

I wanted to address an issue that I have seen pop-up throughout my career. However, this is the first time I’ve seen an actual resolution that worked.

The Error Message received to our *SYSOPR is as follows:

Message ID

Distribution limit of 9999 reached.

The sender has sent 9999 distributions. These distributions still exist on the system.

Either delete any incoming distributions that you sent to yourself or any outgoing distributions that you sent with confirmation of delivery

In a lot of our programs we use the SNDDST command to send emails and reports to users all over the county. As it turns out, my company has had a problem with this issue for years. The only resolution they could find that worked (for them) was to create duplicate User Profiles and use that when doing the SNDDST command.

I know what you’re thinking, “That’s Absurd!” Well, you’re right. It is absurd. When I found this out, I was determined to find a resolution which would not only help the company, but also give me some points in the new job.

I contacted IBM and informed them of the issue and the resolution my predecessors took in order to “fix” the problem. They laughed, which is fine, because I did too.

Apparently this is a pretty common issue and they even wrote a Technical Document for it. The document contains 4 programs that clean up the mail on the system. The only thing is, they left out a big part of what needs to be done before implementing what was in the Technical Document.

Here is what you need to do:

  1. Navigate to the Work with Directory Entries screen – WRKDIRE
  2. Take Option 2 to make changes to the User Profile in the list.
  3. Page-Down 4 times until you get to the screen with the Mail Service Level entry.
  4. Change the value for Mail Service Level to 2 for System Message Store
  5. Change the value for Preferred Address to 3 for SMTP Name
  6. Submit the Job to call the Control Program CLEANMAILC  (Code is Below)

The reason we change the Mail Service Level to System Message Store is so that the mail can be stored in the System Supported Message store. This can be accessed by using the industry standard mail API’s on the client.

The reason we change the Preferred Address to SMTP is so that when a SNDDST command is executed, the mail doesn’t somehow get stuck in the IBM Limbo.

So let’s say you’re running a process that sends a report to 10 users in your community. What if one or two of those users no longer works for the company anymore?  That User ID or Email Address was most likely deactivated or removed from the system. Well if the report is being sent to that deactivated address and SMTP Name isn’t specified, the user requesting the report will NEVER know. However, if specified, the requesting user will receive an email saying that it was Undeliverable to that specific address or addresses.

Once all Users are changed in the Work with Directory Entries screen, you can submit the below calling program which in turn will submit 3 other programs and by the end of it, all distributions will be cleared.
Here is what the procedure contains:

Type:            CLLE
Text:             Process Mail: Inbound/Outbound/In-Error
Role:              Control Program

Member:    MAILINC
Type:            CLLE
Text:             Process Inbound Mail 

Member:    MAILOUTC
Type:            CLLE
Text:             Process Outbound Mail

Member:    MAILERRC
Type:            CLLE
Text:             Process Mail in Error

Here’s the IBM Technical Document
Finally, here is my code. I realize it may not fit on the entire screen. But if you give it a click, it should open in a new window which will allow you to save it and check it out in Paint or Word or whatever other program works for you best.

Syntax for Control Program CLEANMAILC

Syntax for Control Program CLEANMAILC

Syntax for Control Program MAILINC

Syntax for Control Program MAILINC

Syntax for Control Program MAILOUTC

Syntax for Control Program MAILOUTC

Syntax for Control Program MAILERRC

Syntax for Control Program MAILERRC

Thank you for taking the time to read this article. Please be on the lookout for more articles from me.

If anyone has any topic suggestions, or wants some assistance with an issue they have, please don’t hesitate to email me at

Have a Great Day.


2  Comments on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.
  • pat400
    Thank you, Eric, for a well-written and informative article.
    75 pointsBadges:
  • rick57
    Could not agree more with pat400 - Excellent!
    0 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: