home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
database
/
datamage.zip
/
DOCS.ZIP
/
COPY.DOC
< prev
next >
Wrap
Text File
|
1991-02-09
|
16KB
|
335 lines
POWER COPY PROGRAM
The copy program moves selected data from selected records in a selected file
in a specified manner into selected records in another selected file. Another
way of looking at it is that it does inter-file updates.
Like the BASE programs, it is a tool to do many different tasks. It will
expand a datafile to include more data, create a fragment of a file, post
transactions into a file, merge one or more files into another file, and will
create records in the target file during execution.
There are two basic kinds of operations executed by POWER COPY:
FILE CREATION OPERATIONS
FILE REORGANIZATION:
Probably the most frequent use of POWER COPY is to move data from one format to
another. To re-organize a file you first use the DBSEMAKR program to load the
current format of the file and edit it.
Just before you save the new format it's handy to print the new format. You'll
have a nice list of the fields in the new file. As you remove the printout
from your printer mark it NEW. Then save the new file format.
To get a list of the fields in the current file load it with the BASE program
then press F-3. Make the printout OLD.
Next, it's necessary to get the data into the new format by using the POWER
COPY program to move it between the files. Should anything go wrong during the
process or the new file be found lacking in some manner the old file remains in
tact. You get to examine the new file before deleting the old.
To perform a reorganization start POWER COPY and select the old file as the
first SOURCE file, and the new formatted, empty file as the second TARGET file.
Your speaker will inform you that the target file has no records and ask your
approval, it's OK. Since the target file has no records much of the POWER COPY
program will be skipped over, and your next task will be to identify the source
and target fields. Opt for pairing by absolute field numbers. The program
will find any fields you moved, re-named or re-sized.
After the program performs automatic segment pairing you will browse the move
pairs. You have full editing capabilities. You may edit existing moves,
delete moves, add moves. Looking at your lists, edit the move pairs until you
get your fields going where you wish.
Then, press F-9 to execute the inter-file update.
FILE FRAGMENTATION:
There are many reasons you might want a datafile containing certain records
from another datafile. They are the same reasons you might want a printout
detailing certain records in a datafile.
You have some customers that are behind on they're accounts. Sally can call
them, and chat them up. She has a computer on her desk and a DATAMAGE. She
can use the file fragment as a basis for her calls better than a printout.
To make a file fragment you first need to identify the records to be included.
The BASE program offers the means to do this: The select records and
calculation routines. After you have your group write it into a MARKER FILE by
pressing F-10. This records the group to disk.
Then exit the system to prepare a place for the file fragment. Place a blank
floppy in A:. Enter MD A:FRAG (or whatever). Then, assuming your source file
is C:\MAGE\FILE1, enter COPY C:\MAGE\FILE1\*.SAD A:\FRAG. You copied the
definition files into the FRAG directory on A:, effectively creating an empty
DATAMAGE file.
Start the DATAMAGE system and select POWER COPY from the first menu. Select
your source file as C:\MAGE\FILE1. When prompted for the target file press
escape, then enter A:, and select FRAG from the menu.
Opt to move data from records in a marker file and select the marker you just
made from the menu. You will see the segment pairing screen. Since you have
not edited the file's format option 2, automatic segment pairing is bound to
find all the fields in both files. When you see the browse display of the
segment pairs just press F-9, no need to check them.
PACKING DATAFILES:
DATAMAGE files never get any smaller. When records are deleted holes open up
in the file. The programs will fill these holes before allocating more disk
space for the file. In the case of a file with many holes the index search,
select records and calculation routines are slowed by having to jump over all
the holes and disk space is wasted.
Packing datafiles also offers an opportunity to order the records however we
wish. By using the BASE program to order the records, writing a marker file,
then opting to use that marker file while transferring the records with POWER
COPY we can place the current records in the new file in whatever order we
like. This comes in handy.
To pack a datafile you make another directory to hold the new file. Say your
old file was C:\MAGE\FILE1. You might make a directory on a floppy called
junk. Then you enter COPY C:\MAGE\FILE1\*.SAD A:JUNK. This copies the
definition files into your directory, and effectively makes an empty DATAMAGE
file on the floppy.
Start POWER COPY and select your old file in C:\MAGE\FILE1 as the source file.
When prompted for the target file press escape, then enter A:. Select the JUNK
dir you just made. The speaker will beep and you will be informed that the
target file has no records, that's OK.
You will see the segment pairing screen. Since you have not edited the file's
format option 2, automatic segment pairing is bound to find all the fields in
both files. When you see the browse display of the segment pairs just press F-
9, no need to check them.
The data is transferred to the floppy and a new index is built. If any records
should fail the index check error messages will print and the record will not
be brought into the new file.
After the POWER COPY program ends load the new file with the BASE program and
verify it by looking at the first, last and middle records. If the file is OK
then delete C:\MAGE\FILE1\*.RAD. Then COPY A:\JUNK\*.RAD C:\MAGE\FILE1.
MOVING DATA BETWEEN TWO FILES
The task of moving data from any file, to any file (provided they have
something in common) consists of four steps:
1. Identify the source and target files.
The files are selected in the same manner as the BASE programs, and you may
opt to move data from the records contained in a MARKER file created by the
base programs, or all records in the source file.
2. Identify the record pairs.
The record pairs can be entered from the keyboard, or automatically found.
3. Identify the data to be moved, and the format to be used.
If you are moving string data you may replace the current data recorded, if
any, with the value being moved, or append that value to the current value
stored in the target record.
If you are moving numeric data, you may add, subtract, multiply, divide,
or replace the data now stored, if any. If you divide, and there is a zero in
the source field ALL DATA TRANSFER within that record pair will be aborted, and
an error message will be written to the printer.
4. Execute the inter-file update.
The screen will be active during execution, and tell you what's going on.
Since numbers 1 and 4 above are fairly self-explanatory, the two sections to
follow describe number 2, IDENTIFY RECORD PAIRS, and number 3, IDENTIFY MOVE
DATA in more detail.
RECORD PAIR IDENTIFICATION:
The record pairs are a source record and a target record. Some or all of the
data in the source record will be moved into the target record. The records in
the source and target files may be matched in several ways.
Automatic record pair definition can be done by the program. The basis of the
pairs can be the user-assigned record numbers, or the content of a field in the
source record, and the matching content of a field in a target record.
In the case of using record numbers the records in the source file would be
matched to a record in the target file by their record numbers and data would
be moved between records of the same number.
When records are matched by the content of a field the specified field in the
source record is searched for in the specified field in the target file.
Multiple matches may be found, i.e. more than one source record bears the
number of a target record in the specified field.
SELECTING THE DATA TO MOVE:
Once you have your record pairs like you want them, opt to continue the process
and select the data to be moved from the source records into the target
records. Again, you may enter the segment pairings, or the program will find
fields of the same absolute record number and align them for you.
If you are moving numeric data you may include the operation to be done in the
source records. The source file would include a numeric field to be tested in
each record, and action taken according to its' content.
The copy program refers to such a field as a TEST field. You could use a test
field to connote whether a record represented a receipt of stock, or an order
filled from stock. The former would require the amount to be added to the
current balance, and the latter that it be subtracted.
The test filed must hold a code, 1 through 5. 1=add, 2=subt, 3=mult, 4=divide
and 5=replace. So, the copy program could deal with a file containing
receipts, orders filled, and manual inventory adjustments. What you would use
multiply and divide for I don't know, but they're there if you think something
up to use them for!
You can BROWSE and edit the moves before execution. When you have the data
going where you want, execute the move.
ERROR TRAPPING
The copy program can catch errors in the source and target files, and alert you
to their presence before executing the inter-file update. To do this it finds
DUPLICATIONS in the source, target, or both datafiles.
Suppose we were moving data from a batch of stock receipts to our inventory
file. On a floppy, we have a group of records, each representing something we
got, checked, and put in stock. Maybe this floppy is for the first week in
March, or whatever. All week, when something came in, somebody recorded it
onto a floppy in a computer downstairs.
In this case, the copy program would be directed to match records in the source
file (the floppy) and records on the HD (the inventory file) by the contents of
the fields that held our part number.
Duplicates in the source records would not constitute an error, because we
might well have received more than one shipment of a part in the same week.
Duplicates in the TARGET file, however, would constitute a serious error.
So, we would direct the program to process all record pairs containing a
duplicated target as errors: to ignore them and list them to the printer.
Many scenarios exist where duplicates in th source file would constitute
errors, duplicates in either file would be an error, or dupes in both files
would be OK.
So, the copy program will detect, ignore and list source, target, both or no
dupes during the automatic record pairing process.
After record pairing is accomplished, the program allows BROWSING of the pairs
found, source records finding no match, target records not accessed by a move,
and the entire source or target file. You may find pairs the computer didn't
and add them, or you may delete/edit record pairs the computer did find.
Or, you may opt to end power copy. Presumably to make corrections in the
files, or if you were just checking their alignment on the screen.
RUN-TIME ERRORS:
During the execution of the inter-base update, several conditions can cause the
movement of data between the source and target record to be aborted. If an
error occurs the program will list an error message to the printer detailing
the error, and the affected source record and target record.
DIVISION BY ZERO ERROR:
When moving data to a numeric segment the current value can be divided by the
data selected to be moved from the target record. If the value to be divided
BY is zero the operation is impossible and, if left alone, would cause a
machine error that would stop the program dead, and leave you with a badly
messed up target file.
ILLEGAL ACTION CODE ERROR:
The copy program allows the testing of a field in the source record, and the
selection of a numeric update process according to it's content. The allowable
values in the test field are 1-5. If a value other than 1-5 is found the
transfer will be aborted.
TARGET DUPLICATION ON UNIQUE INDEX:
The copy program will REFUSE to change a segment in a target record if it is
indexed unique or cross-indexed. It will, however, move data to indexed fields
in a record that is created during the inter-base update. Before writing new
records in an indexed target file the record is checked for duplications on the
indexes. If a duplicate in a field indexed as unique is found the transfer is
aborted. The number of the indexed field is listed to the printer.
TARGET DUPLICATION ON CROSS-INDEX:
If the index of the target file contains a cross-index it will also be checked.
If a duplicate is found it will abort the creation of the new record, and print
the proper error message.
GETTING STARTED
The way to use this, or any other program is to practice a few times. So, from
DOS, make a new directory off the MAGE directory of C:, or on a floppy. Copy
into it the datafile definition files of the CUSTOMER sample datafile supplied
with the package by entering "COPY ..\CUSTOMER\*.SAD".
Start DATAMAGE, load the copy program from the function selection menu, specify
th original CUSTOMER sample datafile as the source, (load a marker if you wish)
and the new datafile as the target. The speaker will beep, and you will be
informed that the target file has no records. That's OK.
Select automatic segment pairing, then execute the copy operation. If you
loaded a marker file, you just made a fragment of the source file. If not, you
just made a copy of the CUSTOMER sample datafile, the hard way!
Load the BASE program from the function selection screen, and access the file
you just created. Examine the file to verify it is as it should be.
Now that you have two files, end the BASE program and select the copy program
again. This time, select as source the original CUSTOMER, and as target the
new file. You will be presented with a lot you didn't see the last time,
because now there are records in both files.
Opt to align the records first pass on the contents of segment one, record
name, and tell the copy program not to ignore duplicates in the source or
target files, as there are none.
When the datafiles are aligned, press escape to view the BROWSE functions
available, and look at the list of record pairs being displayed. Then opt to
end the program.
Select power copy again, and the same source and target files. This time,
align on segment three, title. Take a pass through the program rejecting dupes
in the source, target, and both datafiles, and browse the results.
You can't hurt the sample datafiles, you have plenty of copies of them. Go
ahead and try the functions offered by the copy program, read the help screens
where offered, and try to familiarize yourself with the program as a tool, with
certain capabilities, without thinking about a specific task. Later, you can
match those capabilities to a task better if you understand them all, instead
of picking out what you need right now, and skipping over the rest.
There are many options included in the copy program that are best learned by
selecting them and viewing the results.