Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Dear Jim
According to your suggestion I have developed the following module but there is some thing wrong with me.
There is a table PID.DBF with one field PID and two records
1st record - last PID No.(Personnal Identification No.)
2nd record - last Bill No.
another table BILL.DBF which contain Bill record.
To generate unique PID No. and unique Bill No. I have written the
following routine where if PID No. already exists then it is not generated.
*============
select 0
do while .t.
use pid alias pid EXCLUSIVE
if USED("pid")
exit
endif
enddo
if len(alltrim(temp.pid)) = 0
select pid
go top
m.lastpid = pid.pid
mpd = val(substr(m.lastpid,2,6))
m.pdno="P"+padl(alltrim(str(mpd+1,6,0)),6,"0")
replace pid.pid with m.pdno
else
m.pdno = temp.pid
endif
select pid
go bottom
mbno = val(left(pid.pid,6))
m.bno=padl(alltrim(str(mbno+1,6,0)),6,"0")
replace pid.pid with m.bno
select pid
use
*===============
then BILL.DBF is open exclusive and record is added with bill no. - m.bno
The programme is excuted from three node simultaneously and approx 700 bill are generated daily.
But in a day there will surely 3 or 4 duplicate bill no.
Can you tell me where I am wrong.
Thanking you
Aritra Roychoudhury
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement