Re: Why you shouldn't be afraid to use VARCHAR in RPGLE
Stephen Coyle <[email protected]>
| Newsgroups | gmane.comp.lang.as400.rpg |
|---|---|
| Message-ID | <CAHFzr1XdaT-Le04MXo3trSocouBc-0Wh=ZbM5iFS_+UKf9SVvQ@mail.gmail.com> |
You're right....returning a boolean is a bad example and the procedure is not needed. The function returns more than a boolean though. Maybe this is a better example ConfigVal = FSIUtils_IIF(isProdEnv :CfgProdVal :CfgDevVal); On Thu, Dec 11, 2025 at 1:02 PM Javier Sanchez < [email protected]> wrote: > Do you think it's worth all those lines of codes against one single line? > Is that elegant? > Is that efficient? > Not sure what you wanted to show. All I'm saying is that, fewer lines of > code, efficient compiler code is better. > > JS > > El jue, 11 dic 2025 a las 10:25, Stephen Coyle (<[email protected]>) > escribió: > > > > ************************************************************************** > > * > > * 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. > > > > > -- > 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. > > -- 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.