|
Either way, I'd have to know what MyProc was returning. If it's returning an integer, what does -1, 0, or 1 mean? If it's returning 'ExistingCust', well I know what that means without having to look any further. And, unless there's a huge price to pay for using character string vs. integer value, I'd go with what's clear & understandable any day. That said, I've already replied to Scott Mildenberger about his warning with regards to mispelling the literal and how I'll less likely cut my own throat when the compiler catches the error. So, my new standard is to use constants as was shown in the original example. - Dan Bale -----Original Message----- From: Jim Langston [mailto:jlangston@conexfreight.com] Sent: Wednesday, March 08, 2000 4:04 PM To: RPG400-L@midrange.com Subject: Re: Indicator enhancements (was Bale, Dan) Dan, you say you have to look in the D-Specs to see how the constants are defined, but what would you have t look at to see that the return code is 'ExistingCust' ? Also, that return code is a character string, which takes up a lot for room on the stack than an integer value (packed). Regards, Jim Langston "Bale, Dan" wrote: > Me, I'd just junk the defined constants and use literals in the expression. > That way I don't have to bother looking up the D-specs to see how the > constants are defined. > > C Eval RtnCode = MyProc( MyParm ) > C Select > C When RtnCode = 'ExistingCust' > * Perform existing customer processing > C When RtnCode = 'NewCust' > * Perform new customer processing > C When RtnCode = 'Error' > > -----Original Message----- > From: bmorris@ca.ibm.com [mailto:bmorris@ca.ibm.com] > Sent: Wednesday, March 08, 2000 2:12 PM > To: RPG400-L@midrange.com > Subject: Re: Indicator enhancements (was Bale, Dan) > > >Date: Tue, 07 Mar 2000 17:07:10 -0600 > >From: Gary Guthrie <GaryGuthrie@home.com> > > > > I submit it might be clearer to: > > > >D Error S N Inz( *Negative ) > >D ExistingCust S N Inz( *Positive ) > >D NewCust S N Inz( *Off ) > >C Eval RtnCode = MyProc( MyParm ) > >C Select > >C When RtnCode = ExistingCust > > * Perform existing customer processing > > > >C When RtnCode = NewCust > > * Perform new customer processing > > > >C When RtnCode = Error > > ... > > Gary, I don't see that *NEGATIVE appears to have general > usefulness. Aside from that, indicators hold boolean values. > If you want to return more than 2 different values, use a > type that has more than 2 values, and use named constants > for your special values, in both your procedure and its > callers. > > D Error C -1 > D ExistingCust C 1 > D NewCust C 0 > > C Eval RtnCode = MyProc( MyParm ) > C Select > C When RtnCode = ExistingCust > * Perform existing customer processing > C When RtnCode = NewCust > * Perform new customer processing > C When RtnCode = Error > ... > > Barbara Morris +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.