#include "Directry.ch"

FUNCTION MAIN()
loca _astru:={},_plik:=space(8)

clos data
set cent on
set date germ
set safe off


cls
@ 0,0 say "Plik do dodania pola FIRANY (Memo): " get _plik

read
_plik:=alltrim(_plik)

BEGIN SEQUENCE

if !file(_plik+".DBF")
  wait "Brak pliku "+alltrim(_plik)+".DBF"
  BREAK
endi

use (_plik)
_jest:=.f.
if fieldpos("FIRANY")>0
  wait "Plik posiada pole FIRANY (Memo)"
  _jest:=.t.
endi


? "Dodawanie pola FIRANY (Memo)"
inkey(1)

copy stru extended to XSTRU
use XSTRU
if !_jest
  appe blank
  repl Field_name with "FIRANY", Field_type with "M",;
       Field_len with 10, Field_dec with 0
endi
create ("XFILE") from XSTRU
use XFILE
set dele off
appe from (_plik) for !delete()
copy to (_plik)
set dele on
use

if !_jest
  wait "Dodano pole FIRANY (Memo)"
endi

/*
sele 1
use XDOKN
zap

sele 2
use SL_MAG
go top
do while !eof()

  dok="DOK"+NR_MAG+"N"
  @ 24,0 say dok

  sele XDOKN
  zap
  appe from &dok for !dele()
  copy to &dok

  sele SL_MAG
  skip
endd
close data


sele 1
use XSPRN
zap
appe from SPR_N for !dele()
copy to SPR_N
*/


END SEQUENCE
close data
WAIT "KONIEC"

RETURN NIL

