• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • A Better Way to Display Quick 5250 Messages in RPG

    September 21, 2011 Hey, Mike

    Note: The code accompanying this article is available for download here.

    Here are a couple of code snippets containing a call to the QUILNGTX API that does a much better job than the DSPLY opcode. This API has been around for a long time (before/free), and we wrapped it into a service program procedure to make it easier to use.

    As you can see from the included code sample, it only takes a character work variable to contain the text to display, and a call to the ShowText subprocedure to display a message. It shows a pop-up box with text wrapping that is displayed on screen. There are no input capable fields, and no control over window positioning; but for a quick and dirty display to the user it works fairly well.

    We are not using the full functionality of this API, as you could also integrate message files into the popup, but due to the positioning limitations we only use it for temporary or debugging messages.

    Finally, there is no error handling in this procedure, but using the fields in the ERRCODE data structure you could implement some if you wished.

    –Dave

    Dave, well knock me down and call me “shorty.” The QUILNGTX API has been around since V3R6, and I hadn’t heard of it or used it. When wrapped in an easily accessible subprocedure like the one you provided, it sure does beat using the DSPLY opcode. (I must admit, over the years I’ve left a DSPLY or two in production RPG programs when project deadlines were looming.)

    I took Dave’s code, modified it using /FREE form syntax, and created a small sample program. You can download it here. The revised subprocedure accepts three parameters:

    1. Message text to display to the user. This is a varying-length field, so make sure you use %TRIMR if the source of the message is a fixed-length field.
    2. Message ID. Optional.
    3. Qualified Message File Optional. When the message ID and message file are passed, the message text from the specified message ID is placed by the API in the window’s title line. I would have preferred IBM just let the user specify a title as a separate parameter. If a title isn’t required (or you don’t want to bother defining a title in a message file), then these last two parameters can just be left blank.

    Shown below is a picture of the output window for 80 column output. The Window position (row 5 col 2), height (12 lines total) and exit key (F12) are fixed.

    Here is the RPG code that invoked the procedure:

    /Free
        ShowText('This is an API test.  The amount of text that can +
        be displayed is nothing short of incredible.  The quick +
        brown fox jumped over the lazy dog.  With an API like this +
        available, we shouldn''t need to use the DSPLY opcode any +
        longer.  It reduces the need for coding DDS WINDOW formats +
        and will make life a bed of roses.  It even does an +
        automatic word wrap.  What will they think of next?  123456+
        789012345678901234567890123456789012345678901234597890':
        'SQL0101':'QSQLMSG');
        *InLR=*On;
    /End-Free
    

    Just to demonstrate the title feature, I passed message ID SQL0101 (SQL Statement too long or complex) from message file QSQLMSG. If a title isn’t required, just leave these two parameters blank.

    As Dave points out, when showing quick and dirty messages to the user or when debugging, this is a great way to show a classy message without any extra DDS hassle. Further, it doesn’t suffer the 52-character message limitation imposed by DSPLY. However, the one thing that the DSPLY opcode can still do is retrieve a response from the user.

    –Mike

    Michael Sansoterra is a DBA for Broadway Systems in Grand Rapids, Michigan. Send your questions or comments for Mike via the IT Jungle Contact page.



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

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    DRV Tech

    Get More Out of Your IBM i

    With soaring costs, operational data is more critical than ever. IBM shops need faster, easier ways to distribute IBM applications-based data to users more efficiently, no matter where they are.

    The Problem:

    For Users, IBM Data Can Be Difficult to Get To

    IBM Applications generate reports as spooled files, originally designed to be printed. Often those reports are packed together with so much data it makes them difficult to read. Add to that hardcopy is a pain to distribute. User-friendly formats like Excel and PDF are better, offering sorting, searching, and easy portability but getting IBM reports into these formats can be tricky without the right tools.

    The Solution:

    IBM i Reports can easily be converted to easy to read and share formats like Excel and PDF and Delivered by Email

    Converting IBM i, iSeries, and AS400 reports into Excel and PDF is now a lot easier with SpoolFlex software by DRV Tech.  If you or your users are still doing this manually, think how much time is wasted dragging and reformatting to make a report readable. How much time would be saved if they were automatically formatted correctly and delivered to one or multiple recipients.

    SpoolFlex converts spooled files to Excel and PDF, automatically emailing them, and saving copies to network shared folders. SpoolFlex converts complex reports to Excel, removing unwanted headers, splitting large reports out for individual recipients, and delivering to users whether they are at the office or working from home.

    Watch our 2-minute video and see DRV’s powerful SpoolFlex software can solve your file conversion challenges.

    Watch Video

    DRV Tech

    www.drvtech.com

    866.378.3366

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    System i Developer:  Join the Gurus at the RPG & DB2 Summit in St. Louis, October 17-19
    Computer Keyes:  Rapidly convert standard *SCS printer files into PDFs with KeyesOverlay
    looksoftware:  Access your IBM i applications from anywhere! View the on-demand webinar now!

    IT Jungle Store Top Book Picks

    BACK IN STOCK: Easy Steps to Internet Programming for System i: List Price, $49.95

    The iSeries Express Web Implementer's Guide: List Price, $49.95
    The iSeries Pocket Database Guide: List Price, $59
    The iSeries Pocket SQL Guide: List Price, $59
    The iSeries Pocket WebFacing Primer: List Price, $39
    Migrating to WebSphere Express for iSeries: List Price, $49
    Getting Started with WebSphere Express for iSeries: List Price, $49
    The All-Everything Operating System: List Price, $35
    The Best Joomla! Tutorial Ever!: List Price, $19.95

    Contractors Used by 70 Percent of IT Businesses, Survey Says Start Planning For New Systems Now

    One thought on “A Better Way to Display Quick 5250 Messages in RPG”

    • Kathan Pandya says:
      July 22, 2020 at 3:21 pm

      Is there a way to do the same and get the user response back?

      Reply

    Leave a Reply Cancel reply

Volume 11, Number 27 -- September 21, 2011
THIS ISSUE SPONSORED BY:

WorksRight Software
Bytware
Twin Data Corporation

Table of Contents

  • Call-backs Simplify File IO
  • A Better Way to Display Quick 5250 Messages in RPG
  • Running Down Cache Battery Rumors and More on Damaged Objects

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • Meet The Next Gen Of IBMers Helping To Build IBM i
  • Looks Like IBM Is Building A Linux-Like PASE For IBM i After All
  • Will Independent IBM i Clouds Survive PowerVS?
  • Now, IBM Is Jacking Up Hardware Maintenance Prices
  • IBM i PTF Guide, Volume 27, Number 24
  • Big Blue Raises IBM i License Transfer Fees, Other Prices
  • Keep The IBM i Youth Movement Going With More Training, Better Tools
  • Remain Begins Migrating DevOps Tools To VS Code
  • IBM Readies LTO-10 Tape Drives And Libraries
  • IBM i PTF Guide, Volume 27, Number 23

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle