![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
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 |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
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 |
#6
| |||
| |||
|
|
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 |
#7
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |