[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Reading from a flat file and writing to another flat file
- Subject: Reading from a flat file and writing to another flat file
- From: Joe Johnson <jej1216@HOTMAIL.COM>
- Date: Fri, 21 Jul 2000 16:32:33 CDT
I want to write an SQR to extract phone contact data from a text file, with
the values delimited by a ';' and to create an XML file.
Text file has something like this:
Baker, Ron;972-972-9729;972-972-7297;;9727927@skytel.com;1200
etc
The XML file must look like this:
<PH>
<EMPLOYEE>Baker, Ron</EMPLOYEE>
<HOME_PHONE>972-972-9729</HOME_PHONE>
<PAGER>972-972-7297</PAGER>
<CELL></CELL>
<PAGER_EMAIL>9727927@skytel.com</PAGER_EMAIL>
<WORK_EXT>1200</WORK_EXT>
</PH>
etc
There will also be some other tags in the XML file, but my question is this:
Will I need to create an array or temporary table in a database to extract
the data from the text file, or can I directly read the data from the text
file and then write it to the XML file?
I'm hoping to do something like:
Open 'a:\phonelis.txt' as 1 For-Reading Record=100
Do Read-Input-File
!which would unstring the data into
! $NAME
! $HOME_PHONE
! $PAGER
! $CELL
! $PAGER_EMAIL
! $EXT
!and then
Open 'a:\Phonelis.xml' as 1 For-Writing Record=100
DO Create-XML-File
! which would do something like:
!Write 1 From
! '<PH>'
! '<EMPLOYEE>'$NAME'</EMPLOYEE>'
! '<HOME_PHONE>'$HOME_PHONE'</HOME_PHONE>'
! '<PAGER>'$PAGER'</PAGER>'
! '<CELL>'$CELL'</CELL>'
! '<PAGER_EMAIL>'$PAGER_EMAIL'</PAGER_EMAIL>'
! '<WORK_EXT>'$EXT'</WORK_EXT>'
! '</PH>
Does this ROUGH outline look like it would work?
Thanks in advance!
Joe Johnson
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com