Subversion Repositories wimsdev

Rev

Rev 12330 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
9623 guerimand 1
!! updatefield of a record
2
!! wims_read_parm should be by line :
3
!! file
4
!! num of field
5
!! optionword
6
!! all other lines : new data for the field num
7
!!
8
!! option allow :
9
!! delete : in this case field num will be deleted
10
 
11
file_=!line 1 of $wims_read_parm
12
num_=!line 2 of $wims_read_parm
13
option_=!line 3 of $wims_read_parm
14
data_=!line 4 to -1 of $wims_read_parm
15
 
16
nbrec_=!recordcnt $file_
17
newrecord_=$empty
18
!if $num_>1
12330 bpr 19
  !for k_=1 to $num_-1
14334 bpr 20
    tmp_=!record $k_ of $file_
21
    newrecord_=!append line :$tmp_ to $newrecord_
12330 bpr 22
  !next k_
9623 guerimand 23
!endif
24
!if delete notwordof $option_
12330 bpr 25
  newrecord_=!append line :$data_ to $newrecord_
9623 guerimand 26
!endif
27
!if $num_<$nbrec_
12330 bpr 28
  !for k_=$num_+1 to $nbrec_
14334 bpr 29
    tmp_=!record $k_ of $file_
30
    newrecord_=!append line :$tmp_ to $newrecord_
12330 bpr 31
  !next k_
9623 guerimand 32
!endif
12330 bpr 33
!writefile $file_ $newrecord_