home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
ENTERPRS
/
CPM
/
TEXT
/
PIPMAG2.ARC
/
DBASEFIL.CFH
< prev
next >
Wrap
Text File
|
1988-10-16
|
14KB
|
322 lines
*********************************************************************
THIS ARTICLE IS BEING PRESENTED THROUGH THE PIP ONLINE CP/M MAGAZINE
OF THE NATIONAL CP/M ROUNDTABLE ON GENIE. copyright (c) 1988 BY
BILL JULIANI. ALL RIGHTS RESERVED. PERMISSION IS HEREBY GRANTED
TO NON-PROFIT ORGANIZATIONS ONLY TO REPRINT THIS ARTICLE OR PASS IT
ALONG ELECTRONICALLY AS LONG AS PROPER CREDIT IS GIVEN TO BOTH THE
AUTHOR AND GENIE.
*********************************************************************
***********************************
* *
* dBase-Creating & Importing *
* SDF Files *
* *
* by: Carl F. Howard *
* *
***********************************
============================================================================
dBase - CREATING & IMPORTING SDF FILES
By: Carl F. Howard
09/10/88
GEnie Address:
CARL.H
Commodore !FlagShip* RT SySop
============================================================================
Hi All!
This is the first of my dBase Articles for "PIP" the GEnie Online C-128 CP/M
Magazine. The dBase column is intended to help C-128 dBase II users with the
fundementals of dBase II. If you have a dBase question or an idea for an
article you would like to see written drop me a line and I'll be glad to
help!
This first article is on the topic of SDF files (SOURCE DATA FILES).
Hopefully when we are done you will have a better idea of what they are and
how to use them.
Essentialy, SDF files are Flat ASCII TEXT FILES. They can be created with
any ASCCI text editor (WordStar N mode or VDE ASCII mode.) and must contain
the .SDF extension. The Data in a source data file must be in columnar form.
A record is contained on each line, and delimited with a caraige return.
Using the SDF format gives you the ability to Import Data from ASCII files
directly into a dBase DBF.
For example, say you just sent a letter to the Regional Manager reporting
last months Sales Activities and you wanted to import the information in
your letter to a dBase DBF containing all your Sales Data for the year. All
you would need to do is WRITE the report data in to a seperate ASCII file
and then Append it to your DBF, eliminating the need to mannualy enter this
information one record at a time into the DBF.
Here's how you Do IT!
In this article I am going to CREATE a DBF called DIRFILE.DBF which will be
a DBF of all my C-128 CP/M Disk. I'm going to get the DATA for this DBF
using a couple of CP/M commands. The DIR command and the PUT command.
Since I want to create an ASCII File of my Disk Directories, I will need to
use the PUT Command to redirect Console output to a diskfile called
DIRFILE.SDF. To do this you need to TYPE PUT at the DOS prompt.
(MAKE SURE DIR.COM and PUT.COM are on the Default Drive! They are on the
CP/M System Disk that came with your 128.)
Note: The author assumes you are using date/time stamped Directories.
See the CPM PRIMER Articles or your D.R.I. manual.
Eg.
A:> PUT
You will then be prompted for the name of the file you want to write
to, so enter DIRFILE.SDF
All data being sent to the screen will now also be sent to DIRFILE.SDF.
You can disable the redirection when your finished by typing PUT CONSOLE.
Eg.
A:> PUT CONSOLE
OK! Lets start with the First Disk.
Put the Disk in Drive A: and turn on the redirection to DIRFILE.SDF as
indicated above.
Now Type DIR [full] at the DOS prompt.
a:> DIR [FULL]
When the directory listing has finished being displayed Turn OFF the
redirection.
a:> PUT CONSOLE
Now, Use your ASCII Editor and load the DIRFILE.SDF.
You should see somethiing like the following:
------------------------------------------------------------------
Scanning Directory...
Sorting Directory...
Directory For Drive A: User 0
Name Bytes Recs Attributes Prot Update Access
------------ ------ ------ ------------ ------ -------------- --------------
1571 COM 2k 10 Dir RW None 09/10/88 13:33
ARK COM 20k 156 Dir RW None 09/10/88 13:33
B COM 16k 118 Dir RW None 09/10/88 13:39
C COM 4k 26 Dir RW None 09/10/88 13:33
D COM 2k 11 Dir RW None 09/10/88 13:51
DATE COM 4k 25 Dir RW None 09/10/88 13:34
DFILE 0k 0 Dir RW None 09/10/88 13:52
DIR COM 16k 114 Dir RW None 09/10/88 13:52
EFILE 4k 23 Dir RW None 09/10/88 13:45
ERASE COM 4k 29 Dir RW None 09/10/88 13:42
FILTX COM 2k 11 Dir RW None 09/10/88 13:34
FINDBAD COM 6k 38 Dir RW None 09/10/88 13:34
INITDIR COM 32k 250 Dir RW None 09/10/88 13:34
LIST COM 2k 16 Dir RW None 09/10/88 13:35
MEX COM 26k 202 Dir RW None 09/10/88 13:35
NFORMAT COM 4k 18 Dir RW None 09/10/88 13:35
PIP COM 10k 68 Dir RW None 09/10/88 13:47
Press RETURN to Continue
Directory For Drive A: User 0
Name Bytes Recs Attributes Prot Update Access
------------ ------ ------ ------------ ------ -------------- --------------
PROFILE SUB 2k 2 Dir RW None 09/10/88 13:37
PUT COM 8k 55 Dir RW None 09/10/88 13:52
READCBM COM 14k 106 Dir RW None 09/10/88 13:35
READMSDS COM 24k 179 Dir RW None 09/10/88 13:36
RENAME COM 4k 23 Dir RW None 09/10/88 13:36
SET COM 12k 81 Dir RW None 09/10/88 13:36
SUBMIT COM 6k 42 Dir RW None 09/10/88 13:36
TYPE COM 4k 24 Dir RW None 09/10/88 13:52
UNARC COM 4k 32 Dir RW None 09/10/88 13:36
UNCR COM 6k 41 Dir RW None 09/10/88 13:36
UNERASE COM 2k 11 Dir RW None 09/10/88 13:36
V COM 16k 120 Dir RW None 09/10/88 13:44
Total Bytes = 256k Total Records = 1831 Files Found = 29
Total 1k Blocks = 243 Used/Max Dir Entries For Drive A: 47/ 128
--------------------------------------------------------------------------
Edit the File down so that it contains just the Columnar Information which
should look like this:
--------------------------------------------------------------------------
1571 .COM 2k 10 Dir RW None 09/10/88 13:33
ARK .COM 20k 156 Dir RW None 09/10/88 13:33
B .COM 16k 118 Dir RW None 09/10/88 13:39
C .COM 4k 26 Dir RW None 09/10/88 13:33
D .COM 2k 11 Dir RW None 09/10/88 13:51
DATE .COM 4k 25 Dir RW None 09/10/88 13:34
DFILE 0k 0 Dir RW None 09/10/88 13:52
DIR .COM 16k 114 Dir RW None 09/10/88 13:52
EFILE 4k 23 Dir RW None 09/10/88 13:45
ERASE .COM 4k 29 Dir RW None 09/10/88 13:42
FILTX .COM 2k 11 Dir RW None 09/10/88 13:34
FINDBAD .COM 6k 38 Dir RW None 09/10/88 13:34
INITDIR .COM 32k 250 Dir RW None 09/10/88 13:34
LIST .COM 2k 16 Dir RW None 09/10/88 13:35
MEX .COM 26k 202 Dir RW None 09/10/88 13:35
NFORMAT .COM 4k 18 Dir RW None 09/10/88 13:35
PIP .COM 10k 68 Dir RW None 09/10/88 13:47
PROFILE SUB 2k 2 Dir RW None 09/10/88 13:37
PUT .COM 8k 55 Dir RW None 09/10/88 13:52
READCBM .COM 14k 106 Dir RW None 09/10/88 13:35
READMSDS.COM 24k 179 Dir RW None 09/10/88 13:36
RENAME .COM 4k 23 Dir RW None 09/10/88 13:36
SET .COM 12k 81 Dir RW None 09/10/88 13:36
SUBMIT .COM 6k 42 Dir RW None 09/10/88 13:36
TYPE .COM 4k 24 Dir RW None 09/10/88 13:52
UNARC .COM 4k 32 Dir RW None 09/10/88 13:36
UNCR .COM 6k 41 Dir RW None 09/10/88 13:36
UNERASE .COM 2k 11 Dir RW None 09/10/88 13:36
V .COM 16k 120 Dir RW None 09/10/88 13:44
Note: I added the (.) in between the file name and the extension name using
the find and replace function of my editor.
^QA
FIND: COM Replace: .COM
-----------------------------------------------------------------------------
Now Count the number of spaces in each field including Blanks! (Except for
the last feild.) You MUST include the Blanks or dBase will not import
the Data properly. We will get rid of the extra spaces latter.
Name Bytes Recs Attributes Prot Update Access
------------ ------ ------ ------------ ------ -------------- --------------
13 7 7 13 7 16 14
Create a dBase file matching the above structure.
Load dBase and type the Following at the dBase Dot PROMPT.
Enter record structure as follows:
Field Name, Type, Width, Decimal places
001 name,c,13,
002 bytes,c,7
003 recs,c,7
004 attr,c,13
005 prot,c,7
006 update,c,16
Next Append the DATA using the following commands at the dBase DOT PROMPT.
Note:The File must have an SDF extension and SDF must be typed after the
File Name to let dBase know the it is an SDF type format.
When the records have been added the Data in this file will contain an extra
space at the end of each field it will look like this:
RECORD # 00001
NAME [1571 .COM ]
BYTES [ 2k ]
RECS [ 10 ]
ATTR [Dir RW ]
PROT [None ]
UPDATE [ ]
ACCESS [09/10/88 13:33]
We will eliminate the extra space and add a field by creating a new DBF called
DFILE2.DBF
We eliminate the extra space by shortening the width of each field in the new
DBF structure by 1 and we add a field for the Disk Number called DISKNUM.
Your new DBF Structure should match the one bellow.
Structure for file: C:DFILE2 .DBF
Number of records: 00030
Date of last update: 00/00/00
Primary use database
Fld Name Type Width Dec
001 NAME C 012
002 BYTES C 006
003 RECS C 006
004 ATTR C 012
005 PROT C 006
006 UPDATE C 015
007 ACCESS C 014 (Don't Change this Field)
008 DISKNUM C 004 (Add This field)
* Total * 00076
Now we are going to import the DATA from DIRFILE.DBF to the new DBF DIR2.DBF
Type the following at the dBase Dot Propmpt.
Note: No Extension name is required as dBase assumes you are appending data
from another DBF file.
Data in the NEW DBF will look like this:
RECORD # 00001
NAME [1571 .COM]
BYTES [ 2k]
RECS [ 10]
ATTR [Dir RW ]
PROT [None ]
UPDATE [ ]
ACCESS [09/10/88 13:33]
DISKNUM [ ]
To Add Disk Numbers for all the newly appended records you can use
the dBase REPLACE Command.
Type the Following at the dBase Dot Propmt.
Note: You change the number each time you add records from a new disk.
Well Thats the Basic Idea!
You should be able to create a DBF of all your CP/M Disk using the above.
Next time I'm going to discuss ways to SEARCH for files using the LOCATE
COMMAND and to SEARCH for Partial STRING matches as well.
Future Articles will be on SORTING and INDEXING files and creating REPORT
files for printing list of records in your DBF. After we have mastered the
fudementals I'll show you how to write simple dBase programs (.CMD FILES)
and create Menus.
Regards,
Carl.H