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
As an Amazon Associate we earn from qualifying purchases.