• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Omitting Parameters in RPG Programs and Modules

    November 8, 2002 Timothy Prickett Morgan

    Hey, Ted:

    I have a program that can receive four parameters. The first one is mandatory, and the last three are optional. If I call the program and pass parameters 1, 2, and 4 to it, the %parms built-in function tells me that three parameters were passed. How does the program know which three it is getting? Thanks!

    — Doug

    You can’t skip a parameter. If you pass three parameters, they are parameters 1, 2, and 3; number 4 will be undefined.

    The only way to skip parameter 3 is to specify OPTIONS(*OMIT) in its D spec. The value *OMIT allows you to pass the special value *OMIT as a parameter value. OPTIONS(*OMIT) is only allowed with parameters that are passed by reference. That includes parameters with the CONST keyword, which are passed by read-only reference.

    You can use the *OMIT value along with *NOPASS, but to keep it simple; I do not include *NOPASS in the following example.

    Here is the RPG source code for RPG module OMITPARMEE (Omit Parameter Callee):

    D calledproc      pr                  extproc('OMITPARMEE') 
    D   p1                          10a   const                 
    D   p2                          12a   const                 
    D   p3                           6a   const options(*omit)  
    D   p4                           2a   const                 
                                                                
    D calledproc      pi                                        
    D   p1                          10a   const                 
    D   p2                          12a   const                 
    D   p3                           6a   const options(*omit)  
    D   p4                           2a   const                 
                                                                
    D somevalue       s              6                          
                                                                
    C                   if        %addr(p3) = *null             
    C                   eval      somevalue = *all'*'           
    C                   else                                    
    C                   eval      somevalue = p3                
    C                   endif  
    C                   return
    

    Notice that the third parameter has the OPTIONS(*OMIT) keyword. If the caller passes the special value *OMIT, the address of the parameter will be null. For that reason, the module checks for a null address and does not use the value of the third parameter if the address is null.

    Here is module OMITPARMER (Omit Parameter Caller):

    D calledproc      pr                  extproc('OMITPARMEE') 
    D   p1                          10a   const                 
    D   p2                          12a   const                 
    D   p3                           6a   const options(*omit)  
    D   p4                           2a   const                 
                                                                
     /free                                                      
         callp calledproc ('ABC': 'DEFG': 'HIJKLM': 'NO');      
         callp calledproc ('ABC': 'DEFG': *OMIT   : 'NO');      
         *inlr = *on;                                           
     /end-free                                                  
    

    Notice the *OMIT value in the second CALLP.

    — Ted

    Sponsored By
    inFORM DECISIONS

    ELIMINATE THE COSTS OF PRE-PRINTED FORMS, LABOR AND POSTAGE WITH
    inFORM Decisions iDocs™ ‘Suite’

    iSeries based e-Forms, e-Checks, e-Mail, e-FAX, and Document Retrieval from the Web are available as individual modules or as a complete e-Document processing ‘Suite’.

    Click to Download the Complete Suite or Individual Modules today
    www.inFORMDecisions.com

    or call (800) 858-5544

    Share this:

    • Share on Reddit (Opens in new window) Reddit
    • Share on Facebook (Opens in new window) Facebook
    • Share on LinkedIn (Opens in new window) LinkedIn
    • Share on X (Opens in new window) X
    • Email a link to a friend (Opens in new window) Email

    Tags: Tags: mgo_rc, Volume 2, Number 86 -- November 8, 2002

    Sponsored by
    FalconStor

    Simplify Secure Offsite Data Protection for IBM Power with FalconStor Habanero™

    IBM i teams are under growing pressure to ensure data is protected, recoverable, and compliant—without adding complexity or disrupting stable environments.

    FalconStor Habanero™ provides secure, fully managed offsite data protection purpose-built for IBM Power. It integrates directly with existing IBM i backup tools and processes, enabling reliable offsite copies without new infrastructure, workflow changes, or added operational overhead.

    By delivering and managing the service end-to-end, FalconStor helps organizations strengthen cyber resilience, improve disaster recovery readiness, and meet compliance requirements with confidence. Offsite copies are securely maintained and available when needed, supporting recovery, audits, and business continuity.

    FalconStor Habanero offers a straightforward way to modernize offsite data protection for IBM i: focused on simplicity, reliability, and resilience.

    Learn More

    Share this:

    • Share on Reddit (Opens in new window) Reddit
    • Share on Facebook (Opens in new window) Facebook
    • Share on LinkedIn (Opens in new window) LinkedIn
    • Share on X (Opens in new window) X
    • Email a link to a friend (Opens in new window) Email

    Odds and Ends Reader Feedback and Insights: Modernizing RPG II Programs

    Leave a ReplyCancel reply

MGO Volume: 2 Issue: 86

This Issue Sponsored By

    Table of Contents

    • Reader Feedback and Insights: Overlooking the Obvious
    • Odds and Ends
    • Omitting Parameters in RPG Programs and Modules

    Content archive

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

    Recent Posts

    • Critical PHP2Shell Security Vulns Evoke ‘Black October’
    • Why Fortra Partnered with FalconStor to Launch Continuity Care: A Validated Recovery Service for IBM i
    • Guru: Analyzing User Session Statistics, Part 2
    • Fresche Launches OpsIQ, a Free AI-Based Operation Assistant for IBM i
    • IBM i PTF Guide, Volume 28, Number 37
    • Fall TRs Expected Next Week At Combined IBM-COMMON Conference
    • GenAI Brings A New Kind Of Agile Computing That Needs Controls Even More
    • IBM i, AI, And The Cost Of “We’ve Always Done It That Way”
    • Infor Says IBM i Customers Are Welcome To Use New AI
    • IBM i PTF Guide, Volume 28, Number 36

    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