home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 13
/
AACD13.ISO
/
AACD
/
Utilities
/
QuickFile
/
ARexx
/
ReSort.quickfile
< prev
next >
Wrap
Text File
|
2000-05-26
|
2KB
|
86 lines
/*
$VER: ReSort.quickfile 1.5 (26 May 2000 23:29:41) By M Andre Z Eckenrode
External function for QuickFile macros which modify any number of fields in all
records in an index. Tests whether any fields to be modified are used in the
current index; if so, re-sorts the database using the first existing field that
is not being modified; if ALL available fields are to be modified, no re-sort
is performed.
Requires (rexx)reqtools.library, and an argument string containing the
names of all fields to be modified, separated by commas as follows:
(<field1>[,<field2>,...])
Returns the following string:
<rc> <index>
Where:
<rc> = 0 if database was re-sorted, or re-sort not needed
1 if no re-sort was performed due to no available fields
2 if any of fieldname arguments not valid
3 if not at least one argument provided
<index> = name of current index (prior to re-sort)
<rc> may be used by the calling macro to determine whether or not the operation
should proceed.
*/
options results
lib = 'rexxreqtools.library'
if ~show(l,lib) then call addlib(lib,0,-30)
setindex
ndx = result
lf = d2c(10)
mfld.0 = arg()
if mfld.0 < 1 then do
body = 'Function requires at least'lf'one fieldname as an argument.'
call notify
exit 3 ndx
end
do i = 1 to mfld.0
mfld.i = upper(arg(i))
query field 'MFLD.'i '"'mfld.i'"'
if mfld.i.type = 'MFLD.'i'.TYPE' then do
body = '"'mfld.i'"'lf'Not a valid fieldname!'
call notify
exit 2 ndx
end
end
query index xfld '"'ndx'"'
xflds = 0
do i = 1 to xfld.0 until xflds = 1
do ii = 1 to mfld.0 until xflds = 1
if mfld.ii = xfld.i then xflds = 1
end
end
if xflds = 0 then exit 0 ndx
query field fld
flds = 0
do i = 1 to fld.0+1
do ii = 1 to mfld.0 until flds = 1
if mfld.ii = fld.i then flds = 1
end
if flds = 0 then leave i
flds = 0
end
if i = fld.0+1 then exit 1 ndx
sort '"'fld.i'" a'
exit 0 ndx
notify:
call rtezrequest(body,'_Exit','ReSort.quickfile','rtez_flags = ezreqf_centertext')
return