-nl lookup option

Nancy Palmquist nlp at vss3.com
Thu Aug 27 12:32:31 PDT 2015


Richard,

A next less lookup to see what was last, does work, in some cases, 
however I might warn you about this:

1) you have no way to avoid two people grabbing the same code at the 
same time.

2) you have to assume the indexes are perfect and updated.

I prefer the control file method, where you do a protected lookup to 
file, grab a number increment and write the number used back, unlock.  
Then I do a second check to see if the number has been assigned before I 
write it to my file., repeat if it has. This should be less likely to 
get duplicates.

I have seen windows systems still with these safeguards in place, assign 
duplicate numbers.  So it is important that you make as many 
verifications as you can to eliminate that possibility.  It seems that 
even with record locking it is possible to have two people grab the same 
number from a control number.  Seems there is a wee bit of time between 
the point where a person would lock or unlock a record and when the data 
is updating.  I have encountered this in cases where two or more people 
were grabbing number after number in a report posting situation.  I 
designed a solution based on the IP address of the computer station, 
that solved our duplicates.  Should not have been necessary.

Same processing logic in a *NIX system, never got duplicates.

Nancy

On 8/26/2015 4:37 PM, Richard Kreiss via Filepro-list wrote:
> This is a programming approach question:
>
> For each person in a database you have the following 3 fields.
>
> Accounting code (4,.0) - lowest number is 1000 and values in the 9000 range are reserved.
> Each person is coded with an Accounting number and a person number (5,.0) starting at 10000.
>
> Master code field is accounting Code-person number (NNNN-NNNNN)
>
> Index K is built on the master code.
>
> When a new person is added, the accounting code is entered and the program then does a lookup using index K -nl
>
> The lookup value used currently is lv="NNNN-99999" and get the highest value for NNNN-NNNNN.  A mid statement get the person code and adds one to it. This works nicely.
>
> However, would it be better to use:
>
> Assume that the Accounting Code is 1234
> AC="1234"+"1"
> PC="00000"
> Lv="1235-00000"
>
> Which is better coding or are they the same?
>
> Richard Kreiss
> GCC Consulting
>
>
>
>
>
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> Subscribe/Unsubscribe/Subscription Changes
> http://mailman.celestial.com/mailman/listinfo/filepro-list
>

-- 
Nancy Palmquist         MOS & filePro Training Available
Virtual Software Systems    Web Based Training and Consulting
PHONE: (412) 835-9417           Web site:  http://www.vss3.com



More information about the Filepro-list mailing list