[net.micro.cpm] DBASE II and directory databases!!

del@pilchuck.UUCP (Erik Lindberg) (08/04/86)

Sorry to cross post this, but this article is in response to a request
from somebody that wanted to do diskette cataloging via DBASE II, and our
machine has already killed the original article. Also, sorry for taking
so long to reply, but I haven't used this one for so long it took me a 
while to dig it out of the archives.

There is no documentation contained here, except some sparce comments in
the .cmd files. The concept is simple though, a few minutes study should
show you whats going on. Run the shar file into a directory, then it is up
to you to get the files onto your DBASE II machine. I am assuming a current
version of DBASE II which supports the (almost) undocumented
	SAVE STRUCTURE EXTENDED and
	CREATE file FROM file
commands. If your version of DB does not support these, you can still
figure out what is going on and rewrite the operations. If you do have
these capabilities, you can execute "DO MAKE.CMD" to create the required
database descriptor files. Then "DO DIR" to see how the thing works.
The first prompt expects the name of the database you would like the
file names to appear in, the second prompt is the file template to list,
which could be "*.CMD" or even "tmp?????.*". Note that in the seconde
example "tmp*.*" will not work because DB does not expand it out.

BEFORE you execute "make.cmd" you must store something to the memory
variable "LIB", you can just use a blank (STORE " " TO LIB) and USE
a valid database. Don't worry, the database you use will not be altered,
it is only used to create the format of a database descriptor file.

Let me hear if this works for you, I am interested!

#	This is a shell archive.
#	Remove everything above and including the cut line.
#	Then run the rest of the file through sh.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar:    Shell Archiver
#	Run the following text with /bin/sh to create:
#	dir.cmd
#	make.cmd
#	flist.dad
#	dir.dad
# This archive created: Mon Aug  4 10:45:26 1986
# By:	Erik Lindberg 
echo shar: extracting dir.cmd
sed 's/^XX//' << \GOOD_OL_DBASE > dir.cmd
XX*_ dir.cmd   Mon Aug  4 1986   Modified by: Erik Lindberg */
XX* Command to create a data base file from a directory specifcation.
XX* Wild cards are allowed with the caveate that if you intend to do
XX* something like "d*.*" you must do "d???????.*", but "*.dir" will
XX* work as is.
XX
XX* The variable "LIB" normally contains the drive containing my non-application
XX* specific command files.
XXRESET
XXACCEPT "Enter filename" TO FLIST
XXACCEPT "Enter directory specification" TO WILD
XXSELECT PRIMARY
XXSET TALK ON
XXSET RAW ON
XXSET ALTERNATE TO TMP.DIR
XXSET ALTERNATE ON
XXLIST FILE LIKE &WILD
XXSET ALTERNATE OFF
XXSET ALTERNATE TO JUNK.TMP
XXUSE
XXIF FILE('DIR.DBF')
XX  DELETE FILE DIR.DBF
XXENDIF
XXCREATE DIR FROM &LIB.DIR.DBD
XXUSE DIR
XXAPPEND FROM TMP.DIR SDF
XXGOTO TOP
XXSELECT SECONDARY
XXIF .NOT.FILE('&FLIST..DIR')
XX  CREATE &FLIST..DIR FROM &LIB.FLIST.DBD
XX  USE &FLIST..DIR
XXELSE
XX  USE &FLIST..DIR
XX  DELETE ALL
XX  PACK
XXENDIF
XXSELECT PRIMARY
XXSET TALK OFF
XXDO WHILE .NOT.EOF
XX  STORE '0' TO NUMBER
XX  DO WHILE VAL(NUMBER) < 4
XX    STORE STR(VAL(NUMBER)+1,1,0) TO NUMBER
XX    STORE FILE&NUMBER TO FILENAME
XX    IF FILENAME # ' ' .AND. FILENAME # CHR(0)
XX      SELECT SECONDARY
XX      APPEND BLANK
XX      REPLACE FILE WITH $(FILENAME,1,8)
XX      REPLACE EXTENT WITH $(FILENAME,9,4)
XX      DISP
XX    ENDIF
XX  ENDDO
XX  SELECT PRIMARY
XX  SKIP
XXENDDO
XXSELECT SECONDARY
XXUSE
XXSELECT PRIMARY
XXUSE &FLIST..DIR
XXDELETE FILE TMP.DIR
XXRETURN
XX
XX
GOOD_OL_DBASE
if test 1370 -ne "`wc -c dir.cmd`"
then
echo shar: error transmitting dir.cmd '(should have been 1370 characters)'
fi
echo shar: extracting make.cmd
sed 's/^XX//' << \GOOD_OL_DBASE > make.cmd
XXCOPY STRUCTURE EXTENDED TO TMP.DBD
XXUSE TMP.DBD
XXDELETE ALL
XXPACK
XXCOPY STRU TO DIR.DBD
XXCOPY STRU TO FLIST.DBD
XXUSE DIR.DBD
XXAPPEND FROM DIR.DAD SDF
XXUSE FLIST.DBD
XXAPPEND FROM FLIST.DAD SDF
XXUSE
XX? 'NOW EXECUTE DIR.CMD FOR AN EXAMPLE.'
GOOD_OL_DBASE
if test 227 -ne "`wc -c make.cmd`"
then
echo shar: error transmitting make.cmd '(should have been 227 characters)'
fi
echo shar: extracting flist.dad
sed 's/^XX//' << \GOOD_OL_DBASE > flist.dad
XXFILE      C  8  0
XXEXTENT    C  4  0
XXPRINT     L  1  0
GOOD_OL_DBASE
if test 54 -ne "`wc -c flist.dad`"
then
echo shar: error transmitting flist.dad '(should have been 54 characters)'
fi
echo shar: extracting dir.dad
sed 's/^XX//' << \GOOD_OL_DBASE > dir.dad
XXFILE1     C012000
XXSPACE1    C008000
XXFILE2     C012000
XXSPACE2    C008000
XXFILE3     C012000
XXSPACE3    C008000
XXFILE4     C012000
GOOD_OL_DBASE
if test 126 -ne "`wc -c dir.dad`"
then
echo shar: error transmitting dir.dad '(should have been 126 characters)'
fi
#	End of shell archive
exit 0
-- 

del (Erik Lindberg) aka Hugable


Hugs: One of the few good things in life that are still free.