Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PLEASE HELP ON SEEK RECORD

Status
Not open for further replies.

VNDN

Programmer
Feb 28, 2003
27
0
0
US
I have another problem. Can anyone please take a look at this part of code. when use Seek function to seek Provno2 with same FYE but it always return as zero record. but I know for sure that we have record that match the criteria in our DBF1. Please tell me what's wrong this this code. Thanks CVL


* OPEN UPDATE DATABASE
USE Startime NEW


* OPEN PDF DATABASE
USE PDF1 NEW
INDEX ON PROVNO2 + (DTOS(FYE)) to prono

*****************************************************
* SKIP THROUGH EACH RECORD IN THE UPDATE DATABASE
* UPDATE DBF FILE
*****************************************************

DO WHILE !Startime -> (eof())
SEEK Startime ->PROVNO2 + startime -> (DTOS(FYE))
IF found()
IF !EMPTY(Startime ->AFCODE)
IF !EMPTY(PDF1 ->POA)
REPLACE POA WITH Startime ->AFCODE
ELSE
DO ERRORLINE WITH Startime ->EmployNo + " " + StarTime ->PROVNO2 + Startime ->(DTOC(FYE)) + " POA" + " TARGET FIELD EMPTY " +;
Startime ->POA
ENDIF
ENDIF
IF !EMPTY(startime ->DRCODE)
IF !EMPTY(PDF1 -> DRTYPE)
REPLACE drtype WITH Startime ->drcode
ELSE
DO ERRORLINE WITH Startime ->EmployNo + " " + StarTime ->PROVNO2 + Startime ->(DTOC(FYE)) + " DRCODE" + " TARGET FIELD EMPTY " +;
Startime ->DRCODE
ENDIF
ENDIF
IF !EMPTY(startime ->FEXITIND)
IF !EMPTY(PDF1 -> AFCOMPIND)
REPLACE afcompind WITH Startime ->fexitind
ELSE
DO ERRORLINE WITH Startime ->EmployNo + " " + StarTime ->PROVNO2 + Startime ->(DTOC(FYE)) + " FEXITIND" + " TARGET FIELD EMPTY " +;
Startime ->FEXITIND

ENDIF
ENDIF
IF !EMPTY(startime -> prexitind)
IF !EMPTY(PDF1 -> PREXITIND)
REPLACE prexitind WITH Startime ->prexitind
ELSE
DO ERRORLINE WITH Startime ->EmployNo + " " + StarTime ->PROVNO2 + Startime ->(DTOC(FYE)) + " PREXITIND" + " TARGET FIELD EMPTY " +;
Startime ->PREXITIND

ENDIF
ENDIF

RECORD++
ENDIF
SKIP ALIAS Startime
ENDDO
 
After

* OPEN PDF DATABASE
USE PDF1 NEW
INDEX ON PROVNO2 + (DTOS(FYE)) to prono

you need to put the statement:

SET INDEX TO PRONO

because you are seeking on a dbf with no active index.

Rob.
 
You may want to look into the 5.2 style of coding rather than the summer '87 version... also you may want to look into Hungarian Notation... both will improve code readability and re-use...


Richard L. Hankins Jr.
Senior Programmer
Auction Services, Inc.
 
I think I would put a GO TOP after the index statement
(or after the SET ORDER TO one if you take on Rob444's suggestion).

HTH Regards

Griff
Keep [Smile]ing
 
THANK SO MUCH FOR ALL YOUR HELP. I WILL TRY YOUR SUGGESTION. I AM VERY NEW TO CLIPPER. THIS IS MY FIRST TIME CODING SOMETHING IN CLIPPER. THANKS AGAIN.
 
Hi again,

I just tested my suggestion - the GO TOP and in the version I'm using it doesn't help. The index creation is resetting the record pointer to the beginning. It is good practise though.

HTH Regards

Griff
Keep [Smile]ing
 
The only thing I could think of is to check that the PROVNO2 fields are the same size, and the same case if letters are used.

You can get around the case problem using:

INDEX ON upper(PROVNO2) + (DTOS(FYE)) to prono
and
SEEK upper(Startime->PROVNO2) + startime-> (DTOS(FYE))


This then highlighted a problem in the seek which should read:

SEEK Startime->PROVNO2 + dtos(startime->FYE)

Hope that helps.
 
HOTEYE,
IT IS STILL NOT WORK. thanks CVL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top