That's a good add. When I retired, we were still stuck on 7.2 but I used to use CEETSTA extensively in CL & RPG to check missing/omitted/optional parameters. I was building a lot of command interfaces at the time.

Roger Harman
COMMON Certified Application Developer - ILE RPG on IBM i on Power



-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Mark Waterbury
Sent: Wednesday, June 11, 2025 9:10 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Optional parameter on CL Program

Greg,
You may have easily missed its introduction, as it was slipped in as part of some TR level of IBM i 7.3, with PTF SI66721, so during the middle of the lifetime of V7R3.
Mark S. Waterbury
On Wednesday, June 11, 2025 at 11:49:58 AM EDT, Greg Wilburn <gwilburn@xxxxxxxxxxxxxxxxxxxxxxx> wrote:

Beautiful! Thank you Dan!

I don't know how I missed the %parms() function in CL...

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Dan Bale
Sent: Wednesday, June 11, 2025 10:27 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: Optional parameter on CL Program

Use %parms() function:

PGM Parm( &pONorOFF &pWrkCfgSts )

Dcl &pONorOFF *char Len( 4 )
Dcl &pWrkCfgSts *char Len( 4 )
Dcl &ONorOFF *char Len( 4 )
Dcl &WrkCfgSts *char Len( 4 )

/* Set &ONorOFF variable based on parm being passed or not. */
If ( %parms() > 0 ) Then( Do )
ChgVar &ONorOFF &pONorOFF
Enddo
Else ( Do )
ChgVar &ONorOFF '*ON'
Enddo
/* Set &WrkCfgSts variable based on parm being passed or not. */
If ( %parms() > 1 ) Then( Do )
ChgVar &WrkCfgSts &pWrkCfgSts
Enddo
Else ( Do )
ChgVar &WrkCfgSts '*NO'
Enddo

- Dan Bale

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Greg Wilburn
Sent: Wednesday, June 11, 2025 10:20 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Optional parameter on CL Program

I have a CL program that is called by many other programs. It currently accepts a single parameter, but I would like to add a second parameter w/out having to change all of the calling programs.

I have thought of a few ways to do this, but wanted to see if I'm missing any other angles.

1. Simply create a copy of the CL pgm that accepts a second parameter
2. Add the parameter and monitor for a message
3. Create an RPG program of the same name and "wrap" that around a renamed version of the CL pgm

Thx,
Greg

*** CONFIDENTIALITY NOTICE: The information contained in this communication may be confidential, and is intended only for the use of the recipients named above. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please return it to the sender immediately and delete the original message and any copy of it from your computer system. If you have any questions concerning this message, please contact the sender. ***
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Greg Wilburn
Director of IT
301.895.3792 ext. 1231
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.


--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.