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!

Pipe Delimited File - Export without commas

Status
Not open for further replies.

EBOUGHEY

Programmer
Aug 20, 2002
143
0
0
US

I am trying to export a file pipe delimited without the commas between each record.

Example of how the record should look

DP|22780|BRENNER ||RUTH||DOE||RUTH DOE|41 DOE RD||POWER CITY|PA|19980|9446|41|7|||||||OL|NINETY-EIGHT|1995||||C||64830-2|2|6678057525|5A

Example of how it is exporting now:

|DP|,|10003028|,|PRESTIGE FORD|,|MS|,|JUDITH|,|A|,|DOE|,||,|JUDITH A DOE|,|33 N DOE AVE|,||,|ANYCITY|,|FL|,|39703|,|4201|,|33|,|2|,|407|,||,||,||,0.00000000,||,||,||,||,||,||,||,|POLK|,|21-U1=GA|,|65297-3|,|3|,|6804118992|,|7A|


Thanks for any help!

Elena


 
hey there Elena--

try STRTRAN(outstr,",",SPACE(0)).. that'll replace all commas with nothing..

and it also looks like you're dropping the first and last pipes? you could do that with a SUBSTR()..

HTH
-- frank~
 
I'm exporting directly from a foxpro table. The example I dropped in is the end result when I type in

copy to filename.txt deli with | or
export to filename.txt type deli with |

Is there a command to export directly to the file without it calling the commas in between the fields?
 
I would follow Dave Summers' advice from thread184-1072294.
Code:
nHandle = FCREATE('textfile.txt')  &&... create & overwrite
IF nHandle < 0
   *... some sort of error stuff here
   RETURN
ENDIF
USE MyTable
SCAN   &&... skip through each record of .dbf
   STORE '' TO cNewRec
   *... if account is numeric:
   cNewRec = cNewRec + PADL(ALLTRIM(STR(ACCOUNT)), 20, '0') + '|'
   *... if record is numeric:
   cNewRec = cNewRec + PADL(ALLTRIM(STR(RECORD)),  7, '0') + '|'
   .
   .finish creating record
   .
   FPUTS(nHandle, cNewRec)  &&... write record with CR/LF
ENDSCAN
FCLOSE(nHandle)
(I only added the pipe delimiter).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top