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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Both Sys(2000) and File() doesn't wotk - VFP6

Status
Not open for further replies.

foxbldr

Programmer
Apr 16, 2002
109
CA
Hi all,

I am using VFP 6 on Novell/NT environment. When I use File() or Sys(2000) to check the existance of files it returns TRUE even when the exact file names are not found. Files names look like:

DT060815_P_L.dbf
DT060815_P_S.dbf
DT060815_P_X.dbf... etc

When I use File("DT060815.dbf") or sys(2000,"DT060815.dbf") returns TRUE/non-blank string when exact physical file name is "DT060815_P_S.dbf".

I suspect this is due to some sort of mapping (map to 8.3 naming convention)done by Novell and I have no control over client's platform. Has anybody ever found this or got a clue to get around this?

Foxbldr






 
I suspect you're right about it being a Novell problem because I don't get that behaviour on my non Novell system. One possibility at a workaround, but untested - obviously.
Code:
? UPPER(JUSTFILENAME(LOCFILE("DT060815.DBF") == "DT060815.DBF"
Good luck,
Jim
 
Sorry, that should be JUSTFNAME, not JUSTFILENAME. Why doesn't intellisense kick in when we use the code blocks? ;-)

Regards,
JIm
 
This is a silly VFP trap!

It will ignore your specified path and look elsewhere for the file FIRST so if you have a file by that name in your search path (I *think* I'm talking about the VFP default search path)... it will say the file exists, even if it does not exist in the path you specify!

I have stopped using File() for this reason, and have written a bit of scruffy code to do the job for me:

Code:
FUNCTION MYFILE
	PARAMETER m.FILENAME
	PRIVATE m.FILENAME,m.FLG
	M.FLG = .F.
	IF !EMPTY(m.FILENAME)
		IF ADIR(TMPDIRFILES,m.FILENAME) > 0
			M.FLG = .T.
		ENDIF
	ENDIF
	RETURN(m.FLG)





Regards

Griff
Keep [Smile]ing
 
foxbldr,
I just tested File() on my Netware server and it works as expected. I created a file called DB505050_L_D.dbf saved to the server and did a ?FILE("DB505050.dbf") that returned .F. then did a ?FILE("DB505050_L_D.dbf") which returned .T. so Netware may not be the problem.

Can you physically browse to these files on the Netware server and they have these file names? (greater than 8.3)

DT060815_P_L.dbf
DT060815_P_S.dbf
DT060815_P_X.dbf... etc

How are you defining the path for File() or even Justfname() to search? Can you post your SET PATH statement?

Did Jim's suggestion work?

Ed
 
Thanks for quick replies!


Ed:
When I browse the file on server what I see is file names longer than 8.3. At the same time explorer (with NT) shows 8.3 files names in separate column.

i.e.

long name 8.3 name
DT060815_P_L.dbf DT060815.dbf
DT060815_P_S.dbf .....
DT060815_P_X.dbf. ......

Grif:

Adir does the same, it returns 1.


Jim:
It does the same. Expr returns TRUE and file doesn't exist physically.



Foxbldr







 
Which network client are you using is it a Novell one, or an MS one?

I'm in clutching at straws situation here... I've not come across a problem like that (that Adir() didn't fix).



Regards

Griff
Keep [Smile]ing
 
Just so we get the details straight, are you running Windows NT 4 on the desktop and Novell Netware on the server? If so, which version of Netware? Netware prior to v5 needed some special handling to use long file names.

Could there possibly be a file named DT060815.dbf somewhere in VFP's search path?



Ed
 
I seem to remember some console commands for Netware (3?)

Code:
LOAD LONG.NAM
ADD NAME SPACE LONG TO VOLUME SYS

Or somesuch

Regards

Griff
Keep [Smile]ing
 
I wonder if you could test the 'workstation shell' by doing a test for the file using VBA? from Excel or Word?

Regards

Griff
Keep [Smile]ing
 
Griff,
That is how you would load long file name support on a Netware server (3.12 and above) but foxbldr said he can see the long file name thru explorer. If Long.nam is not loaded, it would permenantly rename the file to 8.3 format. This is why we need to know the details since Long.nam is loaded by default on Netware 5 and above and he can see the long file name.

Foxbldr,
How are the files getting on the server?
Is VFP creating them or are you shelling out and copying them?

Ed
 
Ed,

Yes, it's Novel Client Version 4.83 SP2 on NT.

I know that FILE() search for the file in SET PATH paths but these files are created daily in one location only. I had a search too.


Tx _Foxbldr
 
Ed,

An app written in VFP6 creates these DBFs using flat files daily. Scary thing is that I am developing another system that uses these daily files (ie daily posting..) to feed an accounting system. Process need to be automated and checking existance of files needed as the process should skip non-business days.

tx Foxbldr



 
Do you have the option of switching to an MS client?

Can you do the VBA test?


Regards

Griff
Keep [Smile]ing
 
Since you know the path and I assume you know the file name, could you look specifically at the location where the files are supposed to be?
Try something like this (not tested):

cPath = "x:\servername\foldername\"
cFileName = "DT060815_P_L.dbf"
cSearchFor = cPath + cFileName
?FILE(cSearchFor)

I have a Netware server running NW6.5 and the Novell Client on my workstation and am not having any problems doing exactly what you are trying to do.

Ed
 
Ed,

Though I didn't mention with earlier post, actually FILE() is used as follows:

if File(addbs(m.tcDynamicDataPath)+ m.tcDailyRunFile).. which look like:

if File("G:\PS\GLPosting\Trading\dt060817_P_L.dbf")....


Foxbldr




 
How about using fopen()?


Code:
nFile = fopen("G:\PS\GLPosting\Trading\dt060817_P_L.dbf")

if nFile > 0
  fclose(nFile)
else
  ?"File not available"
endif
 
Just guessing here but would 'SET EXACT' have any affect here?

Ed
 
Thank you for keep posting.

Baltman:

Fopen returns a value greater than 0 when checked with 8.3 file name.

Ed:
No, there is no effect with EXACT ON/OFF here.

I don't have this issue with files on local drives so look like I need to talk to network gurus in the company.

Foxbldr







 
Not sure if you have an answer to this yet, but I usually use FULLPATH() within FILE().

? FILE(FULLPATH('FileName.ext'))

Just a shot...

-mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top