dbTalk Databases Forums  

Line breaks out of nowhere in VFP6...

comp.databases.xbase.fox comp.databases.xbase.fox


Discuss Line breaks out of nowhere in VFP6... in the comp.databases.xbase.fox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AK
 
Posts: n/a

Default Line breaks out of nowhere in VFP6... - 06-07-2004 , 10:01 PM






Hello

I have a program that creates a pattern of data into a var and then it
sends that var to an alte file.

Sometimes, the line for a company would be broken to multiple lines.
So, "MICROSOFT, INC" would turn to be:
"Microsoft,
Inc."



Code example:

locate ???
set alte to jj
set alte on
do whille found()
outline = ""
out_line = outline + "13,"+comp_name
out_line = outline + "14,"+comp_adrs1

Reply With Quote
  #2  
Old   
Rick Bean
 
Posts: n/a

Default Re: Line breaks out of nowhere in VFP6... - 06-08-2004 , 08:23 AM






AK,
I'm not sure what your question or problem is. Can you provide more information? A number of input and expected output examples would be useful - especially at least one that is "right" and one that is "wrong".

Rick

"AK" <newal (AT) rugwho (DOT) com> wrote

Quote:
Hello

I have a program that creates a pattern of data into a var and then it
sends that var to an alte file.

Sometimes, the line for a company would be broken to multiple lines.
So, "MICROSOFT, INC" would turn to be:
"Microsoft,
Inc."



Code example:

locate ???
set alte to jj
set alte on
do whille found()
outline = ""
out_line = outline + "13,"+comp_name
out_line = outline + "14,"+comp_adrs1
.
.
etc...
? outline
cont
enddo
set alte off
set alte to


Any ideas?

Thanks,
AK


Reply With Quote
  #3  
Old   
AK
 
Posts: n/a

Default Re: Line breaks out of nowhere in VFP6... - 06-08-2004 , 12:22 PM



Rick;

I'm basically generating a file that is to be read by Fedex. The file
structure is kinda funny, but again, the result is that sometimes
lines would be cut in the middle.

Example of 'Right':
0,"020"1,"AFTID1"12,"MALOOLY'S CARPET CITY"
Turns to be (Wrong):
0,"020"1,"AFTID1"12,"MALOOLY'S CARPET
CITY"

Again, thi happens to SOME of the records, and some others are just
fine.

And again, all the code does is to 'push' the different fields into
one var and then use a ? command to send it to the alternate file.

I just can't figure out why SOMETIMES the stram of data is broken with
a newline...

Thanks for your help,

AK


On Tue, 8 Jun 2004 09:23:32 -0400, "Rick Bean"
<rgbean (AT) NOSPAMmelange-inc (DOT) com> wrote:

Quote:
AK,
I'm not sure what your question or problem is. Can you provide more information? A number of input and expected output examples would be useful - especially at least one that is "right" and one that is "wrong".

Rick

"AK" <newal (AT) rugwho (DOT) com> wrote

Hello

I have a program that creates a pattern of data into a var and then it
sends that var to an alte file.

Sometimes, the line for a company would be broken to multiple lines.
So, "MICROSOFT, INC" would turn to be:
"Microsoft,
Inc."



Code example:

locate ???
set alte to jj
set alte on
do whille found()
outline = ""
out_line = outline + "13,"+comp_name
out_line = outline + "14,"+comp_adrs1
.
.
etc...
? outline
cont
enddo
set alte off
set alte to


Any ideas?

Thanks,
AK



Reply With Quote
  #4  
Old   
Rick Bean
 
Posts: n/a

Default Re: Line breaks out of nowhere in VFP6... - 06-08-2004 , 04:57 PM



AK,
I guess that I'd start by not using the "obsolete" xBase code that "prints" to an alternate file. How about trying:
locate ???
*set alte to jj
*set alte on
IF FILE("JJ")
ERASE JJ
ENDIF
do while found()
outline = ""
outline = outline + "13,"+comp_name
outline = outline + "14,"+comp_adrs1

Reply With Quote
  #5  
Old   
AK
 
Posts: n/a

Default Re: Line breaks out of nowhere in VFP6... - 06-08-2004 , 05:55 PM



Thanks Rick. It may work. One other option is to use low level IO to
write to the text file.
I was just wondering if anyone has an idea why VFP would pop a CR/LF
at seemingly random places in the file...

Thanks,

AK

On Tue, 8 Jun 2004 17:57:09 -0400, "Rick Bean"
<rgbean (AT) NOSPAMmelange-inc (DOT) com> wrote:

Quote:
AK,
I guess that I'd start by not using the "obsolete" xBase code that "prints" to an alternate file. How about trying:
locate ???
*set alte to jj
*set alte on
IF FILE("JJ")
ERASE JJ
ENDIF
do while found()
outline = ""
outline = outline + "13,"+comp_name
outline = outline + "14,"+comp_adrs1
.
.
etc...
*? outline
outline = outline + chr(13) && +chr(10) ??
strtofile(out_line,"JJ", .T.)
cont
enddo
*set alte off
*set alte to

Or, unless the file gets real big, or you have limited memory, don't bother clearing 'outline' in the loop, and just create one big string (it can get as big as 16MB), and write it once at the end (saving IOs!).

Rick

"AK" <newal (AT) rugwho (DOT) com> wrote

Rick;

I'm basically generating a file that is to be read by Fedex. The file
structure is kinda funny, but again, the result is that sometimes
lines would be cut in the middle.

Example of 'Right':
0,"020"1,"AFTID1"12,"MALOOLY'S CARPET CITY"
Turns to be (Wrong):
0,"020"1,"AFTID1"12,"MALOOLY'S CARPET
CITY"

Again, thi happens to SOME of the records, and some others are just
fine.

And again, all the code does is to 'push' the different fields into
one var and then use a ? command to send it to the alternate file.

I just can't figure out why SOMETIMES the stram of data is broken with
a newline...

Thanks for your help,

AK


On Tue, 8 Jun 2004 09:23:32 -0400, "Rick Bean"
rgbean (AT) NOSPAMmelange-inc (DOT) com> wrote:

AK,
I'm not sure what your question or problem is. Can you provide more information? A number of input and expected output examples would be useful - especially at least one that is "right" and one that is "wrong".

Rick

"AK" <newal (AT) rugwho (DOT) com> wrote

Hello

I have a program that creates a pattern of data into a var and then it
sends that var to an alte file.

Sometimes, the line for a company would be broken to multiple lines.
So, "MICROSOFT, INC" would turn to be:
"Microsoft,
Inc."



Code example:

locate ???
set alte to jj
set alte on
do whille found()
outline = ""
out_line = outline + "13,"+comp_name
out_line = outline + "14,"+comp_adrs1
.
.
etc...
? outline
cont
enddo
set alte off
set alte to


Any ideas?

Thanks,
AK




Reply With Quote
  #6  
Old   
Rick Bean
 
Posts: n/a

Default Re: Line breaks out of nowhere in VFP6... - 06-09-2004 , 08:24 AM



AK,
I guess I was too subtle - I'd assume that in the old backward compatible xBase code handling for alternates and ? output, there were requirements about max line lengths, or "hidden" buffers that need to be flushed with extra characters. My VFP code doesn't have any "secret" add-in code, so it should work as expected.

Rick

"AK" <newal (AT) rugwho (DOT) com> wrote

Quote:
Thanks Rick. It may work. One other option is to use low level IO to
write to the text file.
I was just wondering if anyone has an idea why VFP would pop a CR/LF
at seemingly random places in the file...

Thanks,

AK

On Tue, 8 Jun 2004 17:57:09 -0400, "Rick Bean"
rgbean (AT) NOSPAMmelange-inc (DOT) com> wrote:

AK,
I guess that I'd start by not using the "obsolete" xBase code that "prints" to an alternate file. How about trying:
locate ???
*set alte to jj
*set alte on
IF FILE("JJ")
ERASE JJ
ENDIF
do while found()
outline = ""
outline = outline + "13,"+comp_name
outline = outline + "14,"+comp_adrs1
.
.
etc...
*? outline
outline = outline + chr(13) && +chr(10) ??
strtofile(out_line,"JJ", .T.)
cont
enddo
*set alte off
*set alte to

Or, unless the file gets real big, or you have limited memory, don't bother clearing 'outline' in the loop, and just create one big string (it can get as big as 16MB), and write it once at the end (saving IOs!).

Rick

"AK" <newal (AT) rugwho (DOT) com> wrote

Rick;

I'm basically generating a file that is to be read by Fedex. The file
structure is kinda funny, but again, the result is that sometimes
lines would be cut in the middle.

Example of 'Right':
0,"020"1,"AFTID1"12,"MALOOLY'S CARPET CITY"
Turns to be (Wrong):
0,"020"1,"AFTID1"12,"MALOOLY'S CARPET
CITY"

Again, thi happens to SOME of the records, and some others are just
fine.

And again, all the code does is to 'push' the different fields into
one var and then use a ? command to send it to the alternate file.

I just can't figure out why SOMETIMES the stram of data is broken with
a newline...

Thanks for your help,

AK


On Tue, 8 Jun 2004 09:23:32 -0400, "Rick Bean"
rgbean (AT) NOSPAMmelange-inc (DOT) com> wrote:

AK,
I'm not sure what your question or problem is. Can you provide more information? A number of input and expected output examples would be useful - especially at least one that is "right" and one that is "wrong".

Rick

"AK" <newal (AT) rugwho (DOT) com> wrote

Hello

I have a program that creates a pattern of data into a var and then it
sends that var to an alte file.

Sometimes, the line for a company would be broken to multiple lines.
So, "MICROSOFT, INC" would turn to be:
"Microsoft,
Inc."



Code example:

locate ???
set alte to jj
set alte on
do whille found()
outline = ""
out_line = outline + "13,"+comp_name
out_line = outline + "14,"+comp_adrs1
.
.
etc...
? outline
cont
enddo
set alte off
set alte to


Any ideas?

Thanks,
AK




Reply With Quote
  #7  
Old   
AK
 
Posts: n/a

Default Re: Line breaks out of nowhere in VFP6... - 06-10-2004 , 06:56 PM



Rick;

Thanks for your help. I used the strtofile command and it works
perfectly.

Thanks again,

AK

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.