home *** CD-ROM | disk | FTP | other *** search
- ** FILE F_MVARS.PRG
- ** Contains: CLRVARS, EQUVARS, FREEVARS, INITVARS, REPLVARS
-
- *****************************************************************
- FUNCTION CLRVARS
- *****************************************************************
-
- * Clears field variables created by INITVARS
-
- * Copyright(c) 1991 -- James Occhiogrosso
-
- LOCAL counter := 0, field_cnt := FCOUNT(), old_record := RECNO()
- PRIVATE field_name
-
- * Move file pointer to end of file (dummy) record
- GO BOTTOM
- SKIP
-
- * Equate fields to memory variables. Since this is the
- * end of file record, all fields are blank.
-
- FOR counter = 1 TO field_cnt
- field_name = LOWER(FIELD(counter))
- m&field_name = &field_name
- NEXT
-
- * Restore record pointer and return
- GO old_record
-
- RETURN NIL
-
-
- *****************************************************************
- FUNCTION EQUVARS
- *****************************************************************
-
- * Load memory variables created by INITVARS from database fields
-
- * Copyright(c) 1991 -- James Occhiogrosso
-
- LOCAL field_cnt := FCOUNT(), counter := 0
- PRIVATE field_name
-
- * Load each viriable from corresponding field
- FOR counter = 1 TO field_cnt
- field_name = LOWER(FIELD(counter))
- m&field_name = &field_name
- NEXT
-
- RETURN NIL
-
-
- *****************************************************************
- FUNCTION FREEVARS
- *****************************************************************
-
- * Release variables created by INITVARS
-
- * Copyright(c) 1991 -- James Occhiogrosso
-
- LOCAL counter := 0, field_cnt := FCOUNT()
- PRIVATE field_name
-
- * Release each field variable
- FOR counter = 1 TO field_cnt
- field_name = LOWER(FIELD(counter))
- RELEASE m&field_name
- NEXT
-
- RETURN NIL
-
-
- *****************************************************************
- FUNCTION INITVARS
- *****************************************************************
-
- * Create memory variables for each fields in active database
-
- * Copyright(c) 1991 -- James Occhiogrosso
-
- * Caution: This procedure declares a PUBLIC memory variable for
- * each field in the selected database. Release the variables by
- * by calling FREEVARS when you no longer need them.
-
- LOCAL field_cnt := FCOUNT(), counter := 0
- PRIVATE field_name
-
- * Get the number of fields
- field_cnt = FCOUNT()
-
- * Declare a public variable for each field
- FOR counter = 1 TO field_cnt
- field_name = LOWER(FIELD(counter))
- PUBLIC m&field_name
- NEXT
-
- RETURN NIL
-
-
- *****************************************************************
- FUNCTION REPLVARS
- *****************************************************************
-
- * Replace record with values of memory variables
-
- * Copyright(c) 1991 -- James Occhiogrosso
-
- LOCAL field_cnt := FCOUNT(), counter := 0
- PRIVATE field_name
-
- * Get the number of fields
- field_cnt = FCOUNT()
-
- * Replace each field from its associated variable
- FOR counter = 1 TO field_cnt
- field_name = LOWER(FIELD(counter))
- REPLACE &field_name WITH m&field_name
- NEXT
-
- RETURN NIL
-
-
-