This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C24793.3E8B5B00 Content-Type: text/plain; charset="iso-8859-1" Note that fields which may/may not be quoted will require some additional work. (See sample code from a program I wrote last week) ; d-DELIM-03 points to the comma that terminated the previous field. Define d-DELIM-04 & = d-DELIM-03 + 1 & If d-DATA[(d-DELIM-03 + 1):1] = '"' & Else d-DELIM-03 Define d-DELIM-05 & = Index(d-DATA[d-DELIM-04 + 1:512],'"') + d-DELIM-04 & If d-DELIM-03 <> d-DELIM-04 & Else Index(d-DATA[d-DELIM-04 + 1:512],",") + d-DELIM-04 Define d-DELIM-06 & = d-DELIM-05 + 1 & If d-DATA[d-DELIM-05:1] = '"' & Else d-DELIM-05 Define d-ITEM-NAME Character *80 & = Pack(d-DATA[(d-DELIM-04 + 1):(d-DELIM-05 - d-DELIM-04 - 1)]) regards, Robert W.Mills Systems Development Manager Windsong Services george.j.wen@us.abb.com wrote: > If your file has more than a small amount of records QTP can be a > real hog for this process but Quiz does a good job. It's quite > simple actually, once you get the hang of it. You use "relative > indexing" where you scan for the delimiter for each field. For > example let's say you want name, > addr, city out of a file. You'll have transferred your file to a > subfile that has one large field in it that's > large enough to hold the longest record of your file. Let's call the > file TRANSFER-FILE and the field WORK-FIELD. Then in Quiz you'll do > something like the following: Access TRANSFER-FILE > def I1 = index(WORK-FIELD,",") ;*** fine the delimiter > (comma in this case) def NAME char*40 = WORK-FIELD[1:I1 - 1] ;*** > byte 1 through the index - 1 def WORK-FIELD-2 char*nnn = > WORK-FIELD[I1 + 1:nnn - I1] ;***redefine the rest of work-field so > you can start the process over > ;nnn is the length of work-field def I2 = index(WORK-FIELD-2,","] > ;*** index the new work field for the next field in the file > def ADDR char*40 = WORK-FIELD-2[1:I2 - 1] ;*** def the next field > def WORK-FIELD-3 char*nnn = WORK-FIELD-2[I2 + 1:nnn - I2] ;*** > start process again as in WORK-FIELD-2 > > def I3 = index(WORK-FIELD-3,",") > def CITY char*25 = WORK-FIELD-2[1:I3 - 1] > and so on...................... > > Report Summary NAME ADDR CITY > Set Subfile > Name.................................................................... etc. > > > hope this helps. It works well and fast in Quiz - even for a large > file > > >> ----------> >> | >> ----------> > >> --------------------------------------------------------------------| | | > >> --------------------------------------------------------------------| > > > > > > > Arnone, Anthony wrote: > I have a comma Delimited file and I need to read it in Quiz and break > out each individual field. The Record looks like this: > > 099000,00172,02,07,01,800 > > I am not exactly sure what is the best and easiest way to accomplish > this. > > > Anthony > > > > > > > > = = = = = = = = = = = = = = = = = = = = = = = = = = = = > Mailing list: powerh-l@lists.swau.edu > Subscribe: "subscribe" in message body to > powerh-l-request@lists.swau.edu Unsubscribe: "unsubscribe" in message > body to powerh-l-request@lists.swau.edu > http://lists.swau.edu/mailman/listinfo/powerh-l This list is closed, > thus to post to the list you must be a subscriber. ------_=_NextPart_001_01C24793.3E8B5B00 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">RE: delimited File Note that fields which may/may not be quoted will = require some additional work.
(See sample code from a program I wrote last = week); d-DELIM-03 points to the comma that terminated the = previous field.
Define = d-DELIM-04 &n= bsp; &n= bsp; &n= bsp; &n= bsp; &
=3D d-DELIM-03 + = 1  = ;  = ;  = ; &
If = d-DATA[(d-DELIM-03 + 1):1] =3D = '"' &nbs= p; = &
Else d-DELIM-03Define = d-DELIM-05 &n= bsp; &n= bsp; &n= bsp; &n= bsp; &
=3D Index(d-DATA[d-DELIM-04 = + 1:512],'"') + = d-DELIM-04 = &
If = d-DELIM-03 <> = d-DELIM-04 &n= bsp; &n= bsp; &
Else Index(d-DATA[d-DELIM-04 + = 1:512],",") + d-DELIM-04Define = d-DELIM-06 &n= bsp; &n= bsp; &n= bsp; &n= bsp; &
=3D d-DELIM-05 + = 1  = ;  = ;  = ; &
If = d-DATA[d-DELIM-05:1] =3D = '"' &nbs= p; &nbs= p; &
Else d-DELIM-05Define = d-ITEM-NAME = Character = *80 &nb= sp; &nb= sp; &
=3D Pack(d-DATA[(d-DELIM-04 = + 1):(d-DELIM-05 - d-DELIM-04 - 1)])regards,
Robert W.Mills
Systems Development Manager
Windsong Services
george.j.wen@us.abb.com wrote:
> If your file has more than a small amount of = records QTP can be a
> real hog for this process but Quiz does a good = job. It's quite
> simple actually, once you get the hang of = it. You use "relative
> indexing" where you scan for the delimiter = for each field. For
> example let's say you want name,
> addr, city out of a file. You'll have = transferred your file to a
> subfile that has one large field in it = that's
> large enough to hold the longest record of your = file. Let's call the
> file TRANSFER-FILE and the field = WORK-FIELD. Then in Quiz you'll do
> something like the following: Access = TRANSFER-FILE
> def I1 =3D = index(WORK-FIELD,",")  = ; ;*** fine the = delimiter
> (comma in this case) def NAME char*40 =3D = WORK-FIELD[1:I1 - 1] ;***
> byte 1 through the index - 1 def WORK-FIELD-2 = char*nnn =3D
> WORK-FIELD[I1 + 1:nnn - I1] ;***redefine the = rest of work-field so
> you can start the process = over &n= bsp; &n= bsp; &n= bsp;
> ;nnn is the length of work-field def I2 =3D = index(WORK-FIELD-2,","]
> ;*** index the new work field for the next = field in the file
> def ADDR char*40 =3D WORK-FIELD-2[1:I2 - = 1] ;*** def the next field
> def WORK-FIELD-3 char*nnn =3D WORK-FIELD-2[I2 + = 1:nnn - I2] ;***
> start process again as in WORK-FIELD-2
>
> def I3 =3D = index(WORK-FIELD-3,",")
> def CITY char*25 =3D WORK-FIELD-2[1:I3 - = 1]
> and so on......................
>
> Report Summary NAME ADDR CITY
> Set Subfile
> = Name....................................................................= etc.
>
>
> hope this helps. It works well and fast = in Quiz - even for a large
> file
>
>
>> ---------->
>> = |
>> ---------->
>
>> = --------------------------------------------------------------------|&nb= sp; = |  = ;  = ;  = ;  = ;  = ; |>
>> --------------------------------------------= ------------------------|
>
>
>
>
>
>
>Arnone, Anthony wrote:
------_=_NextPart_001_01C24793.3E8B5B00--
> I have a comma Delimited file and I need to = read it in Quiz and break
> out each individual field. The Record looks = like this:
>
> 099000,00172,02,07,01,800
>
> I am not exactly sure what is the best and = easiest way to accomplish
> this.
>
>
>  = ; Anthony
>
>
>
>
>
>
>
> =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D = =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D
> Mailing list: powerh-l@lists.swau.edu
> Subscribe: "subscribe" in message = body to
> powerh-l-request@lists.swau.edu Unsubscribe: = "unsubscribe" in message
> body to powerh-l-request@lists.swau.edu
> http://lists.swau.edu/mailman/listinfo/powerh-l = This list is closed,
> thus to post to the list you must be a = subscriber.