Palm Programs 1
 DOWNLOADS
   Bird Codes

 PROGRAMS
   Software
   Programs 1
   Programs 2
   Programs 3











 BREADCRUMBS
   Home
   Palm Software
 
  

Basic Programs for Palm (Page 1)

Important Note.

I am a programmer and am comfortable with these software tools, but I do not warrant them to be suitable for your needs. Further, I will not support others who wish to follow my steps and use their Palm PDAs to record bird sightings. This is not a commercial Bird Records system. The software interfaces are poor or totally non-existent. Do not use this software if you are not a programmer and do not understand exactly what each step is doing. You use the software listed at my site at your own risk.

Note: to copy these programs to your Palm, highlight the program text and paste it into a memo field in your Palm Desktop application, then HotSynch your Palm.

Basic Programs that complete the bird sightings data

The following Basic Programs update the Bird Sighting files after the sightings have been manually recorded. Normal operation is to enter the location and county only the first time and thereafter only when they change. This means that if I begin birding in Utah County, I will write 'Utah' in the county field of the first bird sighting I record and will not put a value in the county field again until I record the first sighting in a different county.

County.bas

This program passes through the bird sighting data, copying the county name into all records that do not have one already listed. It does this by passing through the list in date-time order. Note that the sighting data must be in date order, the order the file will naturally be in after the sightings are entered if they are entered as they happen.

#county.bas
new
10 d1$="2000 Bird Sightings"
20 d=db.open d1$
30 l=db.len(d1$)
40 loop:
50 l=l-1
60 if l<0 then goto finis
70 a$=db$(d1$,l,5)
80 e=err(0)
90 if e<0 then goto loop
100 if a$="" then goto update
120 h$=a$
130 goto loop
140 update:
150 db$(d1$,l,5)=h$
160 goto loop
300 finis:
run

Location.bas

This program is similar to county.bas, except that it updates the location field. Yes, these operations could have been combined.

#location.bas
new
10 d1$="2000 Bird Sightings"
20 d=db.open d1$
30 l=db.len(d1$)
40 loop:
50 l=l-1
60 if l<0 then goto finis
70 a$=db$(d1$,l,4)
80 e=err(0)
90 if e<0 then goto loop
100 if a$="" then goto update
120 h$=a$
130 goto loop
140 update:
150 db$(d1$,l,4)=h$
160 goto loop
300 finis:
run

BirdName.bas

This program passes through the sighting file from newest to oldest, looking up the bird code to see if there is a matching name in the birdcode table. If it finds one, the name is added to the sighting record. If the code is not found, then an error flag is put into the bird name field. THIS PROGRAM MAY NOT TERMINATE PROPERLY. Probably due to an error on my part. Scan through the sighting data and fix all incorrect bird codes and clear the error message from the bird name field. Then rerun the program. It will not try to find a name if there is already something in the name field.

#birdname.bas
new
10 d1$="2000 Bird Sightings"
20 d2$="Birdcode"
30 x=db.open d1$
40 y=db.open d2$
50 L%=db.len(d1$):L%=L%-1
60 p%= -1
70 p%=p%+1
80 if p>L% then 1000
82 b$=db$(x,p%,2)
84 if b$<>"" then 70
90 b$=db$(x,p%,1)
92 rem ?"looking for ",b$
100 e=err(0)
110 if e<0 then 70
120 gosub 400
122 rem ?"looking for ",b$,r%
130 a%=r%
140 n%=1024:m%=0:i%=1024:q%=0
150 if n%>1074 then 310
160 b$=db$(y,n%,2)
162 rem ?"rec ",n%,i%,b$
170 if i%=1 then q%=1
180 i%=int(i%/2)
190 e=err(0)
200 if e<0 then 70
210
220 gosub 400
222 rem ?"rec ",n%,i%,b$,r%
230 if (r% 240 if (r%>a%) then 310
250 n$=db$(y,n%,1)
260 rem ?"Found ",n$,r%,a%
262 db$ (x,p%,2)=n$
270 goto 70
280 rem - greater than
282 rem ?"greater-",b$,n%,i%
290 n%=n%+i%
300 goto 330
310 rem - less than
312 rem ?"less ",b$,n%,i%
320 n%=n%-i%
330 if q%<>1 then 150
340 n$="****Not found ****"
350 goto 260
360
400 rem change b$ code to number
410 c$=mid$(b$,1,1)
420 gosub 600
430 r%=c%*19683
440 c$=mid$(b$,2,1)
450 gosub 600
460 r%=r%+c%*729
470 c$=mid$(b$,3,1)
480 gosub 600
490 r%=r%+c%*27
500 c$=mid$(b$,4,1)
510 gosub 600
520 r%=r%+c%
530 return
600 rem return 0 to 27
610 c%=asc(ucase$(c$))-64
620 return
1000 end
run

Note that CBasPAD does not have the capability to compare string fields for greater than or less than, so I had to convert the bird code to an integer for comparison purposes.

Getseq-number.bas

If you need to sort the sighting data into taxonomic order, you will need to put the sequence number into the sightings records. Some of the reports require the sightings to be sorted taxonomically. Both the sightings table and the summary table must be sorted by bird code.

#getseq-number.bas
new
2 rem puts seq into sightings
3 rem so can be sorted into
4 rem taxonomic order
5 rem sort sightings + summary
6 rem by bird code
10 d1$="2000 Bird Sightings"
20 d2$="2000 Bird Summary"
30 x=db.open d1$
40 y=db.open d2$
50 L%=db.len(d1$)
60L%=L%-1
70 p%= -1
80 p%=p%+1
90 if p%>L% then 1000
100 b$=db$(x,p%,1)
110 e=err(0)
120 if e<0 then 1000
122 q$=db$(x,p%,8)
123 e=err(0)
124 if e<0 then 1000
129 rem ?q$,"len = ",len(q$)
130if q$="" then 132
131 goto 80
132 gosub 400
133 rem ?"looking for ",b$,r%,k%
134 if r%=k% then 270
135 z$=b$
140 a%=r%
150 n%=256:i%=256:q%=0
160 if i%=1 then q%=1
170 i%=int(i%/2)
180 if n%>383 then 330
190 if n%<45 then 300
200 b$=db$(y,n%,6)
210 e=err(0)
220 if e<0 then 370
230 gosub 400
232 rem ?"summary ",n%,i%,b$,r%
240 if (r% 250 if (r%>a%) then 330
260 n$=db$(y,n%,5)
262 k%=r%
264 z=0
270 rem ?"Found ",n$,r%,a%
280 gosub 800
290 goto 80
300 rem - greater than
302 rem ?"greater-",b$,n%,i%,r%
310 n%=n%+i%
320 goto 350
330 rem - less than
332 rem ?"less ",b$,n%,i%,r%
340 n%=n%-i%
350 if q%<>1 then 160
360 ? "****Not found ****", z$
362 k%=0
370 goto 80
400 rem change b$ code to number
410 c$=mid$(b$,1,1)
420 gosub 600
430 r%=c%*19683
440 c$=mid$(b$,2,1)
450 gosub 600
460 r%=r%+c%*729
470 c$=mid$(b$,3,1)
480 gosub 600
490 r%=r%+c%*27
500 c$=mid$(b$,4,1)
510 gosub 600
520 r%=r%+c%
530 return
600 rem return 0 to 27
610 c%=asc(ucase$(c$))-64
620 return
800 rem put seq into sighting
802 rem ?"update with ",n$
810 db$(x,p%,8)=n$
820 e=err(0)
822 rem ?"error on write = ",e
830 if e<0 then 1000
880 return
1000 ?"Done",p%,e
run
   

Mail

Cascade and Provo Mountains, part of the Wasatch Front