Converting Delimited Files (Pickering, John (NORBORD))
Latimer, Richard
richard.latimer@airways.co.nz
Wed, 14 Nov 2001 11:40:46 +1300
agreed ! !
I have extended John's code to have 26 variables and it worked all right for
me (PH6.07e on AS/400):
Total number of formats . . . . . . . . . . : 1
Total number of fields . . . . . . . . . . . : 52
Total record length . . . . . . . . . . . . : 10426
In the context of what Karen wanted to do I think that QTP is the better
option since the techniques described aren't usable in Quiz (no temps).
Thinking back to my attempts in October we tried cascading defines first and
although Quiz was much faster than QTP the eventual solution was even faster
again.
cheers
Richard Latimer
-----Original Message-----
From: Pickering, John (NORBORD) [mailto:PICKERIJ@norbord.com]
Sent: Wednesday, 14 November 2001 8:33 a.m.
To: 'Powerhouse List'
Subject: RE: Converting Delimited Files (Pickering, John (NORBORD))
Why not????
/quiz
Q U I Z (PowerHouse 8.19.C4)
Copyright 1999 COGNOS INCORPORATED
Norbord Industries Inc.
> define d-a char*400 = ""
> define d-b char*400 = ""
> define d-c char*400 = ""
> define d-d char*400 = ""
> set subfile name sf1
> report summary all
> go
Records selected: 0
Records written: 1
> :listftemp sf1,2
TEMPORARY FILES FOR MANAGER.NORBORD,JWP
ACCOUNT= NORBORD GROUP= JWP
FILENAME CODE ------------LOGICAL RECORD----------- ----SPACE----
SIZE TYP EOF LIMIT R/B SECTORS #X MX
SF1 644 1600B FA 1 100 4 256 1 26 (TEMP)
>
> -----Original Message-----
> From: Karen Barrett [SMTP:kbarrett@denkor.com]
> Sent: Tuesday, November 13, 2001 2:22 PM
> To: Pickering, John (NORBORD)
> Subject: RE: Converting Delimited Files (Pickering, John (NORBORD))
>
> Yes, but it can't output a 1350 byte subfile. Sorry for not being clearer.
>
> -----Original Message-----
> From: Pickering, John (NORBORD) [mailto:PICKERIJ@norbord.com]
> Sent: Tuesday, November 13, 2001 11:15 AM
> To: 'kbarrett@denkor.com'; PowerhouseList
> Subject: RE: Converting Delimited Files (Pickering, John (NORBORD))
>
>
> And another thing!
>
> Why do you say that your input file was "way too wide" for Quiz? Quiz
> should
> be able to read any file that Qtp can read.
>
> > -----Original Message-----
> > From: Karen Barrett [SMTP:kbarrett@denkor.com]
> > Sent: Tuesday, November 13, 2001 1:55 PM
> > To: PowerhouseList
> > Subject: RE:Converting Delimited Files (Pickering, John (NORBORD))
> >
> > John's example also contains the principles that lead to a nice clean
> > solution -
> > Use temp/item and increment the position variable t_pos = t_pos + length
> > of
> > prior element
> > for each possible element in the record input file.
> > Quiz was not an option as my input file was WAY too wide.
> >
> > Karen Barrett
> > Denkor Dental Management Corp.
> > ;--------
> >
> > From: "Pickering, John (NORBORD)" <PICKERIJ@norbord.com>
> > To: powerh-l@lists.swau.edu
> > Subject: RE: Converting Delimited Files
> > Date: 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
> >
> >
> >
> >
> > = = = = = = = = = = = = = = = = = = = = = = = = = = = =
> > 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.
= = = = = = = = = = = = = = = = = = = = = = = = = = = =
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.
**********************************************************************
This electronic message together with any attachments is confidential. If
you receive it in error: (i) you must not use, disclose, copy or retain
it; (ii) please contact the sender immediately by reply email and then
delete the emails. Views expressed in this email may not be those of the
Airways Corporation of New Zealand Limited
**********************************************************************