fhg
Volume 7, Number 10 -- March 14, 2007

Admin Alert: The Better Way to Send Break Messages to Active Users in i5/OS

Published: March 14, 2007

by Joe Hertvik


Note: This article has associated code, which you can download here.


In a recent column, I described how to create a custom program that selectively sends break messages to signed-on users. After publication, several readers informed me that i5/OS already covers that same ground with standard menu options and APIs. This week, I'll update my earlier solution by reviewing how to accomplish the same goals by using native i5/OS functionality instead of custom programming.

Going for the Goals

In my target scenario, I want to send a message to all signed-on interactive 5250 users, asking them to perform a specific function (i.e., get off the system, exit a program, etc). The requirement to only send to signed on users occurs because some i5/OS functions, such as the Send Break Message command (SNDBRKMSG), will deliver the message to every system workstation message queue even if there is no signed on user accessing that device. Delivering messages to all terminal message queues can cause confusion when users sign on to an unused terminal at a later time and find an old message that is no longer relevant to the system. The goal is to avoid confusion by only sending break messages to currently signed-on users.

The message must also be delivered as an immediate message which each user will receive in break mode (where the message will automatically display on the user's screen, regardless of what the user is doing). This is required so that the user will see the message as soon as it is received. IBM offers the following two ways to accomplish this task in i5/OS.

  • By Menu: The OS/400 Operational Assistance Menu (GO ASSIST) provides a Send Message option to send messages to individual users, to all users enrolled in the system, or to all active users.
  • By API: i5/OS includes the Send Message (QEZSNDMSG) API, which allows you to embed a program call within another program or a command, so that the message can automatically be sent without manual input.

Let's look at each technique and see what it brings to the table.

Ordering Messaging from the Menu

The easiest way to send a message to all active users is to use option 4 from the OS/400 Operational Assistance Menu (Send Message), which can be reached by typing in 'GO ASSIST' from a command line. When you select option 4, you can fill out the Send a Message screen as it appears here to deliver the message to all active users.


Send a Message
                                           
 Type information below, then press F10 to send. 
                                            
   Message needs reply  . . . . . .  N            Y=Yes, N=No 
                                                             
   Interrupt user . . . . . . . . .  Y            Y=Yes, N=No 
                                                             
   Message text . . . . . . . . . .  Type your message here
     
   Send to  . . . . . . . . . . . .  *ALLACT      Name, F4 for list 
                                                                                
F1=Help   F3=Exit   F10=Send   F12=Cancel  

To send a message to your active users only, you would type the message in the Message text field and then enter the '*ALLACT' literal in the Send to field. If you want the message to break on the user's terminal screen, you need to remember to change the Interrupt user field to 'Y' (its default is 'N'). After filling out your parameters, press F10 and the message will be sent out as a break message, and it will only be delivered to the workstation message queues that your active 5250 users are attached to.

You can also use GO ASSIST option 4 to send messages to individual users (by entering each user's name in the Send to list on the screen) or to the System Operator message queue (by entering *SYSOPR as a Send to list entry). There is also an option to require users to reply to a break message before they continue, which can come in handy when you want to ensure that a user will see the message. You can require message replies by entering a 'Y' in the Message needs reply field ('N' is the default). However, you may want to use this feature sparingly to avoid irritating your users when they are working on the system.

An interesting take on using the Send Message function came from reader Mohamed Hussain. Mohamed suggested that when sending break messages to individual users, it might be easier to select the users who will receive your message from the Work with User Jobs command (WRKUSRJOB). You can use WRKUSRJOB to select active users to receive messages by entering the command like this.

WRKUSRJOB USER(*ALL) STATUS(*ACTIVE) JOBTYPE(*INTERACT) ASTLVL(*BASIC)

Running WRKUSRJOB this way provides you with a list of signed-on users for your i5 partition. From this list, you can pick out an individual user or a group of users and enter '3=Send message' in front of each user that you want to send a message to. Once your users are selected, press ENTER and the WRKUSRJOB command will direct you to the Send a Message screen, and it will also fill in the names of all your selected users in the screen's Send to field list. From there you can enter your message and parameters and press the F10 key to send a message specifically to these users. This is a nice way to create a list of users to send messages to without having to type in each user name individually.

Sending Messages from an API

In addition to sending messages interactively from the Send Message function (option 4 on the GO ASSIST menu), IBM also provides an API called QEZSNDMG which allows you to send a message to one or more users and (optionally) allows you to pop up the Send a Message screen from within another program. To illustrate how this works for sending messages to all active users, I wrote the following CL utility called SNDACTMSG, which uses QEZSNDMG to send a message up to 494 characters long to all the active users currently using the system. Here's the program code that makes it happen.

Click here to see the program code.

Calling the program is easy. To send a message that is less than 494 characters long to all the active users on your system, you simply execute this call statement:

CALL SNDACTMSG PARM('Message text')

The SNDACTMSG code is more concise than it looks, because the majority of the coding lies in defining the parameters correctly. Here what each section of code does.

(Line 1) Input parameters: SNDACTMSG allows you to pass in a message to be sent to all active users. The message can be no more than 494 characters, the maximum message length for the QEZSNDMG API.

(Lines 3.00 through 48.00) Defining QEZSNDMG variables: The API requires twelve different parameters to run, and this section defines all program variables. To help you understand what each variable does, comments are included with each declare statement.

(Lines 49.00 through 57.00) Defining work variables: These variables are used to clean-up the incoming text message for transmission.

(Lines 60.00 through 70.00) Cleaning up the incoming message: According to IBM, unpredictable results can occur whenever you pass in character variables that are more than 32 characters long. I5/OS also may neglect to right-fill the incoming 494-character variable with spaces, so this code replaces any null values found in the message text with spaces.

(Line 71.00 through 76.00) Calling the API: This section calls the API using the parameters that I set up in the program. The end result is that QEZSNDMG uses the Send Message function to deliver the incoming message in break mode to all active users.

This program is a much simpler procedure for automatically sending text messages than the home-grown procedure that I created in my earlier article. The advantage to using the APIs over a home-grown solution is that the API solution relies on IBM's own native functions. APIs will usually retain system compatibility after PTFs are applied or after an upgrade is performed. With a home-grown solution, you may have to rewrite code to adjust to changed system parameters. It's also easier to use APIs because (in most cases) IBM has done a lot of the heavy lifting for you; you just fill in the parameters and go.

The other nice thing about SNDACTMSG is that it can be used as a template for creating other programs that use IBM's QEZSNDMG API. To that end, you may want to study up and learn how QEZSNDMSG works by reading about it at IBM's iSeries Information Center QEZSNDMG Web page.

About Our Testing Environment

All configurations described in this article were tested on an i5 box running i5/OS V5R3. However, most of these commands and features are also available on i5/OS V5R4 and most earlier versions of OS/400 V4R5 and below running on AS/400 and iSeries machines.

Special thanks go out to the following readers who sent me information that I used in this article: Carl Pitcher, Chip Cleveland, Krister Karlsson, Mohamed Hussain, Roger Engel, and Walker.


RELATED STORIES

iSeries Information Center QEZSNDMG Web page, Selectively Sending Break Messages to Active Users



                     Post this story to del.icio.us
               Post this story to Digg
    Post this story to Slashdot


Sponsored By
GUILD COMPANIES

Top Titles Available at IT Jungle Bookstore

 

Our most popular titles are available for immediate order
now at the IT Jungle Bookstore.

 

Browse through our top book picks including
the iSeries Pocket and WebSphere series, and
other books by Brian Kelly.

 

Visit the IT Jungle bookstore today!
store.itjstore.com/os400.html


Senior Technical Editor: Ted Holt
Technical Editors: Howard Arner, Joe Hertvik, Shannon O'Donnell, Kevin Vandever
Contributing Technical Editors: Joel Cochran, Wayne O. Evans, Raymond Everhart,
Bruce Guetzkow, Brian Kelly, Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.

Sponsored Links

Guild Companies:  Search OS/400 titles in our bookstore
LXI:  Disk to disk backup with centralized control
COMMON:  Join us at the 2007 conference, April 29 – May 3, in Anaheim, California


IT Jungle Store Top Book Picks

The System i Pocket RPG & RPG IV Guide: List Price, $69.95
The iSeries Pocket Database Guide: List Price, $59.00
The iSeries Pocket Developers' Guide: List Price, $59.00
The iSeries Pocket SQL Guide: List Price, $59.00
The iSeries Pocket Query Guide: List Price, $49.00
The iSeries Pocket WebFacing Primer: List Price, $39.00
Migrating to WebSphere Express for iSeries: List Price, $49.00
iSeries Express Web Implementer's Guide: List Price, $59.00
Getting Started with WebSphere Development Studio for iSeries: List Price, $79.95
Getting Started With WebSphere Development Studio Client for iSeries: List Price, $89.00
Getting Started with WebSphere Express for iSeries: List Price, $49.00
WebFacing Application Design and Development Guide: List Price, $55.00
Can the AS/400 Survive IBM?: List Price, $49.00
The All-Everything Machine: List Price, $29.95
Chip Wars: List Price, $29.95

 

The Four Hundred
IBM's Plan for an Adjacent, Custom Systems Market

WDSc Version 7.0 Standard Edition Is Missing Two Key Features

Is Upgrading a Silly Waste of Time and Money?

As I See It: The Digital Life

The Linux Beacon
Intel Delivers Low-Power, Quad-Core Xeon Chips

HP Touts its Prowess in Linux and Open Source

Server Makers Have $5.3 Billion Bumper Crop in Q4 in Europe

As I See It: The Digital Life

Four Hundred Stuff
SOA, What's The Big Deal?

Asigra Debuts Remote, Agent-Less Backup for iSeries

Lawson Updates ERP, Unveils SaaS Plans at User Conference

Attachmate Moves SOA Strategy Forward with Veratream 6.5

Big Iron
Putting the z in College Degrees

Top Mainframe Stories From Around the Web

Chats, Webinars, Seminars, Shows, and Other Happenings

System i PTF Guide
March 10, 2007: Volume 9, Number 10

March 3, 2007: Volume 9, Number 9

February 24, 2007: Volume 9, Number 8

February 17, 2007: Volume 9, Number 7

February 10, 2007: Volume 9, Number 6

February 3, 2007: Volume 9, Number 5

The Windows Observer
Microsoft Lacks Innovation, Fairness in Pricing of Protocols, EC Says

Symantec Gives Vista Security a So-So Grade

Midrange Boxes, Big Iron Drive Server Growth in Q4 2006

HP Ships Virtual Connect I/O for Blades, Adds Blade Workstation

The Unix Guardian
Midrange Boxes, Big Iron Drive Server Growth in Q4 2006

SCO's Unix Sales Continue to Slide, But Red Ink Is Shallower

HP Unix Behemoth Squeaks By IBM Big Iron on TPC Test

Mad Dog 21/21: Paved With Good Intentions

Four Hundred Monitor
Four Hundred Monitor's
Full iSeries Events Calendar

THIS ISSUE SPONSORED BY:

WorksRight Software
COMMON
Guild Companies



TABLE OF CONTENTS
Release That Record Lock!

Giving RSE a Split Personality

Admin Alert: The Better Way to Send Break Messages to Active Users in i5/OS

Four Hundred Guru

BACK ISSUES

From the IT Jungle Forums
How to collect the object authorities in a PF

Printer override in CLP using QCMDEXC

How to install a network printer in the iSeries?

Referencing the key of current record

MCH5003 creating objects in library





 
Subscription Information:
You can unsubscribe, change your email address, or sign up for any of IT Jungle's free e-newsletters through our Web site at http://www.itjungle.com/sub/subscribe.html.

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, Inc., 50 Park Terrace East, Suite 8F, New York, NY 10034

Privacy Statement