home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Archive Magazine 1996
/
ARCHIVE_96.iso
/
discs
/
gerald
/
6_06
/
PipeEdit
/
ReadMe
< prev
next >
Wrap
Text File
|
1993-01-14
|
5KB
|
147 lines
%OP%VS4.13 (28-Apr-92), Gerald L Fitton, R4000 5966 9904 9938
%OP%DP0
%OP%IRY
%OP%PL0
%OP%HM0
%OP%FM0
%OP%BM0
%OP%LM4
%OP%PT1
%OP%PDPipeLine
%OP%WC1014,2262,44,1748,0,0,0,0
%CO:A,72,72%
%C%Database Manipulation
%C%by Gerald L Fitton
Keywords:
Database King Brown Snow Fitton
Roger King's Database Problem
DataBase
Roger King has written to me with a problem which involves changing the
format of a database. He has a number of records in a format similar
to the one below (four columns) with one record per row:
ColáAááColáBááColáCááColáD
What he wants to do is to change it to a format which uses two rows per
record but with only three columns:
ColáAááColáBááColáD
ColáC
Roger does not want to type all the records again but wants way of
transferring the data from his 'old' database to the new one. I have a
very messy solution which uses a lot of memory using the index(,,)
function. We would welcome a simpler solution. Please write to me if
you have any ideas.
Bruce D Brown Replies
I think the easiest solution is to use that wonderful, underrated
programme which comes with every Acorn machine i.e !Edit.
I've put files giving a blow by blow account of the process on the
disc. You can see the basic procedure is to use the facilities of
PipeDream to get the data into a form such that the search & replace
facilities of Edit can be used to give the desired result.
The order of reading the files is fairly obvious ie
Original
Step 1
Step 2
Step 3
Step 4
Yipee!
I routinely use this sort of approach to solve all sorts of data
manipulation problems, often with MSDOS files. The principles to
remember are:
1. Nearly all databases and wordprocessors can export data as ASCII.
(CSV is also very useful when numbers and text are involved.)
2. PipeDream is marvellous for getting tabbed ASCII files into columns
which allows the order of the data, both fields and records, to be
changed at will using block moves and sorts.
3. Virtually any search and replace operation can be carried out in
Edit. This applies particularly to RISCOS 3 Edit and SrceEdit which
have the more versatile Wildcard option as well as Magic characters.
Hope the above information helps Roger and maybe shines a little light
on that great double act, "PD/Edit - the data manipulators".
9th January 1993
Howard Snow replies to the problem in a similar way.
I read with interest the problem being experienced by Roger King. It
seems to me that there is no real difficulty in performing the
conversion that Roger wants, provided that he does not restrict himself
to using only PipeDream during the conversion. The Archimedes has some
very powerful utilities built-in, and they can complement PipeDream in
many ways.
The procedure to follow is detailed below.
[You can use the same database called [Original] - GLF]
PROCEDURE
1. Load the database file into PipeDream.
2. Ensure that !Edit is loaded onto the icon bar.
3. Save the database file as an ASCII file directly onto the !Edit
icon. (Note: it is necessary to use LF as the line separator
when saving the ASCII file.)
4. Press f4 (Find Text), and select Magic Characters. Enter \x0A as
the 'Find' string, and \x0A\x0A as the 'Replace with' string.
Select 'GO'.
5. When the 'Text found' box appears, select 'End of File Replace'.
When the search has completed, select 'Stop'.
6. Press f3 (Save) and drag the 'save file' icon direct onto the
PipeDream icon on the icon bar.
7. Double-click on the 'Convert' command file on the disc.
This produces a file in the format requested by Roger. The procedure
assumes that the database file is not so big that a number of copies
cannot be held in memory at the same time. If it is too big, then it
will be necessary to save the intermediate steps to disc (steps 3á&á6),
and close the original files as appropriate. Then load the saved files
into !Edit (prior to step 4) or to PipeDream (prior to step 7).
The fundamental part of the Convert command file is on lines 7-12,
where it examines the database file after modification in !Edit, and if
it finds it is working in a blank line, it brings down the Column C
entry from the previous line. This process is then replicated down for
the entire database.
Once the new columns (EátoáG) have been entered, the command file
converts these to a 'snapshot' (\BSS) and then deletes the original
four columns, leaving the new structure intact.
Howard Snow
31 Grizebeck Drive
Allesley
Coventry
CV5 7PL
10 January 1993
Fax-Phone : 0 203 405109