Re: Why you shouldn't be afraid to use VARCHAR in RPGLE

Stephen Coyle <[email protected]>
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <CAHFzr1WNOWNgD0T9T=saHgbQosHeAtkw06DA2n-jrXQp3GOxYw@mail.gmail.com>
 **************************************************************************
 *
 *  Procedure Name:  FsiUtils_IIF
 *       Exported?:  Yes
 *        Function:  Immediate IF Function
 *         Returns:  Value Supplied for True or False Condition
 *
 *         Ex:    NewOnly = FSIUTILS_IIF(@Status = stsNEW :*On :*Off);

 **************************************************************************

P FsiUtils_IIF    B                   EXPORT

D FsiUtils_IIF    Pi           256a   varying
D  Condition                      n           value
D  TrueValue                   256a   varying value
D  FalseValue                  256a   varying value

   If Condition;
      Return TrueValue;
   Else;
      Return FalseValue;
   Endif;

P FsiUtils_IIF    E



On Thu, Dec 11, 2025 at 10:59 AM Javier Sanchez <
[email protected]> wrote:

> Paul,
>
> "C" has it as a native language for over decades.  Can't see why that would
> be complex for them to follow and make it available for devs.
> Of course, and WADR, you need to "know what you are doing" with your return
> value.  That is kind of your intellectual work.
> Efficiency and cleanliness of code is vital for modern languages. Elegant
> code is, and simplicity is a major goal in our era.
>
> JS
>
> El jue, 11 dic 2025 a las 9:50, Paul Therrien via RPG400-L (<
> [email protected]>) escribió:
>
> > Not knowing 'C' I asked Google.
> >
> > Google AI says this:
> >
> > The statement boolVal = (a = b ? 0: 1) in C is a syntactically valid but
> > potentially confusing use of the ternary operator and assignment operator
> > within a single expression [1].
> >
> > What it does
> > Essentially, the line of code is a verbose way of setting boolVal based
> on
> > whether b is zero or not, while simultaneously changing the value of a:
> > If b is 0: a becomes 1, and boolVal becomes 1.
> > If b is non-zero: a becomes 0, and boolVal becomes 0.
> >
> > I think I can see why IBM might not be in a hurry to handle this request.
> >
>
>
>
-- 
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact [email protected] for any subscription related questions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.