× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi,

I even go one or two steps further:

1. All constants are defined in a single Service Program (in a named
activation group).
If a constant is needed it is returned by a function.
When ever a constant must be changed, it will only be changed in a single
place
and all procedures that call these functions will work correctly without
any change.

For example:
D ConstF03 C const(x'33')
....
D ConstF12 C Const(x'3C')
D ConstGrn C Const(x'21')
D ConstGrnRI C Const(x'22')
D ConstRecLock C Const('01218')
....
****************************************************************
P F03 B Export

D F03 PI Like(FldRef.Fkey)

*--------------------------------------------------------------
/Free
Return F03;
/End-Free
P F03 E
*****************************************************************
P GetDspAttrGrnRI...
P B Export
D GetDspAttrGrnRI...

D PI Like(FldRef.DSPATR)

*--------------------------------------------------------------
/Free
Return ConstGrnRI;
/End-Free
P GetDspAttrGrnRI
P E
*****************************************************************

Caller:
Select;
When FKeyPressed = F03();
When FKeyPressed = F12();
When FKeyPressed = Enter();
If ChkMyFld() = False;
DspAtr = GetDspAttrGrnRI();
EndIf;
EndSL;

For our mulitlingual applications I also put "constants" into a message
file.
Instead of the constant itself I store the message-id as constant in my
service program.
The first time a function is called (or if the caller forces it) the value
is determined
from the messge-file and stored in a static variable and returned.
For example in the German version the user enters J (=Ja / Yes), while in
the English version the user enters Y.

****************************************************************
P GetYes B Export

D GetYes PI Like(FldRef.YesNo)
D ParReload N Option(*NoPass)

D MsgIdYes C Const('TXT1234')
D LocYes S Like(FldRef.YesNo) Static

*--------------------------------------------------------------
/Free
If %Parms = 1 and ParReload = *On
or LocYes = *Blanks;
LocYes = RtvMsgTxt(MsgIdYes: GetMsgFile());
EndIf;
Return LocYes;
/End-Free
P GetYes E


Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.