home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware 1 2 the Maxx
/
sw_1.zip
/
sw_1
/
DBASE
/
TAG_UTES.ZIP
/
PRNTTAGS.PRG
< prev
next >
Wrap
Text File
|
1992-01-31
|
5KB
|
133 lines
PROCEDURE PrntTags
*-------------------------------------------------------------------------------
*-- Programmer..: David Love (DAVIDLOVE)
*-- Date........: 01/31/1992
*-- Notes.......: This routine is a "quick and not-so-dirty" method of printing
*-- the tag and key expressions for a dbf's production mdx file.
*-- It obviates the need for DISP/LIST STAT TO PRINT (or DISP STAT
*-- followed by SHIFT+PrtScr).
*-- This code is modified from the procedure RedoTags.prg,
*-- previously posted on the BORBBS.
*-- : The proc will print the full key expression, including
*-- FOR/DESCENDING/UNIQUE options, if present.
*-- : This procedure will create a database file (RedoTags.dbf) and
*-- a text file (RedoTags.txt). Upon completion, both files will
*-- be erased. These files are necessary because dBASE IV 1.1
*-- does not have functions that return the FOR/DESCENDING/UNIQUE
*-- options of the index tags.
*-- Written for.: dBASE IV, 1.1
*-- Rev. History:
*-- Calls.......: None
*-- Called by...: Any
*-- Usage.......: do PrntTags with "<cDBF>"
*-- Example.....: do PrntTags with "Referral"
*-- Returns.....: None
*-- Parameters..: cDBF = Name of DATABASE file, no extension necessary.
*-- Acknowledgement..: Bowen Moursund for the code that creates RedoTags.dbf
*-- (Download PRGCREAT.ZIP for more info.)
*-------------------------------------------------------------------------------
parameter cDBF
use (cDBF)
*-- only perform routine if an index tag exists
if "" # tag( (cdbf), 1)
private nTags, nMaxTags, cConsole, cTalk
*-- used to find UNIQUE/DESCENDING/FOR clauses
cConsole = set("CONSOLE")
set console off
if file("RedoTags.txt")
erase "RedoTags.txt"
endif
list stat to file RedoTags.txt
*-- creates a database file, RedoTags.dbf, which has three 254 char fields
if file("RedoTags.dbf")
erase "RedoTags.dbf"
endif
set printer to file RedoTags.dbf
set printer on
??? "{3}{92}{1}{24}{0}{0}{0}{0}{129}{0}{251}{2}{0}{0}{0}{0}{0}{0}{0}{0}{0}"+;
"{0}{0}{0}{0}{0}{0}{0}{0}{0}{201}{0}{84}{65}{71}{83}{49}{0}{0}{0}{0}{0}{0}"+;
"{67}{3}{0}{26}{84}{254}{0}{0}{0}{1}{0}{0}{0}{0}{0}{0}{0}{0}{0}{0}{0}{84}"+;
"{65}{71}{83}{50}{0}{0}{0}{0}{0}{0}"
??? "{67}{1}{1}{26}{84}{254}{0}{0}{0}{1}{0}{0}{0}{0}{0}{0}{0}{0}{0}{0}{0}"+;
"{84}{65}{71}{83}{51}{0}{0}{0}{0}{0}{0}{67}{255}{1}{26}{84}{254}{0}{0}{0}"+;
"{1}{0}{0}{0}{0}{0}{0}{0}{0}{0}{0}{0}{13}{26}"
set printer to
set printer off
*-- append to RedoTags if the line contains 'TAG:' (no quotes)
use RedoTags
append from RedoTags.txt type sdf for "TAG:" $ tags1
set console &cConsole
*-- figure out how many tags there are
nMaxTags = reccount()
*-- put any 'for' expression(s) in a separate field
replace all tags3 with iif( at("For:",tags1) > 0, ;
substr( tags1, at("For:",tags1) + 5) + " " + trim(tags2),"")
*-- declare an array to hold the info
declare aTags[nMaxTags,5]
*-- store descending/unique/for info to the array variables
go top
nTags = 1
do while .not. eof()
store "(Descending)" $ tags1 to aTags[nTags,3]
store "(Unique)" $ tags1 to aTags[nTags,4]
store trim( tags3 ) to aTags[nTags,5]
nTags = nTags + 1
skip
enddo
*-- store the key expressions and tags to the array
use (cDBF)
nTags = 1
do while "" # tag( (cDBF),nTags )
store key( (cDBF),nTags ) to aTags[nTags,1] && grab the key
store tag( (cDBF),nTags ) to aTags[nTags,2] && grab the tagname
nTags = nTags + 1
enddo
use && don't need the file to be open any more
*-- print each tag with it's key expression
cTalk = set("talk")
set talk off
set printer on
?? "DATABASE: "+cDBF at 0
?
?? "TAG" at 0
?? "KEY EXPRESSION" at 12
?
nTags = 1
do while nTags <= nMaxTags
?? aTags[nTags,2] at 0
?? aTags[nTags,1] + ;
iif(aTags[nTags,3]," descending","") + ;
iif(aTags[nTags,4]," unique","") + ;
iif(""#trim(aTags[nTags,5])," for "+trim(aTags[nTags,5]),"") at 12
?
nTags = nTags + 1
enddo
?
set printer off
set talk &cTalk.
*-- delete the dbf and text files
erase "RedoTags.dbf"
erase "RedoTags.txt"
*-- release the array ...
release aTags
endif && check for tags ...
use && close database
RETURN
*-- EoP: RedoTags