23
Mon, Dec
1 New Articles

Telegram/400

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

Need to send a memo? You don't have to leave your terminal!

Everyone I've talked to likes the ability to send messages to another user. This feature has been in existence so long on midrange computers that it is hard to imagine not having it. As far as I know, all message commands and all message-producing user utilities send the message to the screen. Why not? That is where people are most likely to become aware of the message.

This article presents an alternative: sending the message to a printer. The message is not displayed anywhere, but printed on the device you designate. This has some immediate uses:

You can send a message to the operator of the system printer, alerting him that the Profit and Loss report is to be delivered immediately to the CFO instead of placing it outside of the computer room, as usual.

If you need to send a message to someone who has a PC and an attached PC printer, you can send a message to that person through the printer. This would work even if the recipient was momentarily switched out of PC Support and working on a PC spreadsheet program.

No more typing up a memo and faxing it to another office. If the other office has a printer device that is configured on your AS/400, you can send the memo using a printed message.

The SNDPRTMSG Command

The Send a Printed Message (SNDPRTMSG) command has four para-meters: RECEIVER, SUBJECT, PRTDEV and COPY.

The name of the person who is to receive the printed message goes in the RECEIVER parameter. You can enter up to 30 characters and the text does not have to match a user profile. This allows you to specify the person's name on the RECEIVER parameter instead of the user profile. In the SUBJECT parameter, type a brief description of the message. SUBJECT accepts a maximum of 50 characters.

The PRTDEV parameter receives the name of the printer device (as configured on the AS/400) where you want to send your message. For instance, if the printer in the Marketing office is named PRT03, that's the name you need to key in to send a message there. PRTDEV also accepts *SYSVAL (to send the message to the system printer) or *JOB (which causes the message to be printed on your job's default printer).

Finally, the COPY parameter indicates whether to print a copy of the message for your own records. The default is *NONE (no copy), but you can enter a printer device name, *SYSVAL or *JOB-the meanings are the same as in the PRTDEV parameter.

The Message

Once the preliminaries are dispensed with, the system presents a data entry subfile where you can enter up to 100 lines of text. Each line has a maximum length of 77 characters. Since each subfile page holds 20 lines, the message can span up to five screenfuls of text. Simply type in your message (rolling if you have to, to keep entering more text) and press Enter. The message (and optional copy) are printed immediately.

The Clockwork Inside

The source code for the SNDPRTMSG utility is in1 to 5. It consists of a command (1), a CL program (2), a display file (3), two printer files (4) and an RPG program (5).

The source code for the SNDPRTMSG utility is in Figures 1 to 5. It consists of a command (Figure 1), a CL program (Figure 2), a display file (Figure 3), two printer files (Figure 4) and an RPG program (Figure 5).

The SNDPRTMSG utility uses a data entry subfile to accept the message text. There's nothing mysterious about this subfile-I've made it as simple as it can get. Notice, however, that the utility can use one or two printer files, depending on whether you have requested a copy for your own records. If you do, external switch number 2 turns on. This switch is used in the RPG program to determine whether to open, write to and close the second printer file, PRT001P2.

Both printer files share the same record format names and field names so I've provided only one version of the source code. The compile instructions direct you to create both printer files from the source in 4. Since the field names present no problem (after all, we would be printing the same message via both printer files), we don't worry about renaming them within the RPG program. The record format names, on the other hand, need to be renamed or the program will not compile.

Both printer files share the same record format names and field names so I've provided only one version of the source code. The compile instructions direct you to create both printer files from the source in Figure 4. Since the field names present no problem (after all, we would be printing the same message via both printer files), we don't worry about renaming them within the RPG program. The record format names, on the other hand, need to be renamed or the program will not compile.

The rest of the RPG program is pretty self-evident and requires no additional explanation. When you stop to think about it, SNDPRTMSG is a short and uncomplicated utility that shows off the sophistication of the operating system. And it's a useful utility, to boot. I have used it myself many times in the past few years, and I'm sure that you'll put it to good use in your organization.

Ernie Malaga has been working with and writing about midrange computers for 10 years.


Telegram/400

Figure 1 Command SNDPRTMSG

 /*===================================================================*/ /* To compile: */ /* */ /* CRTCMD CMD(XXX/SNDPRTMSG) PGM(XXX/PRT001CL) + */ /* SRCFILE(XXX/QCMDSRC) ALLOW(*INTERACT + */ /* *IPGM *IREXX) */ /* */ /*===================================================================*/ SNDPRTMSG: CMD PROMPT('Send a Printed Message') PARM KWD(RECEIVER) TYPE(*CHAR) LEN(30) MIN(1) + EXPR(*YES) PROMPT('Name of receiver') PARM KWD(SUBJECT) TYPE(*CHAR) LEN(50) MIN(1) + EXPR(*YES) PROMPT('Subject') PARM KWD(PRTDEV) TYPE(*NAME) LEN(10) DFT(*SYSVAL) + SPCVAL((*SYSVAL) (*JOB)) EXPR(*YES) + PROMPT('Destination printer') PARM KWD(COPY) TYPE(*NAME) LEN(10) DFT(*NONE) + SPCVAL((*NONE) (*JOB) (*SYSVAL)) + EXPR(*YES) PROMPT('Printer for your copy') 
Telegram/400

Figure 2 CL Program PRT001CL

 /*===================================================================*/ /* To compile: */ /* */ /* CRTCLPGM PGM(XXX/PRT001CL) SRCFILE(XXX/QCLSRC) */ /* */ /*===================================================================*/ PRT001CL: + PGM PARM(&RECEIVER &SUBJECT &PRTDEV ©) DCL VAR(&RECEIVER) TYPE(*CHAR) LEN(30) DCL VAR(&SUBJECT) TYPE(*CHAR) LEN(50) DCL VAR(&PRTDEV) TYPE(*CHAR) LEN(10) DCL VAR(©) TYPE(*CHAR) LEN(10) DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(132) DCL VAR(&MSGF) TYPE(*CHAR) LEN(10) DCL VAR(&MSGLIB) TYPE(*CHAR) LEN(10) DCL VAR(&MSGID) TYPE(*CHAR) LEN(7) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERROR)) CHGJOB SWS(X0XXXXXX) OVRPRTF FILE(PRT001P1) DEV(&PRTDEV) OUTQ(*DEV) USRDTA(SNDPRTMSG) IF COND(© *NE '*NONE') THEN(DO) CHGJOB SWS(X1XXXXXX) OVRPRTF FILE(PRT001P2) DEV(©) OUTQ(*DEV) + USRDTA(SNDPRTMSG) ENDDO CALL PGM(PRT001RG) PARM(&RECEIVER &SUBJECT) RETURN ERROR: + RCVMSG MSGTYPE(*EXCP) MSGDTA(&MSGDTA) MSGID(&MSGID) MSGF(&MSGF) + MSGFLIB(&MSGFLIB) SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) MSGDTA(&MSGDTA) + MSGTYPE(*ESCAPE) ENDPGM 
Telegram/400

Figure 3 Display File PRT001DF

 *==============================================================* * To compile: * * * * CRTDSPF FILE(XXX/PRT001DF) SRCFILE(XXX QDDSSRC) * * * *==============================================================* A DSPSIZ(24 80 *DS3) A PRINT A CA03(03 'Exit') A CA12(12 'Cancel') * A R MSGRCD SFL A LINE 77A B 3 2CHECK(LC) * A R MSGCTL SFLCTL(MSGRCD) A SFLSIZ(0100) A SFLPAG(0020) A BLINK A OVERLAY A 80 SFLDSP A 80 SFLDSPCTL A N80 SFLINZ A N81 SFLEND(*MORE) A 1 30'Send a Printed Message' A DSPATR(HI) * A R FKEYS A 24 2'F3=Exit F12=Cancel E- A nter=Send Message' A COLOR(BLU) 
Telegram/400

Figure 5 RPG Program PRT001RG

 *================================================================ * * To compile: * * CRTRPGPGM PGM(XXX/PRT001RG) SRCFILE(XXX/QRPGSRC) * *================================================================ FPRT001DFCF E WORKSTN F RRN KSFILE MSGRCD FPRT001P1O E 91 PRINTER F HEADER KRENAMEHDR1 F DETAIL KRENAMEDTL1 FPRT001P2O E 92 PRINTER U2 F HEADER KRENAMEHDR2 F DETAIL KRENAMEDTL2 * I SDS I 254 263 MYSELF * C *ENTRY PLIST C PARM RCVR C PARM SUBJ * C MOVE *OFF *IN80 C WRITEMSGCTL C WRITEFKEYS C MOVE *ON *IN80 C EXFMTMSGCTL C *IN03 IFEQ *OFF C *IN12 ANDEQ*OFF C EXSR PRTMSG C ENDIF C MOVE *ON *INLR * C PRTMSG BEGSR C Z-ADD100 R 30 C DO 100 C R CHAINMSGRCD 99 C LINE IFNE *BLANKS C LEAVE C ENDIF C SUB 1 R C ENDDO C MOVE *ALL'-' DASHES C WRITEHDR1 C U2 WRITEHDR2 C 1 DO R RRN 40 C RRN CHAINMSGRCD 99 C *IN99 IFEQ *OFF C *IN91 IFEQ *ON C WRITEHDR1 C U2 WRITEHDR2 C MOVE *OFF *IN91 C U2 MOVE *OFF *IN92 C ENDIF C WRITEDTL1 C U2 WRITEDTL2 C ENDIF C ENDDO C ENDSR 
Telegram/400

Figure 4a Printer Files PRT001P1

 *==============================================================* * To compile: * * * * CRTPRTF FILE(XXX/PRT001P1) SRCFILE(XXX/QDDSSRC) * * * *==============================================================* A R HEADER SKIPB(1) A 33'PRINTED MESSAGE' UNDERLINE A SPACEA(2) A 1'From:' A MYSELF 10A 10 A 65'Date:' A 71DATE EDTCDE(Y) SPACEA(1) A 1'To:' A RCVR 30A 10 A 65'Time:' A 71TIME SPACEA(1) A 1'Subject:' A SUBJ 50A 10 A 65'Page:' A 71PAGNBR EDTCDE(3) SPACEA(1) A DASHES 80A 1SPACEA(1) * A R DETAIL SPACEA(1) A LINE 77A 1 
Telegram/400

Figure 4b Printer Files PRT001P2

 *==============================================================* * To compile: * * * * CRTPRTF FILE(XXX/PRT001P2) SRCFILE(XXX/QDDSSRC) * * * *==============================================================* A R HEADER SKIPB(1) A 33'PRINTED MESSAGE' UNDERLINE A SPACEA(2) A 1'From:' A MYSELF 10A 10 A 65'Date:' A 71DATE EDTCDE(Y) SPACEA(1) A 1'To:' A RCVR 30A 10 A 65'Time:' A 71TIME SPACEA(1) A 1'Subject:' A SUBJ 50A 10 A 65'Page:' A 71PAGNBR EDTCDE(3) SPACEA(1) A DASHES 80A 1SPACEA(1) * A R DETAIL SPACEA(1) A LINE 77A 1 
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: