Category : Databases and related files
Archive   : DATAMAGE.ZIP
Filename : COPY.DOC

 
Output of file : COPY.DOC contained in archive : DATAMAGE.ZIP
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.

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



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.

This package can be used to produce permanent, on-screen report/histories of
the activity in several datafiles over a certain period. We may have thirty
stores, and wish to record a sales history by month.

We have thirty datafiles that detail the DYNAMIC sales of each store, and they
are updated daily. They contain weekly totals that are updated weekly, and
monthly totals that are updated monthly.

After the monthly MACRO is run we want to take the months totals out of the
DYNAMIC file, and place them in a separate file, on a floppy, that will be the
history file for the month.

The copy program will move the data from the HD to the floppy, and cross the
formats of the files. There is no set way to accomplish the above task, you
might do it a thousand ways. The copy program will create a record in the new
file for each of the stores, move whatever data into it you wish, and place it
in the new file in the segment you specify.

You also might have a file containing orders received, and which store they
went to. You might want to move data from the records in it to the records for
the stores. Each of the orders would contain a store number, and it would be
used to match the data to the record to that store.




RELATIONAL PROCESSING



In the above cases, the records in one file relate in some way to the records
in another. If one is changed it either affects or changes the other.

STATIC relational processing permanently relates the records to each other. If
a record is updated, the relational records in other files are automatically
changed at the same time. These relationships, and their formulas, must be
defined at the time the files are installed, and can not be modified without
modification of the formats of the files.

DYNAMIC relational processing is done AFTER the updates have been entered and
checked. The dis-advantage to this is that it is not automatic. It must be
performed by the user when necessary.

The advantage is that it can easily be changed, without bothering the
datafiles. DYNAMIC relational processing is a PROCESS, and has nothing at all
to do with the formats of the associated datafiles. So, instead of a fixed
relational format, we have the ability to MOVE DATA between files.

With STATIC relational processing you can update one record without penalty.
While with DYNAMIC processing you BATCH the updates, then run one or more copy
operations to update the relational records in other files. You have control
of WHEN it happens, HOW it happens, and the option to do it DIFFERENTLY each
time!

De-automating something gives YOU control over it. You may do it, not do it,
or do something else. PARTS of your file may relate to PARTS of other files,
and each month the records in those parts may move around.

One month, a records' data may include it in one group, and data from it may be
moved into one file. Next month the record's data may include it into another
group, and it may end up in a different place.

Month after that, you may decide to change the whole thing.

Oh, yes, and it takes more TIME to do it this way. But it takes the COMPUTERS'
time, not yours. The inter-file updates are accomplished without operator
intervention, once execution starts. With STATIC relational processing you
have to wait for the relational structure to be updated before changing the
next record. And, that's doing it on YOUR time.




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 O.K.

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.




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 name 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.




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 PUBLSHRS sample datafile supplied
with the package by entering "COPY ..\PUBLSHRS\*.SAD".

Now delete the GDRECNOS.SAD file.

Start DATAMAGE, load the copy program from the function selection menu, specify
th original PUBLSHRS 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 PUBLSHRS 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 PUBLSHRS, 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.



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.

  3 Responses to “Category : Databases and related files
Archive   : DATAMAGE.ZIP
Filename : COPY.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/