• 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 Technologies, Inc.

    Get More from Your IBM i

    Many users today struggle to get at the data they need on the IBM i. When users get reports, they look like they were formatted some time last century.

    Some organizations are still printing pre-printed forms and checks on impact printers.

    How often do operators log on to their system to look for messages they hope they don’t find?

    All of these scenarios can affect users’ perception of the IBM platform negatively, but there are simple solutions.

    DRV Technologies Inc. develops innovative solutions that help customers get more from their IBM i systems.

    Solutions include:

    • SpoolFlex spool conversion & distribution
    • FormFlex electronic forms
    • SecureChex MICR laser check printing
    • MessageFlex system monitoring

    FlexTools streamline resources, improve efficiency and enable pro-active system management.

    Better software, better service, DRV Tech.

    Learn how you can get more from your IBM i at www.drvtech.com

    Call 866 378-3366 for a Free Demonstration

    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

  • IBM Tweaks Some Power Systems Prices Down, Others Up
  • Disaster Recovery: From OS/400 V5R3 To IBM i 7.4 In 36 Hours
  • The Disconnect In Modernization Planning And Execution
  • Superior Support: One Of The Reasons You Pay The Power Systems Premium
  • IBM i PTF Guide, Volume 25, Number 13
  • IBM i Has a Future ‘If Kept Up To Date,’ IDC Says
  • When You Need Us, We Are Ready To Do Grunt Work
  • Generative AI: Coming to an ERP Near You
  • Four Hundred Monitor, March 22
  • IBM i PTF Guide, Volume 25, Number 12

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 © 2023 IT Jungle