@display
DATA LIST [FIXED]
@{TABLE,NOTABLE@}
- FILE='file-name'
- RECORDS=record_count
- END=end_var
+ [FILE='file-name']
+ [RECORDS=record_count]
+ [END=end_var]
+ [SKIP=record_count]
/[line_no] var_spec@dots{}
where each var_spec takes one of the forms
The END subcommand is only useful in conjunction with @cmd{INPUT
PROGRAM}. @xref{INPUT PROGRAM}, for details.
+The optional SKIP subcommand specifies a number of records to skip at
+the beginning of an input file. It can be used to skip over a row
+that contains variable names, for example.
+
@cmd{DATA LIST} can optionally output a table describing how the data file
will be read. The TABLE subcommand enables this output, and NOTABLE
disables it. The default is to output the table.
DATA LIST FREE
[(@{TAB,'c'@}, @dots{})]
[@{NOTABLE,TABLE@}]
- FILE='file-name'
- END=end_var
+ [FILE='file-name']
+ [END=end_var]
+ [SKIP=record_cnt]
/var_spec@dots{}
where each var_spec takes one of the forms
The NOTABLE and TABLE subcommands are as in @cmd{DATA LIST FIXED} above.
NOTABLE is the default.
-The FILE and END subcommands are as in @cmd{DATA LIST FIXED} above.
+The FILE, END, and SKIP subcommands are as in @cmd{DATA LIST FIXED} above.
The variables to be parsed are given as a single list of variable names.
This list must be introduced by a single slash (@samp{/}). The set of
DATA LIST LIST
[(@{TAB,'c'@}, @dots{})]
[@{NOTABLE,TABLE@}]
- FILE='file-name'
- END=end_var
+ [FILE='file-name']
+ [END=end_var]
+ [SKIP=record_count]
/var_spec@dots{}
where each var_spec takes one of the forms
+Thu Nov 2 20:56:03 2006 Ben Pfaff <blp@gnu.org>
+
+ Implement SKIP keyword on DATA LIST. Fixes bug #17099.
+
+ * data-list.c: (struct data_list_pgm) Add `skip_records' members.
+ (cmd_data_list) Set skip_records based on user input.
+ (data_list_source_read) Skip records requested by user.
+
Tue Oct 31 20:04:06 2006 Ben Pfaff <blp@gnu.org>
* placement-parser.c: (PRS_TYPE_T) Now that struct fmt_spec uses
(fixed_parse_columns) Ditto.
(fixed_parse_fortran) Ditto.
-
Tue Oct 31 18:21:48 2006 Ben Pfaff <blp@gnu.org>
* print-space.c (print_space_trns_proc): Let dfm_put_record add
struct variable *end; /* Variable specified on END subcommand. */
int record_cnt; /* Number of records. */
struct string delims; /* Field delimiters. */
+ int skip_records; /* Records to skip before first case. */
};
static const struct case_source_class data_list_source_class;
dls->type = -1;
dls->end = NULL;
dls->record_cnt = 0;
+ dls->skip_records = 0;
ds_init_empty (&dls->delims);
ds_register_pool (&dls->delims, dls->pool);
lex_get ();
lex_match (')');
}
+ else if (lex_match_id ("SKIP"))
+ {
+ lex_match ('=');
+ if (!lex_force_int ())
+ goto error;
+ dls->skip_records = lex_integer ();
+ lex_get ();
+ }
else if (lex_match_id ("END"))
{
if (dls->end)
{
struct data_list_pgm *dls = source->aux;
+ /* Skip the requested number of records before reading the
+ first case. */
+ while (dls->skip_records > 0)
+ {
+ if (dfm_eof (dls->reader))
+ return false;
+ dfm_forward_record (dls->reader);
+ dls->skip_records--;
+ }
+
for (;;)
{
bool ok;
+Thu Nov 2 20:58:12 2006 Ben Pfaff <blp@gnu.org>
+
+ * command/data-list.sh: Test newly implement SKIP keyword on DATA
+ LIST.
+
Sat Nov 4 16:08:58 2006 Ben Pfaff <blp@gnu.org>
* automake.mk: Add binhex-out.sh, date-out.sh, month-out.sh,
list.
-data list free/A B C D.
+data list free skip=1/A B C D.
begin data.
+# This record is ignored.
,1,2,3
,4,,5
6
end data.
list.
-data list free (tab)/A B C D.
+data list free (tab) skip=2/A B C D.
begin data.
+# These records
+# are skipped.
1 2 3 4
1 2 3
1 2 4