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!

append from command fails

Status
Not open for further replies.

framirez

Programmer
Apr 7, 2004
4
0
0
DO
Hello everyone,

I have a program that appends data from a text file delimited. The path and name of the file is at the most 30-40 characters long. Using w2k professional. Vfp 7.0
Records to append vary from 7,000-10000 lines

During development and testing the append command works as expected.

Under production the append command is not completed. An error is not generated but the resulting cursor is empty.
For smaller text files and single text line the program executes without any problem. User has all folder priviliges so security is not an issue.

Under production in my development machine the append command and program executes correctly under all circunstances.

My questions are the following:
- Are there known issues with using the append command with large text files?
- Is memory a factor when trying to append text files
- Any special settings on config.fpw that must be enable to handle the append command

Anything that can help.....


Thanks in advance






 
I've never noticed anything like that... can you confirm that the target table is indeed active during the append command?

Is it possible that larger files have non ASCII characters that cause VFP to read an end-of-file prematurely?

Try using the concept behind faq184-3378 to strip out other characters (remember to allow chr(13)).

Brian
 
Thank you everyone for your response.

The code I use is the following:

*-----
create cursor c_intfiledata ;
(line c(250))

*-----
select c_intfiledata

*----- Take path and file naming convention
*----- Please note the length of file name
lctmpfilename='\ewitabo\data\intdir\ssewitabo_inalm___000000000009s.txt'

*----
if file((lctmpfilename))

*----- This is where the problem occurs
*----- Under some circunstances the append is ignore and
*----- the program execution continues. No error is generated. Sometimes the command is executed without errors.
*----- I have used several variations with the append in
*----- including (lctmpfilename) for the filename
*----- The line string to be read is formatted the following way:
*------ alm~123245~description~last field etc.
*------It is an in-house structure used by different programs

append from &lctmpfilename delimited
go top
else
*---- do something else
endif

*----- continue program execution

The more I think about it looks like there could be some embedded character within one of the records that causes the append to fail or be ignored. The origin of the txt file is from an sql database.

Thanks once again for your reply.










 
lctmpfilename='\ewitabo\data\intdir\ssewitabo_inalm___000000000009s.txt'

Is \ewitabo subfolder or network path? If is subfolder, check ur default path, if is network should be \\ewitabo.

Take if file((lctmpfilename)) out and see what is the error. Im guessing is a path.
 
Thanks for the reply.
Tried same program with \ewitabo.... and with \\machinename\ewitabo... through the network.

if I use the above from the same machine the command fails.
However this program has worked before and is working on another setup/installation.

if I use the \\machinename\ewitabo... path from a network machine in this case my development machine then it works.
Both the production computer and my machine use w2k.

Strange....

if I use a single line in the text file then the program works.

Right now I'm checking the file for strange characters to see if something is wrong.

Thanks for the reply.




 
You say "The path and name of the file is at the most 30-40 characters long"

Could it be that your file path and name contain spaces.

If so you might try the following...

Instead of:
append from &lctmpfilename delimited

Try
append from (lctmpfilename) delimited

For my VFP7 applications I found that macro-substitution did not always work as expected if there were spaces in the file path and/or name. In my case, this issue applied to more than just the APPEND command.

Good Luck,
JRB-Bldr
 
It is definetly path and permissions issue.
Try to access to this folder from windows explorer.
Check with your net admin.
 
add this test permission/path issued

if file((lctmpfilename))=.f.
lctmpfilename=GETFILE([txt])
endif

If you can manually select the file and it works, then the directory/file exists test has an issue.

Brian
 
Thanks everyone for their helpful responses.
Problem solved by renaming the directory where the file resided and creating a new one with the same name.

Another thing we did was to ran an antivirus program. (The machine was infected) and cleaned all the viruses found.

I´m not sure which one was the solution but it works now..
Funny thing that "append from" did not generated any errors but it continued its execution leaving the recipient file empty.


Regards.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top