Заполнение базы данных «Депонированная зарплата с использованием справочников», страница 8

  use uzrgd12

  index on tn tag i

Endif

If !(file("usou.cdx"))

  use usou

  index on vou tag i

Endif

If !(file("pasp.cdx"))

  use pasp

  index on tn tag i

Endif

If!( file("dep.cdx"))

  use dep

  index on tn tag i

Endif

close all

return

**************************************************

procedure open

if regim=1

 Set exclusive off

else

 Set exclusive on

endif

if !(used("kad"))

use kad in 0 alias kad index kad.cdx

go top

endif

if !(used("uzrgd01"))

use uzrgd01 in 0 alias uzrgd01 index uzrgd01.cdx

go top

endif

if !(used("uzrgd02"))

use uzrgd02 in 0 alias uzrgd02 index uzrgd02.cdx

go top

endif

if !(used("uzrgd03"))

use uzrgd03 in 0 alias uzrgd03 index uzrgd03.cdx

go top

endif

if !(used("uzrgd04"))

use uzrgd04 in 0 alias uzrgd04 index uzrgd04.cdx

go top

endif

if !(used("uzrgd05"))

use uzrgd05 in 0 alias uzrgd05 index uzrgd05.cdx

go top

endif

if !(used("uzrgd06"))

use uzrgd06 in 0 alias uzrgd06 index uzrgd06.cdx

go top

endif

if !(used("uzrgd07"))

use uzrgd07 in 0 alias uzrgd07 index uzrgd07.cdx

go top

endif

if !(used("uzrgd08"))

use uzrgd08 in 0 alias uzrgd08 index uzrgd08.cdx

go top

endif

if !(used("uzrgd09"))

use uzrgd09 in 0 alias uzrgd09 index uzrgd09.cdx

go top

endif

if !(used("uzrgd10"))

use uzrgd10 in 0 alias uzrgd10 index uzrgd10.cdx

go top

endif

if !(used("uzrgd11"))

use uzrgd11 in 0 alias uzrgd11 index uzrgd11.cdx

go top

endif

if !(used("uzrgd12"))

use uzrgd12 in 0 alias uzrgd12 index uzrgd12.cdx

go top

endif

if !(used("usou"))

use usou in 0 alias usou index usou.cdx 

go top

endif

if !(used("pasp"))

use pasp in 0 alias pasp index pasp.cdx 

go top

endif

if !(used("dep"))

use dep in 0 alias dep index dep.cdx 

go top

endif

return

*******************************************************************

procedure reind

select kad

reindex

select pasp

reindex

select dep

reindex

select usou

reindex

select uzrgd01

reindex

select uzrgd02

reindex

select uzrgd03

reindex

select uzrgd04

reindex

select uzrgd05

reindex

select uzrgd06

reindex

select uzrgd07

reindex

select uzrgd08

reindex

select uzrgd09

reindex

select uzrgd10

reindex

select uzrgd11

reindex

select uzrgd12

reindex

return

*******************************************************************************************************

procedure control

for i=1 to 12 step 1

  do case

    case i=1

    str="uzrgd01"

    case i=2

    str="uzrgd02"

    case i=3

    str="uzrgd03"

    case i=4

    str="uzrgd04"

    case i=5

    str="uzrgd05"

    case i=6

    str="uzrgd06"

    case i=7

    str="uzrgd07"

    case i=8

    str="uzrgd08"

    case i=9

    str="uzrgd09"

    case i=10

    str="uzrgd10"

    case i=11

    str="uzrgd11"

    case i=12

    str="uzrgd12"

  endcase 

 select &str

 go top

   do while !eof()

    t=tn

    n=recno()

    select kad

    go top

    locate for tn=t

    f=found()

    select &str

    skip n-1

    if !f

      delete

    endif

    if !eof()

     skip

    endif

   enddo

endfor

select dep

   go top

   do while !eof()

    t=tn

    n=recno()

    select kad

    go top

    locate for tn=t

    f=found()

    select dep

    skip n-1

    if !f

      delete

    endif

    if !eof()

     skip

    endif

   enddo

   go top

   do while !eof()

    t=vou

    n=recno()

    select usou

    go top

    locate for vou=t

    f=found()

    select dep

    skip n-1

    if !f

      delete

    endif

    if !eof()

     skip

    endif

   enddo

wait window "Проверка ссылочной целостности прошла успешно!"

return

**************************************************************************************************