home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Phoenix CD 2.0
/
Phoenix_CD.cdr
/
01e
/
makefile.zip
/
MAKEFILE.PRG
next >
Wrap
Text File
|
1988-04-06
|
3KB
|
84 lines
** MAKEFILE.PRG - File creation utility using QS arrays.
PARAMETERS finalfile,initndx,termndx
PRIVATE arrayexpr,fldnum,thiselem,field_name,field_type,field_len,field_dec
**
** Copyright Steve Titterud 1988
** Permission for non-commercial use granted.
**
** All activity presumed in currently selected work area.
**
** Will work regardless of how the values are loaded into CREATOR[],
** whether through hard-wired code in your program, or interactively with user.
**
** THIS ROUTINE PRESUMES ALL DATA PASSED TO BE VALID; ERROR-CHECK FIRST!!!
**
arrayexpr = "CREATOR[thiselem,fldnum]"
**
** This expression will be macro-expanded for each field and each record
** in the STRUCTURE EXTENDED file which will be used to create the needed file.
**
** From DECLARE CREATOR[#,4] where 4 columns are field_name,...,field_dec
** and where ALL files' structural data is stored in this array.
**
** # above refers to the total number of fields in all files to be created,
** and fldnum refers to the field numbers in the STRU EXTE file (1-4).
**
** Each file to be created then occupies a series of elements in CREATOR[],
** starting with initndx and ending with termndx for each file needed.
**
** Thus MAKEFILE.PRG is called successively for each file needed,
** each time with new parameters for that specific file: its name (finalfile),
** the starting element (initndx), and ending element (termndx) in CREATOR[]
** which define its structure.
**
finalfile=ltrim(rtrim(finalfile))
**
** is BEGETTER.EXT here? if so, zap it; if not, create it
**
if .not. file("BEGETTER.EXT")
create BEGETTER.EXT
use BEGETTER.EXT
else
use BEGETTER.EXT
zap
endif
**
** grab elements one at a time within range, store to automem var's names
** then issue REPLACE AUTOMEM to create that record
**
for thiselem=initndx to termndx
**
** field name?
**
fldnum=1
field_name=&arrayexpr
**
** field type?
**
fldnum=2
field_type=&arrayexpr
**
** field length?
**
fldnum=3
field_len=&arrayexpr
**
** field decimal places?
**
fldnum=4
field_dec=&arrayexpr
**
** add the new record...
**
append automem
next thiselem
** close BEGETTER.EXT; insert erasure command here or in calling program if
** you want to get rid of it; presumably, if it is used only on first startup
** of a system, not needed again; but if used repeatedly to create temporary
** files, you might want to leave it hanging around
use
create &finalfile. from BEGETTER.EXT
** close new file
use
return