anchor.diff:              line = line+1
               do k=1, int(nfield)
                   ! if is a numeric field
  -                if (vartype(k) == 'N') then
  -                    read (unit=1, pos=p) li
  -                    write (2,numfor) li, ','
  +                if (vartype(k) == 'N' .and. strewrdnum(k)>0) then
  +                    read (unit=1, pos=p,err=99) li
  +                    if (li>-9.9E29 .and. li<9.9E29) then 
  +                        write (2,numfor,err=99) li, ','
  +                    else 
  +                        if (li<=-9.9E29) write (2,'(A,A,$)',err=99) '   ' , ','
  +                        if (li>= 9.9E29) write (2,'(A,A,$)',err=99) 'inf' , ','
  +                    end if
                       p=p+8
  +                end if
  +                if (vartype(k) == 'N' .and. strewrdnum(k)==0) then
  +                    write (2,numfor,err=99) defaultval(k), ','
                   end if 
                   ! if is string caracter
                   if (vartype(k)=='A') then
  -					read (unit=1, pos=p) text4
  -					write (2,'(A,A,$)',advance='no') text4, ','
  -					p=p+8
  +                    read (unit=1, pos=p,err=99) text4
  +                    if(k<nfield .and. varnames(k)==varnames(k+1) .and. numofwords(k)==numofwords(k+1)-1) then
  +                        write (2,'(A,$)',advance='no',err=99) text4
  +                    else
  +                        write (2,'(A,A,$)',advance='no',err=99) text4, ','
  +                    end if 
  +                    p=p+8
                   end if 
               end do
  -            write (2,*) line
  +            write (2,*,err=99) line
           end do
           p= i*4096+1 !next page position
       end do
  +    
       
       !read last page
       do j=1, int(nreclastpage)
           line = line+1
           do k=1, int(nfield)
               ! if is a numeric field
  -            if (vartype(k) == 'N') then
  -                read (unit=1, pos=p) li
  -                write (2,numfor) li, ','
  +            if (vartype(k) == 'N' .and. strewrdnum(k)>0) then
  +                read (unit=1, pos=p,err=99) li
  +                if (li>-9.9E29 .and. li<9.9E29) then
  +                    write (2,numfor,err=99) li, ','
  +                else 
  +                    if (li<=-9.9E29) write (2,'(A,A,$)',err=99) '   ' , ','
  +                    if (li>= 9.9E29) write (2,'(A,A,$)',err=99) 'inf' , ','
  +                end if
                   p=p+8
  +            end if 
  +            if (vartype(k) == 'N' .and. strewrdnum(k)==0) then
  +                write (2,numfor,err=99) defaultval(k), ','
               end if 
               ! if is string caracter
               if (vartype(k)=='A') then
  -                do l=1, numofwords(i)
  -                    read (unit=1, pos=p) text4
  -                    write (2,'(A,A,$)',advance='no') text4, ','
  -                    p=p+8
  -                end do 
  -            end if 
  +                read (unit=1, pos=p,err=99) text4
  +                if(k<nfield .and. varnames(k)==varnames(k+1) .and. numofwords(k)==numofwords(k+1)-1) then
  +                    write (2,'(A,$)',advance='no',err=99) text4
  +                else
  +                    write (2,'(A,A,$)',advance='no',err=99) text4, ','
  +                end if 
  +                p=p+8
  +            end if  
           end do
           write (2,*) line
       end do
  
positive.code: 
      
      ! tmp variables
      character*4 text4
      character*8 text8, text8b
      character*16 text16
      real*8 li
  
negative.code:     maxlen = 0
      do i=1,int(nfield)
          ! Field name
          read (unit=1, pos=p,err=99) text4
          read (unit=1, pos=p+8,err=99) text4b
          varnames(i) = text4 // text4b  ! names are stored in two variables
          
          
          write (*,*) 'Name : ', trim(varnames(i))
          
          ! Field type ('A ' or 'N ')
          read (unit=1, pos=p+16,err=99) text4
          vartype(i) = text4(1:2)
          write (*,*) 'Type : ', vartype(i)
          
          ! SW Stored word number
          read (unit=1, pos=p+24,err=99) li
          strewrdnum(i) = int(li)
          write (*,*) 'SW  : ', strewrdnum(i)
          
          ! Word number within field (always 1 for numeric fields, 1,2,3... for text fields)
          read (unit=1, pos=p+32,err=99) li
          numofwords(i) = int(li)
          write (*,*) 'WN  : ', numofwords(i)
          if (strewrdnum(i)>0) maxlen = maxlen + 1
          
          ! Default value or file constant value
          read (unit=1, pos=p+48,err=99) defaultval(i)
          write (*,*) 'DV  : ', defaultval(i)
          
          
          if (vartype(i) == 'N') then
              write (2,'(A,A,$)', Advance = 'no',err=99) trim(varnames(i)),','
          else
              if (.not. (i>1 .and. varnames(i-1)==varnames(i) .and. numofwords(i-1)==numofwords(i)-1)) then
                  write (2,'(A,A,$)', Advance = 'no',err=99) trim(varnames(i)),','
              end if
          end if
          
          p=p+56
      end do
      
      write (2,'(A)',err=99) 'ID'
      
      
      nrecperpage = INT(508/maxlen)
  