INSTITUTO 9 DE JULIO - SAN MIGUEL DE TUCUMAN -NIVEL TERCIARIO - CARRERA DE ANALISTA DE SISTEMAS DE COMPUTACION

30 agosto 2008

PROCESO DE MODIFICACION

Proceso por el cual se modifica los datos de un registro de la tabla, este proceso consiste en buscar el registro que se quiere modificar ya sea en forma secuencial (recorre la tabla desde el primer al ultimo registro hasta encontrar el registro buscado), o acceder al registro buscado a traves de un campo clave. Este segundo metodo es mucho mas practico por la velocidad con que ubica dicho registro, pero necesita de un archivo indice (donde se almacena el ordenamiento que se necesita).

*******************************************************************
* OBJETIVO: PROCESO DE MODIFICACION EN TABLA ALUMNOS.DBF
* Estructura de la tabla:
* dni c(10)
* nom c(20)
* ape c(20)
* fecing f(10)
* cuota n(3,2)
*
*Ordenamiento: index on dni tag dni
*******************************************************************
set confirm on && obliga oprimir ENTER para pasar al campo sgte.
set century on && fecha con 4 digitos
control=1
clea
close data* pone en uso tabla alumnos ordenada por dni
use alumnos order tag dni
op=0
do while control=1
clear
xdni=space(10)
xnom=space(20)
xape=space(20)
xdire=spac(40)
xfecing=CTOD(" / / ")
xcuota=0
@ 1,1 say "Documento (DNI) :" get xdni
read
if lastkey()=27 && si oprime tecla ESC cierra tabla y sale
close data
clea
retur
endif
seek xdni && busca el dni en la tabla ordenada
if !found() && si lo encontro
wait "DOCUENTO NO EXISTENTE..." windows nowait
loop && transfiere el control al do while (arriba)
endif
=insmode(.t.)
xape=ape
xnom=nom
xdire=dire
xfecing=fecing
xcuota=cuota
@ 3,1 say "Apellido :" get xape function "!"
@ 5,1 say "Nombre :" get xnom function "!"
@ 7,1 say "Direccion :" get xdire
@ 9,1 say "Fecha Ingreso :" get xfecing
@ 11,1 say "Cuota :" get xcuota picture "999.99"
@ 13,1 get op function "*h Graba;Salir" size 2,20,3 && alto,ancho,espacio entre botones
read cycle
if lastkey()=27 && si oprime tecla ESC cierra tabla y sale
close data
clea
retur
endif
do case
case op=1
replace dni with xdni
replace ape with xape
replace nom with xnom
replace dire with xdire
replace fecing with xfecing
replace cuota with xcuota
case op=2
control=0
endcase
enddo
close data
clea
return