• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • SBMJOB, CALL, And Decimal Parameters

    February 23, 2016 Ted Holt

    In spite of my great admiration for the IBM i operating system, I have to admit it has its idiosyncrasies. One of them, which has been there since Day 1, is the way the Submit Job (SBMJOB) command reformats decimal parameters of the CALL command. Fortunately, a relatively recent addition to CL provides an easy way to deal with this quirk.

    Assume a CL program calls an RPG program, passing along two decimal variables and a character variable.

    dcl  &Option       *char    1
    dcl  &Account      *dec     5
    dcl  &ThruDate     *dec     7
    
    call AR100R (&Account &ThruDate &Option)
    

    One day you are told to change this program so that it submits program AR100R to the batch subsystem. You could embed the call within a SBMJOB command, like this:

    sbmjob  cmd(call AR100R (&Account &ThruDate &Option)) +
               job(AR100) jobd(ARJOBD)                               
    

    But that would cause a decimal data error the first time the RPG program accessed the account number or date.

    Instead, overlay the decimal variables with character variables of the same size, like this:

    /* parameters for the submitted program */               
    dcl  &cAccount   *char 3 stg(*defined) defvar(&Account) 
    dcl  &cThruDate  *char 4 stg(*defined) defvar(&ThruDate)
    

    &Account is five digits packed decimal, which occupies three bytes, so &cAccount is defined as a three-byte character variable that overlays &Account. The &ThruDate variable occupies four bytes of memory, so &cThruDate is defined as a four-byte character variable. (To find the number of bytes of storage that a packed decimal variable occupies, add 1 to the number of digits and divide by 2. If the answer is not a whole number, round up. Another method is to add 2 to the number of digits, divide by 2, and throw away the remainder.)

    Use these character variables instead of the decimal variables in the SBMJOB command.

    sbmjob  cmd(call AR100R (&cAccount &cThruDate &Option)) +
         job(AR100) jobd(ARJOBD)                                 
    

    There you have it: an easy solution to an old problem!

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    VISUAL LANSA 16 WEBINAR

    Trying to balance stability and agility in your IBM i environment?

    Join this webinar and explore Visual LANSA 16 – our enhanced professional low-code platform designed to help organizations running on IBM i evolve seamlessly for what’s next.

    🎙️VISUAL LANSA 16 WEBINAR

    Break Monolithic IBM i Applications and Unlock New Value

    Explore modernization without rewriting. Decouple monolithic applications and extend their value through integration with modern services, web frameworks, and cloud technologies.

    🗓️ July 10, 2025

    ⏰ 9 AM – 10 AM CDT (4 PM to 5 PM CEST)

    See the webinar schedule in your time zone

    Register to join the webinar now

    What to Expect

    • Get to know Visual LANSA 16, its core features, latest enhancements, and use cases
    • Understand how you can transition to a MACH-aligned architecture to enable faster innovation
    • Discover native REST APIs, WebView2 support, cloud-ready Azure licensing, and more to help transform and scale your IBM i applications

    Read more about V16 here.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    COMMON:  2016 Annual Meeting & Expo, May 15 - 18, in New Orleans! Great Power Systems event!
    System i Developer:  RPG & DB2 Summit - March 22-24 in Dallas. Check out the session grid!
    BCD:  Webinar - Getting Started with PHP on IBM i with Mike Pavlak. Feb 25

    The Rewards of IBM i Community Engagement Payday For The People Who Make The IBM i Go

    2 thoughts on “SBMJOB, CALL, And Decimal Parameters”

    • John Torres says:
      July 18, 2019 at 10:59 am

      This is great!!

      Reply
    • Ron S says:
      September 17, 2019 at 8:07 am

      That’s awesome. I wish I’d known this about a month ago, would’ve saved me some time.

      Reply

    Leave a Reply Cancel reply

Volume 16, Number 04 -- February 23, 2016
THIS ISSUE SPONSORED BY:

Bug Busters Software Engineering
WorksRight Software
System i Developer

Table of Contents

  • PHP Crash Course For RPG Developers
  • SBMJOB, CALL, And Decimal Parameters
  • XML-INTO And Optional Elements

Content archive

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

Recent Posts

  • Liam Allan Shares What’s Coming Next With Code For IBM i
  • From Stable To Scalable: Visual LANSA 16 Powers IBM i Growth – Launching July 8
  • VS Code Will Be The Heart Of The Modern IBM i Platform
  • The AS/400: A 37-Year-Old Dog That Loves To Learn New Tricks
  • IBM i PTF Guide, Volume 27, Number 25
  • 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

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