29
Fri, Nov
0 New Articles

Broadcast Your Messages

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

Send a message to every active member of a group profile at once.

If you've been on an AS/400 for any length of time, you have probably come to realize that messaging is the lifeblood of the AS/400. You might also have realized that, in certain situations, it's not immediately apparent which message command you should use. The Send Group Profile Message (SNDGRPMSG) command infuses yet another pint of blood into the messaging system of the AS/400 without adding to the confusion; instead, the command bridges a gap which other commands don't address, presenting a very clear choice in some of those ambiguous situations.

Consider how often you would like to send a message to a select group of active users. The commands you typically use might not adequately address this task. The SNDGRPMSG command (see 1) allows you to send the message to just one group or up to 20 groups. The only consideration in using this command is whether or not your users are assigned to meaningful group profiles. How you choose to group your users is, of course, up to you. ("Organizing Users with Group Profiles," MC, April 1993, supplies some relevant hints and strategies.) If the size of your user base does not necessitate the use of group profiles, or if you have simply chosen not to utilize the feature, this command may get dusty before you find a use for it.

Consider how often you would like to send a message to a select group of active users. The commands you typically use might not adequately address this task. The SNDGRPMSG command (see Figure 1) allows you to send the message to just one group or up to 20 groups. The only consideration in using this command is whether or not your users are assigned to meaningful group profiles. How you choose to group your users is, of course, up to you. ("Organizing Users with Group Profiles," MC, April 1993, supplies some relevant hints and strategies.) If the size of your user base does not necessitate the use of group profiles, or if you have simply chosen not to utilize the feature, this command may get dusty before you find a use for it.

If, however, you have grouped your users, you'll find plenty of uses for the SNDGRPMSG command. Maybe you'd like to send a message just to active users in the Payroll department. If you have users across the country, maybe you'd like to send a message only to those active users in Dallas, Texas. It's easy enough if you follow the steps outlined here.

The command provides three parameters:

o MSG-Receives the text for the message. Like all other message commands, SNGGRPMSG allows up to 512 characters. This parameter is required.

o GRPPRF-Receives a maximum of 20 group profile names. This parameter is also required.

o OPTION-Allows you to specify whether to send a break (*BREAK) message or a standard (*STD) message. The default value is *BREAK.

Here's an example of using SNDGRPMSG. We need to shut down interactive subsystem INTER3, which is used by Accounting and Customer Service. Since all users in Accounting belong to group profile GRP_ACG and all Customer Service users are covered by GRP_CSV, we can simply run:

 SNDGRPMSG MSG('System will + go down in 15 minutes.') + GRPPRF(GRP_ACG GRP_CSV) + OPTION(*BREAK) 

How It Works

The command processing program (CPP), GRP003CL (see 2), accepts a message, a list of group profiles to which a message is to be sent and the type of message delivery (*BREAK or *STD). The program's main task is to determine if any of the users who belong to a group profile in the list are signed onto the system. If so, it sends the message to them.

The command processing program (CPP), GRP003CL (see Figure 2), accepts a message, a list of group profiles to which a message is to be sent and the type of message delivery (*BREAK or *STD). The program's main task is to determine if any of the users who belong to a group profile in the list are signed onto the system. If so, it sends the message to them.

It starts by determining how many group profiles are in the list. As you probably know, command parameters defined as lists contain the number of elements in the list in the first two bytes of the parameter. This number is expressed in binary format; therefore, we use the %BIN function to convert it to decimal. (Notice that the %BIN function allows us to do two things at once: isolate the first two bytes of the &GROUPS parameter and convert it to decimal.)

Next, the CPP creates a file containing the active jobs on the system by using the Convert WRKACTJOB to Database File (WRKACTP) command from QUSRTOOL library. (This tool and the physical file that it creates must exist before you can compile GRP003CL, the SNDGRPMSG CPP.)

OPNQRYF is used to read the file in user profile order with the UNIQUEKEY parameter of *ALL. The OPNQRYF access path presents only the first record of a group where the key field (KEYFLD) is equal. When a user is signed onto the system more than once, this technique will prevent a duplicate message from being sent.

A primary loop (LOOP) is set up to read each record of the active jobs file and retrieve the group profile for the job's user. A secondary loop (LOOP2) is entered to process each group profile in the list, comparing it to the group profile of the current job record. If the two are equal, a message is sent to the user profile attached to the job.

One command does it all! You don't have to send the same message dozens of times (once for each user). Also, SNDGRPMSG relieves you from the responsibility of keeping lists of who belongs to the group profiles you have set up. SNDGRPMSG will be a valuable tool in your increasing bag of tricks.

Charley Shanks is a programmer/ analyst at Cummins Diesel ReCon in Memphis, Tennessee.


Broadcast Your Messages

Figure 1 The SNDGRPMSG Command

 /* */ /* To compile: */ /* CRTCMD CMD(xxx/SNDGRPMSG) PGM(xxx/GRP003CL) + */ /* SRCFILE(xxx/QCMDSRC) */ /* */ SNDGRPMSG: CMD PROMPT('Send Group Profile Message') PARM KWD(MSG) TYPE(*CHAR) LEN(150) RSTD(*NO) + MIN(1) KEYPARM(*NO) PROMPT('Message text') PARM KWD(GRP) TYPE(*CHAR) LEN(10) RSTD(*NO) + MIN(1) MAX(10) PROMPT('Group profile') 
Broadcast Your Messages

Figure 2 CL Program GRP003CL

 /* */ /* To compile: */ /* */ /* 1. If the CVTWRKACT command from QUSRTOOL is not already on your */ /* system, create it. */ /* */ /* 2. Execute the CVTWRKACT command interactively: */ /* CVTWRKACT OUTLIB(QTEMP) */ /* */ /* 3. CRTCLPGM PGM(xxx/GRP003CL) SRCFILE(xxx/QCLSRC) */ /* */ SNDGRPMSGC: + PGM PARM(&MSG &GROUPS) DCL VAR(&MSG) TYPE(*CHAR) LEN(150) DCL VAR(&GROUPS) TYPE(*CHAR) LEN(102) DCL VAR(&GRP) TYPE(*CHAR) LEN(10) DCL VAR(&USRGRP) TYPE(*CHAR) LEN(10) DCL VAR(&TYPE) TYPE(*CHAR) LEN(1) DCL VAR(&BIN) TYPE(*CHAR) LEN(2) DCL VAR(&BATCH) TYPE(*LGL) DCL VAR(&ENTRIES) TYPE(*DEC) LEN(5 0) DCL VAR(&START) TYPE(*DEC) LEN(5 0) DCL VAR(&COUNT) TYPE(*DEC) LEN(5 0) DCLF FILE(WRKACTP) CHGVAR VAR(&BIN) VALUE(%SST(&GROUPS 1 2)) CVTBINDEC FROMBIN(&BIN) TODEC(&ENTRIES) IF COND(&ENTRIES *LT 1) THEN(DO) SNDPGMMSG MSG('At least one group profile must be + specified.') MSGTYPE(*COMP) GOTO CMDLBL(END) ENDDO RTVJOBA TYPE(&TYPE) IF COND(&TYPE *EQ '0') THEN(CHGVAR VAR(&BATCH) VALUE('1')) DLTF FILE(QTEMP/WRKACTP) MONMSG MSGID(CPF0000) CVTWRKACT OUTLIB(QTEMP) OVRDBF FILE(WRKACTP) TOFILE(QTEMP/WRKACTP) LOOP: + RCVF MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(END)) IF COND(&AJTYPE *NE 'I') THEN(GOTO CMDLBL(LOOP)) RTVUSRPRF USRPRF(&AJUSR) GRPPRF(&USRGRP) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(LOOP)) CHGVAR VAR(&START) VALUE(3) CHGVAR VAR(&COUNT) VALUE(1) LOOP2: + CHGVAR VAR(&GRP) VALUE(%SST(&GROUPS &START 10)) IF COND(&USRGRP *EQ &GRP) THEN(DO) SNDBRKMSG MSG(&MSG) TOMSGQ(&AJJOB) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(LOOP)) IF COND(&BATCH) THEN(GOTO CMDLBL(LOOP)) SNDPGMMSG MSG('Message sent to msgq' *BCAT &AJJOB *TCAT '. + User ID' *BCAT &AJUSR *TCAT '.') MSGTYPE(*COMP) ENDDO ELSE CMD(DO) IF COND(&COUNT *EQ &ENTRIES) THEN(GOTO CMDLBL(LOOP)) CHGVAR VAR(&START) VALUE(&START + 10) CHGVAR VAR(&COUNT) VALUE(&COUNT + 1) GOTO CMDLBL(LOOP2) ENDDO GOTO CMDLBL(LOOP) END: + DLTF FILE(QTEMP/WRKACTP) MONMSG MSGID(CPF0000) ENDPGM 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • 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.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • 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

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • 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: