• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Guru: The Case for Mixed-Case Procedure Names

    July 14, 2020 Paul Tuohy

    Using mixed case makes source code easier to read and easier to debug. I programmed in all upper case for many, many years, so I don’t recoil in horror when I see something in all uppercase. However, it’s a bit more difficult for developers who aren’t quite as long in the tooth as I am. To them, all uppercase is pretty abhorrent and bad (and I don’t mean bad as in good).

    There is a potential case issue with subprocedure names: there are at least three places on the system where the system shows subprocedure names in uppercase, regardless of how they are coded. Luckily, this is something that is easily addressed, so with a thought to those who follow in your footsteps, you may want to consider standardizing on the use of extProc(*dclCase).

    The conversion of subprocedure names to uppercase can be seen in the exports for a service program (DSPSRVPGM with DETAIL(*PROCEXP)).

    So, if we look at the exports for a service program (DSPSRVPGM with DETAIL(*PROCEXP)):

                                   Procedure Exports:                              
     Procedure Name                                                          ARGOPT
     CALCULATEDEDUCTIONS                                                     *NO   
     CALCULATEPAY                                                            *NO   
     CALCULATETAX                                                            *NO   
     GETINCOME                                                               *NO   
    

    Or the call stack in a job (DSPJOB option 11):

    PAYCALC1   TESTSTUFF                       _QRNP_PEP_PAYCALC1 
    PAYCALC1   TESTSTUFF     600               PAYCALC1           
    PAYCALC    TESTSTUFF     800               CALCULATEPAY       
    PAYCALC    TESTSTUFF     1400              GETINCOME          
    PAYCALC    TESTSTUFF     2000              CALCULATETAX       
    PAYCALC    TESTSTUFF     2800              CALCULATEDEDUCTIONS   
    

    Or the details of an error message (F1 on a message in the job log then F9):

    From program . . . . . . . . . :   TRYCASE                       
      From library . . . . . . . . :     TESTSTUFF                   
      From module  . . . . . . . . :     TRYCASE                     
      From procedure . . . . . . . :     GETRESULTOFACOOLCALCULATION 
      From statement . . . . . . . :     81                          
                                                                     
    To program . . . . . . . . . . :   TRYCASE                       
      To library . . . . . . . . . :     TESTSTUFF                   
      To module  . . . . . . . . . :     TRYCASE                     
      To procedure . . . . . . . . :     GETRESULTOFACOOLCALCULATION 
      To statement . . . . . . . . :     81                            
    

    We see that the subprocedure names are in uppercase.

    Instead, we want to see this in the export list:

                                   Procedure Exports:                              
                                                                                  
     Procedure Name                                                          ARGOPT
     calculateDeductions                                                     *NO   
     calculatePay                                                            *NO   
     calculateTax                                                            *NO   
     getIncome                                                               *NO                            
    

    And this in the call stack:

    PAYCALC1   TESTSTUFF                       _QRNP_PEP_PAYCALC1  
    PAYCALC1   TESTSTUFF     600               PAYCALC1            
    PAYCALC    TESTSTUFF     800               calculatePay        
    PAYCALC    TESTSTUFF     1400              getIncome           
    PAYCALC    TESTSTUFF     2000              calculateTax        
    PAYCALC    TESTSTUFF     2800              calculateDeductions                            
    

    And this in the message details:

    From program . . . . . . . . . :   TRYCASE                       
      From library . . . . . . . . :     TESTSTUFF                   
      From module  . . . . . . . . :     TRYCASE                     
      From procedure . . . . . . . :     getResultOfACoolCalculation 
      From statement . . . . . . . :     81                          
                                                                     
    To program . . . . . . . . . . :   TRYCASE                       
      To library . . . . . . . . . :     TESTSTUFF                   
      To module  . . . . . . . . . :     TRYCASE                     
      To procedure . . . . . . . . :     getResultOfACoolCalculation 
      To statement . . . . . . . . :     81                            
    

    EXTPROC(*DCLCASE) to the rescue!

    The EXTPROC keyword indicates the external name of a subprocedure. The EXTPROC keyword can be defined on a prototype (dcl-pr) or a procedure interface (dcl-p1) definition.

    This prototype will result in an external name of get_otherStuff:

    dcl-pr get_otherStuff end-pr;                          
    

    Whereas this prototype will result in an external name of get_otherStuff:

    dcl-pr get_otherStuff extProc('get_otherStuff') end-pr;                          
    

    Repeating the subprocedure name can be tedious and open to typos, so better to make use of the special value of *DCLCASE, which means that the exact case of the subprocedure name will be used.

    dcl-pr get_otherStuff extProc(*dclcase) end-pr;                          
    

    This is all well and good for prototypes, but prototypes are not required for subprocedures that are not exported. In this case we specify the EXTPROC(*DCLCASE) on the procedure interface:

    dcl-Proc calculateTax export;
      dcl-pi *n extProc(*dclCase) 
      end-pr;
    end-Proc;                          
    

    Using EXTPROC(*DCLCASE) means we now have easy-to-read subprocedure names in export lists, call stacks and message details.

    RELATED STORIES

    *DCLCASE with the EXTPROC keyword (IBM Knowledge Center)

    The Geezer’s Guide To Free-Form RPG, Part 4: Prototypes and Procedure Interfaces

    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: 400guru, FHG, Four Hundred Guru, IBM i

    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:

    • 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

    The Path Truly Opens To Alternate Power CPUs, But Is It Enough? Thoroughly Modern: Why You Need An IT Strategy And Roadmap

    2 thoughts on “Guru: The Case for Mixed-Case Procedure Names”

    • Bill Pahl says:
      July 14, 2020 at 8:47 am

      >>This prototype will result in an external name of >>get_otherStuff:

      >>dcl-pr get_otherStuff end-pr;

      Doesn’t this declaration yield an upper case external name?

      Reply
    • Paul Jackson says:
      August 11, 2020 at 7:41 pm

      I was thinking the same, I think it’s a typo. Also the last code example shouldn’t have the Export keyword as it is specifically referring to the example where a procedure is NOT exported.

      Reply

    Leave a ReplyCancel reply

TFH Volume: 30 Issue: 41

This Issue Sponsored By

  • ProData
  • Fresche Solutions
  • OCEAN TechCon20
  • Kisco Information Systems
  • Raz-Lee Security

Table of Contents

  • IBM Revamps Entry Power Servers With Expanded I/O, Utility Pricing
  • Thoroughly Modern: Why You Need An IT Strategy And Roadmap
  • Guru: The Case for Mixed-Case Procedure Names
  • The Path Truly Opens To Alternate Power CPUs, But Is It Enough?
  • IBM i PTF Guide, Volume 22, Number 27

Content archive

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

Recent Posts

  • Welcoming The New IBM i Chief Architect And Other New Top Brass
  • A Deep Dive Into That Power S1112 Entry Power11 Server
  • Guru: Beyond Three-Part Naming – Running SQL Across Remote IBM i Systems
  • How IBM Bolstered IBM i Resilience In The Summer Tech Refreshes
  • IBM i PTF Guide, Volume 28, Number 26
  • Power Systems Has A Great Quarter; System Z, Not So Much
  • Does AI Mark The End Of The ERP Era?
  • Guru: Deterministic Application Development With AI
  • What IBM’s Got Cooking In Db2 For i In The Summer TRs
  • IBM i PTF Guide, Volume 28, Number 25

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