|
>Date: Tue, 19 Sep 2000 09:51:41 +0100 >From: "paul cunnane" <paul@cunnane.net> >> C CallP Sleep('for' '00:30:00') >> C CallP Sleep('til' '16:30:00') > >This raises an interesting question. If I was coding this, I would tend to >use symbolic constants (I don't trust string literals): > > D FOR C 0 > D UNTIL C 1 > > C CallP Sleep(FOR '00:30:00') > > >The question is, how do I make these constants available to the client of a >service program? I can't EXPORT a CONST from a module. > >The workaround I have used is to code the constant declarations into the >/COPY member with the prototypes, which makes them available to both the >service program and the client. Is there a better way? Paul, I agree about using symbolic constants rather than literals, and I think coding the constants once only in the /COPY file is the best way. It's not perfect, since there's nothing stopping someone from passing a literal, say 2. But I don't think there's a better way using RPG. In general, I think it's a good idea to include some prefix in the names, to avoid collision and confusion. By the way, in this case, I'd avoid the problem by coding two procedures: SleepFor SleepTil 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 +---
As an Amazon Associate we earn from qualifying purchases.
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.