• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Adding New Parameters to RPG Programs

    July 21, 2004 Hey, Ted

    We have an RPG IV program that accepts one parameter. We need to add two more parameters. Our problem is that this program is called from several menus and many programs. Unless you have some trick up your sleeve, adding the new parameters will involve a lot of work outside of regular hours. Can you help?

    –Bo

    This is not a difficult situation to handle, Bo. There’s no trick to it, and this is a fundamental technique that everybody should know.

    As long as you do not reference a parameter that is not passed to the program, the RPG program will not cancel. You can use RPG IV’s %PARMS built-in function to determine how many parameters are passed to the program on the CALL command.

    Add the parameters the end of the parameter list. In this example, I call them PARM2 and PARM3. You’ll use more descriptive names, of course.

    C     *entry        plist                                        
    C                   parm                    parm1             5  
    C                   parm                    parm2             3 0
    C                   parm                    parm3            10
    

    Define two variables as you’ve defined the new parameters. I’ll call them WORK2 and WORK3.

    D work2           s                   like(parm2) 
    D work3           s                   like(parm3) 
    

    Use the %PARMS function to determine whether each parameter was passed. If a parameter was passed into the program, load its value into the corresponding work variable. If a parameter was not passed into the program, assign a default value to the work variable.

    Use the work variables, not the parameters, throughout the program.



    Using this technique lets you leave existing calls as they are, as long as the default values for the new parameters are acceptable. You will only need to modify the calls that need to pass other parameter values.

    You’re fortunate that the program you must change was written in RPG and not CL. When you call a CL program, you must pass exactly the number of expected parameters. You can work around this problem to an extent by creating commands to run CL programs, but that is a topic for some other day.

    –Ted

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    WorksRight Software

    Do you need area code information?
    Do you need ZIP Code information?
    Do you need ZIP+4 information?
    Do you need city name information?
    Do you need county information?
    Do you need a nearest dealer locator system?

    We can HELP! We have affordable AS/400 software and data to do all of the above. Whether you need a simple city name retrieval system or a sophisticated CASS postal coding system, we have it for you!

    The ZIP/CITY system is based on 5-digit ZIP Codes. You can retrieve city names, state names, county names, area codes, time zones, latitude, longitude, and more just by knowing the ZIP Code. We supply information on all the latest area code changes. A nearest dealer locator function is also included. ZIP/CITY includes software, data, monthly updates, and unlimited support. The cost is $495 per year.

    PER/ZIP4 is a sophisticated CASS certified postal coding system for assigning ZIP Codes, ZIP+4, carrier route, and delivery point codes. PER/ZIP4 also provides county names and FIPS codes. PER/ZIP4 can be used interactively, in batch, and with callable programs. PER/ZIP4 includes software, data, monthly updates, and unlimited support. The cost is $3,900 for the first year, and $1,950 for renewal.

    Just call us and we’ll arrange for 30 days FREE use of either ZIP/CITY or PER/ZIP4.

    WorksRight Software, Inc.
    Phone: 601-856-8337
    Fax: 601-856-9432
    Email: software@worksright.com
    Website: www.worksright.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Dieselpoint Search Engine Optimized for OS/400 IBM Rejiggers eServer i5 Pricing

    Leave a Reply Cancel reply

Volume 4, Number 24 -- July 21, 2004
THIS ISSUE
SPONSORED BY:

Advanced Systems Concepts
T.L. Ashford
Guild Companies

Table of Contents

  • Encapsulating File Access in a Service Program
  • Adding New Parameters to RPG Programs
  • Admin Alert: Four Cool Things You Can Do with PC5250

Content archive

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

Recent Posts

  • To Comfort The Afflicted And Afflict The Comfortable
  • How FalconStor Is Reinventing Itself, And Why IBM Noticed
  • Guru: When Procedure Driven RPG Really Works
  • Vendors Fill In The Gaps With IBM’s New MFA Solution
  • IBM i PTF Guide, Volume 27, Number 27
  • With Power11, Power Systems “Go To Eleven”
  • With Subscription Price, IBM i P20 And P30 Tiers Get Bigger Bundles
  • Izzi Buys CNX, Eyes Valence Port To System Z
  • IBM i Shops “Attacking” Security Concerns, Study Shows
  • IBM i PTF Guide, Volume 27, Number 26

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