home *** CD-ROM | disk | FTP | other *** search
- * Filename......: R_Fields.Prg
- *
- * Author........: Vernon E. Six, Jr.
- *
- * Last Update...: Sat 10-19-1991 21:56:00
- *
- * Notice........: Copyright (c) 1991 by Vernon E. Six, Jr.
- * All Rights Reserved World Wide
- *
- * Dialect.......: Clipper v5.0x
-
-
- #include "SETCURS.CH"
- #include "INKEY.CH"
-
- FUNCTION R_Fields()
- *****
- * Renumber the fields in a database
- *****
- LOCAL ac_Fields := {}
- LOCAL n_Cntr := 0
-
-
- VS_Text( 2, "", PADC("Renumber...",40), "" )
-
-
- *****
- * Read all the fields into an array
- *****
- _DICTFLD->( dbSeek( _DICTHDR->DBF_NAME ) )
-
- DO WHILE .NOT. _DICTFLD->(EOF())
-
- IF _DICTFLD->DBF_NAME <> _DICTHDR->DBF_NAME
- EXIT
- ENDIF
-
- AADD( ac_Fields, _DICTFLD->FIELD_NAME )
-
- _DICTFLD->( dbSkip() )
-
- ENDDO
-
-
- *****
- * Change the index order to something we aren't going to be
- * changing... i.e. field name (since we have that in an array anyway)
- *****
- _DICTFLD->( dbSetOrder(2) )
-
-
- *****
- * Step through the array and change the number as we go
- *****
- FOR n_Cntr = 1 TO LEN( ac_Fields )
-
- IF _DICTFLD->( dbSeek( _DICTHDR->DBF_NAME + ac_Fields[n_Cntr] ) )
-
- IF _DICTFLD->( VS_RLock() )
-
- REPLACE _DICTFLD->FIELD_NMBR WITH STRZERO(n_Cntr*5,3,0)
-
- _DICTFLD->( dbUnlock() )
-
- ENDIF
-
- ENDIF
-
- NEXT n_Cntr
-
-
- *****
- * Set it back the way it was
- *****
- _DICTFLD->( dbSetOrder(1) )
-
- VS_EndText()
-
- RETURN(NIL)
- *** EOF: R_Fields() *********************************************************
-
-
-
-