Programming standards (AREV Specific)
At 24 JAN 2001 10:03:52AM Larry Wilson wrote:
I was just wondering how many of you hardcode AMCs versus using EQUATEs in programs.
i.e. PAT(345) or patient_provider_id$
or PAT(345) or PAT(patient_provider_id_amc$)I'm finding most places are hardcoding AMCs (I've started contracting to kill some time), which contradicts my training.
Thanks,
Larry
Webmaster@AdvancedRevelation.com
At 24 JAN 2001 10:34AM [url=http://www.sprezzatura.com" onMouseOver=window.status=Click here to visit our web site?';return(true)]The Sprezzatura Group[/url] wrote:
We tend to use equates for pretty much everything. Then again we use angle brackets rather than parentheses .
World Leaders in all things RevSoft
At 24 JAN 2001 10:35AM matt sorrell wrote:
Larry,
I do it both ways. Generally I use equates, but sometimes I just use the AMC.
Call it lazy I guess, but sometimes I just don't want to go through the effort of setting up the equates.
msorrel@greyhound.com
At 24 JAN 2001 10:50AM [url=http://www.sprezzatura.com" onMouseOver=window.status=Click here to visit our web site?';return(true)]The Sprezzatura Group[/url] wrote:
That's where your handy dandy Create_Equates routine comes in…
World Leaders in all things RevSoft
At 24 JAN 2001 12:41PM matt sorrell wrote:
Eh???
Care to share?
msorrel@greyhound.com
At 24 JAN 2001 01:13PM [url=http://www.sprezzatura.com" onMouseOver=window.status=Click here to visit our web site?';return(true)]The Sprezzatura Group[/url] wrote:
Don't the REVMEDIA utility diskettes available for free download from our site contain examples of same?
World Leaders in all things RevSoft
At 24 JAN 2001 02:45PM Michael Slack wrote:
Our internal programming standards is to use the Equates. Most of the time that is in conjunction with angle brackets (). With my personal style of coding, I find the Equates a big help in making the code readable and flexable.
Not knowing about any program already supplied by Arev, we created our own little utility. The program reads in the real data field dictionary definition names and position number and creates a row containing all those equates. Then we just insert them into a program we are creating and a way we go. Only if the dictionary has additions or deletions do we need to update the equates row for that dictionary. Otherwise it's realatively standardized for all programs we write.
Michael Slack
At 24 JAN 2001 02:47PM Matt Sorrell wrote:
I looked through all of the diskettes, but I couldn't seem to find one.
Oh well, guess I can always create my own.
msorrel@greyhound.com
At 25 JAN 2001 05:19AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
Since you're using parens, figures you must be using thed matread op. You know you should do a flush;garbagecollect after each matread to avoid the matread bug that's been identified since RevF, fixed, and never integrated.
World Leaders in all things RevSoft
At 25 JAN 2001 05:33AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
Here's a version written for OpenInsight. You'll only need some small modifications for it to run in ARev.
The program returns a version with the equates written in number order and a version written in alphabetic order.
By default, the equate names are written out as
FILENAME_FIELDNAME$
however, the second parameter of the subroutine will replace the filename with something a little easier to type.
subroutine make_equates( fileName, heading )
$INSERT DICT_EQUATES
declare function repository
convert @LOWER.CASE to @UPPER.CASE in fileName
fields=xlate( 'DICT.' : fileName, '%FIELDS%',
, 'X') if len( fields) else call set_status(1,'File ' : fileName : ' does not have dictionary items or does not exist') return end if assigned( heading) else heading=fileName end if len( heading ) else heading=fileName end fieldNames=fields&FIELDS_NAME$] fieldNbrs =fields&FIELDS_FIELD_NO$] col1=0 col2=0 moreFields=1 alphaRec=COMPILE INSERT ' : fileName : '_EQUATES_ALPHA' : @FM : @FM alphaRec := ' Autogenerated on ' : timedate() : @FM : @FM numRec=COMPILE INSERT ' : fileName : '_EQUATES' : @FM : @FM numRec := ' Autogenerated on ' : timedate() : @FM : @FM insertRec=' loop while moreFields remove fieldName from fieldNames at col1 setting more1 remove fieldNbr from fieldNbrs at col2 setting more2 moreFields=more1 + more2 if fieldNbr ]= 1 then alphaRec := @FM : 'EQU ' : fmt( heading : '_' : fieldName : '$', 'L#50' ) : ' to ' : fieldNbr insertRec := fieldNbr : @FM : fmt( heading : '_' : fieldName : '$', 'L#50' ) : @RM end repeat call v119( 'S',
, 'A','R', insertRec,) loop line=insertRec1,@RM while len( line) insertRec1,col2()=' numRec := @FM : 'EQU ' : line&2] : ' to ' : line&1] repeat alphaId=@appid&1] : '*STPROCINS' : fileName : '_EQUATES_ALPHA' numId=@appid&1] : '*STPROCINS' : fileName : '_EQUATES' unUsed=repository( 'WRITE',alphaId,'1',
,,
,,
,,
,, alphaRec) unUsed=repository( 'COMPILE', alphaId, 0) unUsed=repository( 'WRITE',numId,'1',
,,
,,
,,
,'', numRec)unUsed=repository( 'COMPILE', numId, 0)
return
World Leaders in all things RevSoft
At 30 JAN 2001 07:43AM Cameron Christie wrote:
Larry,
As you doubtless know, for good practise equates win hands down every time. The only real PITA is when your source code is really straining at 34K and you want to say rather than !
Equates are more readable, and much more difficult to get wrong by accident. They're also invaluable when it comes to scanning code for all places where a given column is accessed (and that includes any symbolic fields, where the temptation is usually to get quick & dirty!) If you're in a strange system your chances of finding all references to for a given table are very slim, especially if it's multi-valued.
In our own AREV system we emulate the OI repository by building a library of all references to any "word" of more than 3 characters in any program, window, popup , menu or dictionary table. Without the meaningful names this wouldn't be half as useful…
FWIW,
Cameron