home *** CD-ROM | disk | FTP | other *** search
- ********************
-
- PROCEDURE R_s_array
-
- PARAMETERS _repl, _tarray, _tfile, _therec, _tfield, _thelen
-
- * _repl is the REPLACE/STORE toggle
- * _tarray is the name of the array to work with
- * _tfile is the name of the database or work area to work with
- * _therec is the record number to work with; 0 means to APPEND BLANK
- * _tfield is the field number to begin to work with
- * _thelen is the number of fields to perform this operation with.
-
- PRIVATE _retto, old_length, _qaz, _bfields, _startat, _inc, _qazz
-
- IF !EMPTY(_tfile)
- _retto = STR(SELECT())
- IF LEN(_tfile) = 1
- SELECT &_tfile
- ELSE
- SELECT 0
- USE (_tfile)
- ENDIF
- ENDIF
-
- IF LASTREC() < _therec .OR. _therec = 0
- GO BOTTOM
- IF _repl
- APPEND BLANK
- ENDIF
- ELSE
- GOTO _therec
- ENDIF
-
- IF EMPTY(_thelen)
- _thelen = LEN(_tarray)
- ELSE
- IF _thelen > LEN(_tarray)
- _thelen = LEN(_tarray)
- ENDIF
- ENDIF
-
- old_length = _thelen
-
- IF !EMPTY(_tfield)
- _bfields = ""
- FOR _qaz = 1 TO FCOUNT()
- _bfields = _bfields + FILL_OUT(FIELDNAME(_qaz), 10)
- NEXT
- _startat = (AT(UPPER(FILL_OUT(_tfield, 10)), _bfields) + 9) / 10
- _thelen = INT(_thelen + _startat - 1)
- ELSE
- _startat = 1
- ENDIF
-
- _startat = INT(IF(_startat <= 1, 1, _startat))
-
- _inc = 1
- FOR _qazz = _startat TO _thelen
- _tblank = FIELDNAME(_qazz)
- ARRAY_ACT(_repl, _tblank, _tarray, _inc)
- _inc = _inc + 1
- NEXT
-
- IF !EMPTY(_tfile)
- IF LEN(_tfile) > 1
- CLOSE DATABASE
- ENDIF
- SELECT &_retto.
- ENDIF
-
- * End of File