/
sdf.prg
49 lines (35 loc) · 1.13 KB
/
sdf.prg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//NOTEST
// Test program for COPY TO SDF and APPEND FROM SDF
// Note: Only COPY TO SDF is fully implemented at this time...
/* Donated to the public domain on 2001-04-18 by David G. Holm <dholm@jsd-llc.com> */
PROCEDURE Main()
LOCAL ncount := 0
USE test NEW
// Copy all records and fields.
COPY TO test1 SDF
// Copy only address fields for records with salary over 50,000.
COPY FIELD first, last, street, city, state, zip TO test2 SDF FOR _field->salary > 50000
// Only copy record 3.
COPY RECORD 3 TO test3 SDF
// Copy records 4 through 7.
COPY NEXT 4 TO test4 SDF
// Try to copy 10 records, starting 5 records from EOF, using WHILE
GO BOTTOM
SKIP -4
COPY WHILE ncount++ < 9 TO test4a SDF
// Copy the last 10 records.
GO BOTTOM
SKIP -9
COPY REST TO test5 SDF
// Copy the last 10 records again.
GO BOTTOM
SKIP -9
COPY TO test6 SDF WHILE ! Eof()
// Copy only some of the last 10 records.
GO BOTTOM
SKIP -9
COPY REST TO test7 SDF FOR _field->married
// Try to append from a file that we know does not exist.
DELETE FILE test8.txt
APPEND FROM test8 SDF
RETURN