Files
harbour-core/tests/delim.prg
Viktor Szakats 3ed9fa0f45 2016-01-14 19:33 UTC+0100 Viktor Szakats (vszakats users.noreply.github.com)
* *
    % remove brandings and homepage from copyright header. Pass 2 - semi-auto.
    * project homepage and name is described in README, amongst others
    ; this should make the diff between 3.4 and 3.2 easier to manage
2016-01-14 19:35:07 +01:00

49 lines
1.1 KiB
Plaintext

//NOTEST
// Test program for COPY TO DELIMITED and APPEND FROM DELIMITED
/* 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 DELIMITED
// Copy only address fields for records with salary over 50,000.
COPY FIELD first, last, street, city, state, zip TO test2 DELIMITED FOR _field->salary > 50000
// Only copy record 3.
COPY RECORD 3 TO test3 DELIMITED
// Copy records 4 through 7.
COPY NEXT 4 TO test4 DELIMITED
// Try to copy 10 records, starting 5 records from EOF, using WHILE
GO BOTTOM
SKIP -4
COPY WHILE ncount++ < 9 TO test4a DELIMITED
// Copy the last 10 records.
GO BOTTOM
SKIP -9
COPY REST TO test5 DELIMITED
// Copy the last 10 records again.
GO BOTTOM
SKIP -9
COPY TO test6 DELIMITED WHILE ! Eof()
// Copy only some of the last 10 records.
GO BOTTOM
SKIP -9
COPY REST TO test7 DELIMITED FOR _field->married
// Try to append from a file that we know does not exist.
DELETE FILE test8.txt
APPEND FROM test8 DELIMITED
RETURN