Next: , Previous: Data File Format, Up: Data File Format



D.1 File Header Record

The file header is always the first record in the file.

     struct sysfile_header
       {
         char                rec_type[4];
         char                prod_name[60];
         int32               layout_code;
         int32               case_size;
         int32               compressed;
         int32               weight_index;
         int32               ncases;
         flt64               bias;
         char                creation_date[9];
         char                creation_time[8];
         char                file_label[64];
         char                padding[3];
       };
char rec_type[4];
Record type code. Always set to $FL2. This is the only record for which the record type is not of type int32.
char prod_name[60];
Product identification string. This always begins with the characters @(#) SPSS DATA FILE. PSPP uses the remaining characters to give its version and the operating system name; for example, GNU pspp 0.1.4 - sparc-sun-solaris2.5.2. The string is truncated if it would be longer than 60 characters; otherwise it is padded on the right with spaces.
int32 layout_code;
Always set to 2. PSPP reads this value to determine the file's endianness.
int32 case_size;
Number of data elements per case. This is the number of variables, except that long string variables add extra data elements (one for every 8 characters after the first 8). When reading system files, PSPP will use this value unless it is set to -1, in which case it will determine the number of data elements by context. When writing system files PSPP always uses this value.
int32 compressed;
Set to 1 if the data in the file is compressed, 0 otherwise.
int32 weight_index;
If one of the variables in the data set is used as a weighting variable, set to the index of that variable. Otherwise, set to 0.
int32 ncases;
Set to the number of cases in the file if it is known, or -1 otherwise.

In the general case it is not possible to determine the number of cases that will be output to a system file at the time that the header is written. The way that this is dealt with is by writing the entire system file, including the header, then seeking back to the beginning of the file and writing just the ncases field. For `files' in which this is not valid, the seek operation fails. In this case, ncases remains -1.

flt64 bias;
Compression bias. Always set to 100. The significance of this value is that only numbers between (1 - bias) and (251 - bias) can be compressed.
char creation_date[9];
Set to the date of creation of the system file, in dd mmm yy format, with the month as standard English abbreviations, using an initial capital letter and following with lowercase. If the date is not available then this field is arbitrarily set to 01 Jan 70.
char creation_time[8];
Set to the time of creation of the system file, in hh:mm:ss format and using 24-hour time. If the time is not available then this field is arbitrarily set to 00:00:00.
char file_label[64];
Set the the file label declared by the user, if any. Padded on the right with spaces.
char padding[3];
Ignored padding bytes to make the structure a multiple of 32 bits in length. Set to zeros.