Converting Delimited Files
Pickering, John (NORBORD)
PICKERIJ@norbord.com
Mon, 12 Nov 2001 12:49:57 -0500
Qtp can be just as fast. But not if you use a series of 27 cascading DEFINE
statements to extract the 27 tab delimited fields. It will be far more
efficient to use a series of TEMPorary items and ITEM statements to do this.
Something like:
global temp t_09 int*2 initial 09
global temp t_tab char*1 initial char(t_09)[2:1] ; adjust for your os
request dismantle
access tab_delim_file
temp t_pos int*3 ; position of tab in work field
temp t_work char*200 ; as big as the record in tab_delim_file
item t_work = lj(record of tab_delim_file)
temp t_field_1 char*10 ; first column, adjust type and size to suit
item t_pos = index(t-work,t_tab)
item t_field_1 = t_work[1:t_pos - 1]
item t_work = lj(t_work[t_pos + 1 :200])
Repeat the last 4 statements for the rest of the 27 fields. The only wrinkle
is handing the last column since not all tab delimited files will put a tab
after the rightmost column. If the last column is numeric then you can use a
space in the INDEX function. If the last column is character and may contain
spaces then about the best you can do is simply take as much of the work
field as will fit in the item.
Regards,
JWP
> -----Original Message-----
> From: george.j.wen@us.abb.com [SMTP:george.j.wen@us.abb.com]
> Sent: Monday, November 12, 2001 11:59 AM
> To: powerh-l@lists.swau.edu
> Subject: RE: Converting Delimited Files
>
>
>
> I've done this many times using the indexing technique. Yes, QTP is much,
> much
> slower. Use Quiz, cut your defines down to a few as possible. I had an 8
> hour
> QTP
> run reduced to 5 minutes when I first worked with this method.
>
> Good luck.
>
>