sys-file-reader: Break multiple response set decoding into two stages.
[pspp] / tests / data / sys-file-reader.at
index cb9abd360b7f82e309b1a0b134b72dc85b10f077..c0530acc9929441cd685b89982e045f44bed953c 100644 (file)
@@ -6,12 +6,13 @@ AT_DATA([sys-file.sack], [dnl
 dnl File header.
 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
 2; dnl Layout code
-22; dnl Nominal case size
+28; dnl Nominal case size
 0; dnl Not compressed
-0; dnl Not weighted 
+0; dnl Not weighted
 1; dnl 1 case.
 100.0; dnl Bias.
-"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
+"01 Jan 11"; "20:53:52";
+"PSPP synthetic test file: "; i8 244; i8 245; i8 246; i8 248; s34 "";
 i8 0 *3;
 
 dnl Numeric variable, no label or missing values.
@@ -19,7 +20,7 @@ dnl Numeric variable, no label or missing values.
 
 dnl Numeric variable, variable label.
 2; 0; 1; 0; 0x050800 *2; s8 "NUM2";
-26; "Numeric variable 2's label"; i8 0 *2;
+32; "Numeric variable 2's label ("; i8 249; i8 250; i8 251; ")";
 
 dnl Numeric variable, one missing value.
 2; 0; 0; 1; 0x050800 *2; s8 "NUM3";
@@ -42,7 +43,8 @@ dnl Numeric variable, range of missing values.
 dnl Numeric variables, range of missing values plus discrete value.
 2; 0; 0; -3; 0x050800 *2; s8 "NUM8"; 1.0; 3.0; 5.0;
 2; 0; 0; -3; 0x050800 *2; s8 "NUM9"; 1.0; HIGHEST; -5.0;
-2; 0; 0; -3; 0x050800 *2; s8 "NUM10"; LOWEST; 1.0; 5.0;
+2; 0; 0; -3; 0x050800 *2; "NUM"; i8 192; i8 200; i8 204; i8 209; i8 210;
+LOWEST; 1.0; 5.0;
 
 dnl String variable, no label or missing values.
 2; 4; 0; 0; 0x010400 *2; s8 "STR1";
@@ -66,11 +68,24 @@ dnl String variable, three missing values.
 2; 4; 0; 3; 0x010400 *2; s8 "STR6"; s8 "MISS"; s8 "OTHR"; s8 "MORE";
 
 dnl Long string variable, one missing value.
+dnl (This is not how SPSS represents missing values for long strings--it
+dnl uses a separate record as shown later below--but old versions of PSPP
+dnl did use this representation so we continue supporting it for backward
+dnl compatibility.
 2; 11; 0; 1; 0x010b00 *2; s8 "STR7"; "first8by";
 2; -1; 0; 0; 0; 0; s8 "";
 
+dnl Long string variables that will have missing values added with a
+dnl later record.
+2; 9; 0; 0; 0x010900 *2; s8 "STR8";
+2; -1; 0; 0; 0; 0; s8 "";
+2; 10; 0; 0; 0x010a00 *2; s8 "STR9";
+2; -1; 0; 0; 0; 0; s8 "";
+2; 11; 0; 0; 0x010b00 *2; s8 "STR10";
+2; -1; 0; 0; 0; 0; s8 "";
+
 dnl Long string variable, value label.
-2; 25; 1; 0; 0x011900 *2; s8 "STR8"; 14; "25-byte string"; i8 0 * 2;
+2; 25; 1; 0; 0x011900 *2; s8 "STR11"; 14; "25-byte string"; i8 0 * 2;
 ( 2; -1; 0; 0; 0; 0; s8 ""; ) * 2;
 dnl Variable label fields on continuation records have been spotted in system
 dnl files created by "SPSS Power Macintosh Release 6.1".
@@ -82,6 +97,18 @@ dnl Machine integer info record.
 dnl Machine floating-point info record.
 7; 4; 8; 3; SYSMIS; HIGHEST; LOWEST;
 
+dnl Long string variable missing values record.
+7; 22; 1; COUNT (
+dnl One missing value for STR8.
+COUNT("STR8"); i8 1; 8; "abcdefgh";
+
+dnl Two missing values for STR9.
+COUNT("STR9"); i8 2; 8; "abcdefgh"; 8; "01234567";
+
+dnl Three missing values for STR9.
+COUNT("STR10"); i8 3; 8; "abcdefgh"; 8; "01234567"; 8; "0       ";
+);
+
 dnl Character encoding record.
 7; 20; 1; 12; "windows-1252";
 
@@ -91,29 +118,33 @@ dnl Dictionary termination record.
 dnl Data.
 1.0; 2.0; 3.0; 4.0; 5.0; 6.0; 7.0; 8.0; 9.0; 10.0;
 s8 "abcd"; s8 "efgh"; s8 "ijkl"; s8 "mnop"; s8 "qrst"; s8 "uvwx";
-s16 "yzABCDEFGHI"; s32 "JKLMNOPQRSTUVWXYZ01234567";
+s16 "yzABCDEFGHI"; s16 "JKLMNOPQR"; s16 "STUVWXYZ01";
+s16 "23456789abc"; s32 "defghijklmnopqstuvwxyzABC";
 ])
 for variant in \
-       "be e07ee28eaf7bceca017e83e9fd46be3c" \
-       "le c357aa20227c856b8a80d1b840722da1"
+       "be ae072375af73d628a544cc2230dd72c9" \
+       "le 039a21ab64f68c65b240e782a6b0f563"
 do
   set $variant
   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
 ])
   AT_DATA([sys-file.sps], [dnl
 GET FILE='sys-file.sav'.
+DISPLAY FILE LABEL.
 DISPLAY DICTIONARY.
 LIST.
 ])
   AT_CHECK([pspp -o pspp.csv sys-file.sps])
   AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl
+File label: PSPP synthetic test file: ôõöø
+
 Variable,Description,,Position
 num1,Format: F8.0,,1
-num2,Numeric variable 2's label,,2
+num2,Label: Numeric variable 2's label (ùúû),,2
 ,Format: F8.0,,
 num3,Format: F8.0,,3
 ,Missing Values: 1,,
-num4,Another numeric variable label,,4
+num4,Label: Another numeric variable label,,4
 ,Format: F8.0,,
 ,Missing Values: 1,,
 num5,Format: F8.0,,5
@@ -126,14 +157,14 @@ num8,Format: F8.0,,8
 ,Missing Values: 1 THRU 3; 5,,
 num9,Format: F8.0,,9
 ,Missing Values: 1 THRU HIGHEST; -5,,
-num10,Format: F8.0,,10
+numàèìñò,Format: F8.0,,10
 ,Missing Values: LOWEST THRU 1; 5,,
 str1,Format: A4,,11
-str2,String variable 2's label,,12
+str2,Label: String variable 2's label,,12
 ,Format: A4,,
 str3,Format: A4,,13
 ,"Missing Values: ""MISS""",,
-str4,Another string variable label,,14
+str4,Label: Another string variable label,,14
 ,Format: A4,,
 ,"Missing Values: ""OTHR""",,
 str5,Format: A4,,15
@@ -142,12 +173,18 @@ str6,Format: A4,,16
 ,"Missing Values: ""MISS""; ""OTHR""; ""MORE""",,
 str7,Format: A11,,17
 ,"Missing Values: ""first8by""",,
-str8,25-byte string,,18
+str8,Format: A9,,18
+,"Missing Values: ""abcdefgh""",,
+str9,Format: A10,,19
+,"Missing Values: ""abcdefgh""; ""01234567""",,
+str10,Format: A11,,20
+,"Missing Values: ""abcdefgh""; ""01234567""; ""0       """,,
+str11,Label: 25-byte string,,21
 ,Format: A25,,
 
 Table: Data List
-num1,num2,num3,num4,num5,num6,num7,num8,num9,num10,str1,str2,str3,str4,str5,str6,str7,str8
-1,2,3,4,5,6,7,8,9,10,abcd,efgh,ijkl,mnop,qrst,uvwx,yzABCDEFGHI,JKLMNOPQRSTUVWXYZ01234567
+num1,num2,num3,num4,num5,num6,num7,num8,num9,numàèìñò,str1,str2,str3,str4,str5,str6,str7,str8,str9,str10,str11
+1,2,3,4,5,6,7,8,9,10,abcd,efgh,ijkl,mnop,qrst,uvwx,yzABCDEFGHI,JKLMNOPQR,STUVWXYZ01,23456789abc,defghijklmnopqstuvwxyzABC
 ])
 done
 AT_CLEANUP
@@ -195,7 +232,7 @@ LIST.
   AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl
 Variable,Description,,Position
 num1,Format: F8.0,,1
-num2,Numeric variable 2's label,,2
+num2,Label: Numeric variable 2's label,,2
 ,Format: F8.0,,
 
 Table: Data List
@@ -251,7 +288,7 @@ LIST.
   AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl
 Variable,Description,,Position
 num1,Format: F8.0,,1
-num2,Numeric variable 2's label,,2
+num2,Label: Numeric variable 2's label,,2
 ,Format: F8.0,,
 
 Table: Data List
@@ -291,7 +328,7 @@ dnl String variables.
 2; 6; 0; 0; 0x010600 *2; s8 "STR6"; dnl index 11
 2; 7; 0; 0; 0x010700 *2; s8 "STR7"; dnl index 12
 2; 8; 0; 0; 0x010800 *2; s8 "STR8"; dnl index 13
-2; 9; 0; 0; 0x010900 *2; s8 "STR9"; dnl index 14
+2; 9; 0; 0; 0x010900 *2; "STR9"; i8 230; s3 ""; dnl index 14
 2; -1; 0; 0; 0; 0; s8 "";
 2; 12; 0; 0; 0x010c00 *2; s8 "STR12"; dnl index 16
 2; -1; 0; 0; 0; 0; s8 "";
@@ -301,7 +338,7 @@ dnl String variables.
 ( 2; -1; 0; 0; 0; 0; s8 ""; ) * 2;
 
 dnl One value label for NUM1.
-3; 1; 1.0; i8 3; s7 "one"; 4; 1; 1;
+3; 1; 1.0; i8 17; i8 238; i8 228; i8 232; i8 237; s19 " (in Russian)"; 4; 1; 1;
 
 dnl Two value labels for NUM2, as a single pair of type 3 and type 4 records.
 3; 2; 1.0; i8 3; s7 "one"; 2.0; i8 3; s7 "two"; 4; 1; 2;
@@ -345,9 +382,15 @@ dnl One value label for STR6, STR7, STR8.
 3; 1; s8 "JKLMNOP"; i8 25; s31 "value label for `JKLMNOP'"; 4; 1; 12;
 3; 1; s8 "JKLMNOPQ"; i8 26; s31 "value label for `JKLMNOPQ'"; 4; 1; 13;
 
+dnl Machine integer info record.
+7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1251;
+
+dnl Character encoding record.
+7; 20; 1; 12; "windows-1251";
+
 7; 21; 1; COUNT (
-dnl One value label for STR9,
-COUNT("STR9"); 9; 1; COUNT("RSTUVWXYZ"); COUNT("value label for `RSTUVWXYZ'");
+dnl One value label for STR9ж,
+COUNT("STR9"; i8 230); 9; 1; COUNT("RSTUVWXYZ"); COUNT("value label for `RSTUVWXYZ'");
 
 dnl Two value labels for STR12.
 COUNT("STR12"); 12; 2;
@@ -358,7 +401,7 @@ dnl Three value labels for STR16.
 COUNT("STR16"); 16; 3;
 COUNT("opqrstuvwxyzABCD"); COUNT("value label for `opqrstuvwxyzABCD'");
 COUNT("EFGHIJKLMNOPQRST"); COUNT("value label for `EFGHIJKLMNOPQRST'");
-COUNT("UVWXYZ0123456789"); COUNT("value label for `UVWXYZ0123456789'");
+COUNT("UVWXYZ0123456789"); COUNT("value label for `UVWXYZ0123456789' with Cyrillic letters: `"; i8 244; i8 245; i8 246; "'");
 
 dnl One value label for STR17.
 COUNT("STR17"); 17; 1;
@@ -369,8 +412,8 @@ dnl Dictionary termination record.
 999; 0;
 ])
 for variant in \
-       "be 1de55cc9fb523c8f9b014cdc5387c12b" \
-       "le 76a6974012df7351b591c5964c41e582"
+       "be b27d766d8a5ad9e901c8b244591a5942" \
+       "le eb2e93f3cc29acd605b80e6c3af25ba6"
 do
   set $variant
   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
@@ -383,7 +426,7 @@ DISPLAY DICTIONARY.
   AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl
 Variable,Description,,Position
 num1,Format: F8.0,,1
-,1,one,
+,1,один (in Russian),
 num2,Format: F8.0,,2
 ,1,one,
 ,2,two,
@@ -424,14 +467,14 @@ str7,Format: A7,,12
 ,JKLMNOP,value label for `JKLMNOP',
 str8,Format: A8,,13
 ,JKLMNOPQ,value label for `JKLMNOPQ',
-str9,Format: A9,,14
+str9ж,Format: A9,,14
 ,RSTUVWXYZ,value label for `RSTUVWXYZ',
 str12,Format: A12,,15
 ,0123456789ab,value label for `0123456789ab',
 ,cdefghijklmn,value label for `cdefghijklmn',
 str16,Format: A16,,16
 ,EFGHIJKLMNOPQRST,value label for `EFGHIJKLMNOPQRST',
-,UVWXYZ0123456789,value label for `UVWXYZ0123456789',
+,UVWXYZ0123456789,value label for `UVWXYZ0123456789' with Cyrillic letters: `фхц',
 ,opqrstuvwxyzABCD,value label for `opqrstuvwxyzABCD',
 str17,Format: A17,,17
 ,abcdefghijklmnopq,value label for `abcdefghijklmnopq',
@@ -456,13 +499,21 @@ i8 0 *3;
 dnl Numeric variable, no label or missing values.
 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
 
+dnl Machine integer info record.
+7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
+
 dnl Document record.
-6; 4;
+6; 5;
 s80 "First line of documents";
 s80 "Second line of documents";
+"abb"; i8 233; " appliqu"; i8 233; " attach"; i8 233; " blas"; i8 233; " caf"; i8 233; " canap"; i8 233; " clich"; i8 233; " consomm"; i8 233;
+s25 "";
 s80 "";
 s80 "Last line of documents";
 
+dnl Character encoding record.
+7; 20; 1; 12; "windows-1252";
+
 dnl Dictionary termination record.
 999; 0;
 
@@ -470,8 +521,8 @@ dnl Data.
 1.0;
 ])
 for variant in \
-       "be 8738124d7932cc8ff803142fbf38710b" \
-       "le f3ca2123ec9e8bda91c6b865ba39f506"
+       "be 3555f74f3e714a3a703de7df56ce6d24" \
+       "le ede5a0f805a1aab096ea86abf677ff34"
 do
   set $variant
   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
@@ -483,12 +534,14 @@ LIST.
 ])
   AT_CHECK([pspp -o pspp.csv sys-file.sps])
   AT_CHECK([cat pspp.csv], [0], [dnl
-Documents in the active file:
+Documents in the active dataset:
 
 First line of documents
 
 Second line of documents
 
+abbé appliqué attaché blasé café canapé cliché consommé
+
 
 
 Last line of documents
@@ -515,7 +568,7 @@ dnl File header.
 i8 0 *3;
 
 dnl $a
-2; 0; 0; 0; 0x050800 *2; s8 "A";
+2; 0; 0; 0; 0x050800 *2; i8 0x82; i8 0xa0; s6 "";
 2; 0; 0; 0; 0x050800 *2; s8 "B";
 2; 0; 0; 0; 0x050800 *2; s8 "C";
 
@@ -526,9 +579,9 @@ dnl $b
 2; 0; 0; 0; 0x050800 *2; s8 "G";
 
 dnl $c
-2; 3; 0; 0; 0x010300 *2; s8 "H";
-2; 3; 0; 0; 0x010300 *2; s8 "I";
-2; 3; 0; 0; 0x010300 *2; s8 "J";
+2; 4; 0; 0; 0x010400 *2; s8 "H";
+2; 4; 0; 0; 0x010400 *2; s8 "I";
+2; 4; 0; 0; 0x010400 *2; s8 "J";
 
 dnl $d
 2; 0; 0; 0; 0x050800 *2; s8 "K";
@@ -540,23 +593,30 @@ dnl $e
 2; 6; 0; 0; 0x010600 *2; s8 "O";
 2; 6; 0; 0; 0x010600 *2; s8 "P";
 
+dnl Machine integer info record.
+7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 932;
+
 7; 7; 1;
 COUNT(
-  "$a=C 10 my mcgroup a b c"; i8 10;
-  "$b=D2 55 0  g e f d"; i8 10;
-  "$c=D3 Yes 10 mdgroup #2 h i j"; i8 10);
+  "$a=C 10 my mcgroup "; i8 0x82; i8 0xa0; " b c"; i8 10;
+  "$b=D2 55 0  g e f d"; i8 10; i8 10;
+  "$c=D4 "; i8 0x82; i8 0xcd; i8 0x82; i8 0xa2; " 10 mdgroup #2 h i j"; i8 10);
 
 7; 19; 1;
 COUNT(
+  i8 10;
   "$d=E 1 2 34 13 third mdgroup k l m"; i8 10;
-  "$e=E 11 6 choice 0  n o p"; i8 10);
+  "$e=E 11 6 choice 0  n o p"; i8 10; i8 10; i8 10; i8 10);
+
+dnl Character encoding record.
+7; 20; 1; 9; "shift_jis";
 
 dnl Dictionary termination record.
 999; 0;
 ])
 for variant in \
-       "be 0caa3446d7a3f6985e79fd1fcc999b10" \
-       "le 9dbeba699e4149ed836f55bad7346d67"
+       "be eab38c68398324ac1663161512a8516a" \
+       "le afc6173eed7f4c4e63dc4252bc18f6a2"
 do
   set $variant
   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
@@ -569,7 +629,7 @@ MRSETS /DISPLAY NAME=ALL.
   AT_CHECK([cat pspp.csv], [0], [dnl
 Table: Multiple Response Sets
 Name,Variables,Details
-$a,"a
+$a,"
 b
 c
 ","Multiple category set
@@ -589,7 +649,7 @@ j
 ","Multiple dichotomy set
 Label: mdgroup #2
 Label source: Provided by user
-Counted value: `Yes'
+Counted value: `はい'
 Category label source: Variable labels
 "
 $d,"k
@@ -613,6 +673,57 @@ Category label source: Value labels of counted value
 done
 AT_CLEANUP
 
+dnl Also checks for handling of CR-only line ends in file label and
+dnl extra product info.
+AT_SETUP([extra product info])
+AT_KEYWORDS([sack synthetic system file positive])
+AT_DATA([sys-file.sack], [dnl
+dnl File header.
+"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
+2; dnl Layout code
+4; dnl Nominal case size
+0; dnl Not compressed
+0; dnl Not weighted
+0; dnl No cases.
+100.0; dnl Bias.
+"01 Jan 11"; "20:53:52"; "PSPP synthetic"; i8 13; s49 "test file";
+i8 0 *3;
+
+dnl Numeric variables.
+2; 0; 0; 0; 0x050800 *2; s8 "A";
+2; 0; 0; 0; 0x050800 *2; s8 "B";
+2; 0; 0; 0; 0x050800 *2; s8 "C";
+2; 0; 0; 0; 0x050800 *2; s8 "D";
+
+dnl Extra product info.
+7; 10; 1; COUNT ("Extra product info"; i8 13; "another line"; i8 13; "blah");
+
+dnl Dictionary termination record.
+999; 0;
+])
+for variant in \
+       "be 0e1cac77501322b012637dcaeb3858ab" \
+       "le ecffd25cae41bbc89c29487abe192016"
+do
+  set $variant
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
+])
+  AT_DATA([sys-file.sps], [dnl
+SYSFILE INFO FILE='sys-file.sav'.
+])
+  AT_CHECK([pspp -o pspp.csv sys-file.sps])
+  AT_CHECK([sed 7q pspp.csv], [0], [dnl
+File:,sys-file.sav
+Label:,"PSPP synthetic
+test file"
+Created:,01 Jan 11 20:53:52 by $(@%:@) SPSS DATA FILE PSPP synthetic test file
+Product:,"Extra product info
+another line
+blah"
+])
+done
+AT_CLEANUP
+
 AT_SETUP([variable display parameters, without width])
 AT_KEYWORDS([sack synthetic system file positive])
 AT_DATA([sys-file.sack], [dnl
@@ -859,7 +970,7 @@ AT_DATA([sys-file.sack], [dnl
 dnl File header.
 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
 2; dnl Layout code
-4; dnl Nominal case size
+7; dnl Nominal case size
 0; dnl Not compressed
 0; dnl Not weighted 
 0; dnl No cases.
@@ -872,21 +983,36 @@ dnl Numeric variables.
 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_A";
 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_B";
 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_C";
+2; 0; 0; 0; 0x050800 *2; "CO"; i8 214; "RDINA";
+2; 0; 0; 0; 0x050800 *2; "CO"; i8 214; "RDI_A";
+2; 0; 0; 0; 0x050800 *2; "CO"; i8 214; "RDI_B";
+
+dnl Machine integer info record.
+7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
+
+dnl Machine floating-point info record.
+7; 4; 8; 3; SYSMIS; HIGHEST; LOWEST;
 
 dnl Long variable names.
 7; 13; 1; COUNT (
 "LONGVARI=LongVariableName1"; i8 9;
 "LONGVA_A=LongVariableName2"; i8 9;
 "LONGVA_B=LongVariableName3"; i8 9;
-"LONGVA_C=LongVariableName4";
+"LONGVA_C=LongVariableName4"; i8 9;
+"CO"; i8 214; "RDINA=Co"; i8 246; "rdinate_X"; i8 9;
+"CO"; i8 214; "RDI_A=Co"; i8 246; "rdinate_Y"; i8 9;
+"CO"; i8 214; "RDI_B=Co"; i8 246; "rdinate_Z";
 );
 
+dnl Character encoding record.
+7; 20; 1; 12; "windows-1252";
+
 dnl Dictionary termination record.
 999; 0;
 ])
 for variant in \
-       "be eb7a8b4055a5d880a185a566048876b3" \
-       "le dd4ecd7541320b9b51746717ef20973f"
+       "be 8ea5a72f3ae6e732371e92a7719c3951" \
+       "le 02bcf02cf08b1e8fc80a858101ae22fc"
 do
   set $variant
   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
@@ -902,6 +1028,9 @@ LongVariableName1,Format: F8.0,,1
 LongVariableName2,Format: F8.0,,2
 LongVariableName3,Format: F8.0,,3
 LongVariableName4,Format: F8.0,,4
+Coördinate_X,Format: F8.0,,5
+Coördinate_Y,Format: F8.0,,6
+Coördinate_Z,Format: F8.0,,7
 ])
 done
 AT_CLEANUP
@@ -921,9 +1050,9 @@ dnl File header.
 i8 0 *3;
 
 dnl 256-byte string.
-2; 255; 0; 0; 0x01FF00 *2; s8 "STR256";
+2; 255; 0; 0; 0x01FF00 *2; "S"; i8 201; s6 "Q256";
 (2; -1; 0; 0; 0; 0; s8 "") * 31;
-2; 4; 0; 0; 0x010400 *2; s8 "STR256_1";
+2; 4; 0; 0; 0x010400 *2; "S"; i8 201; "Q256_1";
 
 dnl 600-byte string.
 2; 255; 0; 0; 0x01FF00 *2; s8 "STR600";
@@ -933,12 +1062,18 @@ dnl 600-byte string.
 2; 96; 0; 0; 0x016000 *2; s8 "STR600_2";
 (2; -1; 0; 0; 0; 0; s8 "") * 11;
 
+dnl Machine integer info record.
+7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
+
 dnl Very long string record.
 7; 14; 1; COUNT (
-"STR256=00256"; i8 0; i8 9;
+"S"; i8 201; "Q256=00256"; i8 0; i8 9;
 "STR600=00600"; i8 0; i8 9;
 );
 
+dnl Character encoding record.
+7; 20; 1; 12; "windows-1252";
+
 dnl Dictionary termination record.
 999; 0;
 
@@ -949,8 +1084,8 @@ dnl Data.
 "abcdefghijklmnopqrstuvwxyzABCDEF";
 ])
 for variant in \
-       "be 40a4327805d8b59891084317248f5d4a" \
-       "le ced2584a43037b893b7feb068e2cb9d6"
+       "be 844a4704f669dfe292482e587d690133" \
+       "le b76025f602bdff6a42c1e0795a8b62ff"
 do
   set $variant
   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
@@ -963,11 +1098,11 @@ LIST.
   AT_CHECK([pspp -o pspp.csv sys-file.sps])
   AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl
 Variable,Description,,Position
-str256,Format: A256,,1
+séq256,Format: A256,,1
 str600,Format: A600,,2
 
 Table: Data List
-str256,str600
+séq256,str600
 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@a,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyz
 ])
 done
@@ -991,61 +1126,171 @@ dnl Variables.
 2; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR";
 2; 0; 0; 0; 0x050800 *2; s8 "SECONDVA";
 
+dnl Machine integer info record.
+7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
+
 dnl Long variable names.
 7; 13; 1; COUNT (
 "FIRSTVAR=FirstVariable"; i8 9;
-"SECONDVA=SecondVariable"; i8 9;
+"SECONDVA=S"; i8 233; "condVariable"; i8 9;
 );
 
 dnl Data file attributes record.
 7; 17; 1; COUNT (
-"Attr1('Value1'"; i8 10; "''QuotedValue''"; i8 10; ")";
-"SecondAttr('123'"; i8 10; "'456'"; i8 10; ")";
+"Attr1('Value1'"; i8 10; "''d"; i8 233; "claration''"; i8 10; ")";
+"S"; i8 233; "condAttr('123'"; i8 10; "'456'"; i8 10; ")";
 );
 
 dnl Variable attributes record.
 7; 18; 1; COUNT (
 "FirstVariable:";
-  "fred('23'"; i8 10; "'34'"; i8 10; ")";
+  "ad"; i8 232; "le('23'"; i8 10; "'34'"; i8 10; ")";
   "bert('123'"; i8 10; ")";
-"/SecondVariable:";
+  "$@Role('1'"; i8 10; ")";
+"/S"; i8 233; "condVariable:";
   "xyzzy('quux'"; i8 10; ")";
 );
 
+
+dnl Character encoding record.
+7; 20; 1; 12; "windows-1252";
+
 dnl Dictionary termination record.
 999; 0;
 ])
 for variant in \
-       "be 955802de462daf810c0ecc81ee2320a1" \
-       "le 7fc6439aedfa00615bb1fe94d6701305"
+       "be 7fff0c04f697adf45f55d8be4aaa8712" \
+       "le 7331339199344aa58bc60d7d05d538a7"
 do
   set $variant
   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
 ])
   AT_DATA([sys-file.sps], [dnl
 GET FILE='sys-file.sav'.
-DISPLAY ATTRIBUTES.
+DISPLAY @ATTRIBUTES.
 ])
   AT_CHECK([pspp -o pspp.csv sys-file.sps])
   AT_CHECK([cat pspp.csv], [0],
 [[Variable,Description,
 FirstVariable,Custom attributes:,
+,$@Role,1
+,adèle[1],23
+,adèle[2],34
 ,bert,123
-,fred[1],23
-,fred[2],34
-SecondVariable,Custom attributes:,
+SécondVariable,Custom attributes:,
 ,xyzzy,quux
 
 Table: Custom data file attributes.
 Attribute,Value
-SecondAttr[1],123
-SecondAttr[2],456
 Attr1[1],Value1
-Attr1[2],'QuotedValue'
+Attr1[2],'déclaration'
+SécondAttr[1],123
+SécondAttr[2],456
+]])
+  AT_DATA([sys-file.sps], [dnl
+GET FILE='sys-file.sav'.
+DISPLAY DICTIONARY.
+])
+  AT_CHECK([pspp -o pspp.csv sys-file.sps])
+  AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0],
+[[Variable,Description,,Position
+FirstVariable,Format: F8.0,,1
+,Role: Output,,
+,Custom attributes:,,
+,adèle[1],23,
+,adèle[2],34,
+,bert,123,
+SécondVariable,Format: F8.0,,2
+,Custom attributes:,,
+,xyzzy,quux,
+
+Table: Custom data file attributes.
+Attribute,Value
+Attr1[1],Value1
+Attr1[2],'déclaration'
+SécondAttr[1],123
+SécondAttr[2],456
 ]])
 done
 AT_CLEANUP
 
+AT_SETUP([variable roles])
+AT_KEYWORDS([sack synthetic system file positive])
+AT_DATA([sys-file.sack], [dnl
+dnl File header.
+"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
+2; dnl Layout code
+7; dnl Nominal case size
+0; dnl Not compressed
+0; dnl Not weighted
+0; dnl 1 case.
+100.0; dnl Bias.
+"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
+i8 0 *3;
+
+dnl Variables.
+2; 0; 0; 0; 0x050800 *2; s8 "I";
+2; 0; 0; 0; 0x050800 *2; s8 "O";
+2; 0; 0; 0; 0x050800 *2; s8 "B";
+2; 0; 0; 0; 0x050800 *2; s8 "N";
+2; 0; 0; 0; 0x050800 *2; s8 "P";
+2; 0; 0; 0; 0x050800 *2; s8 "S";
+2; 0; 0; 0; 0x050800 *2; s8 "X";
+
+dnl Machine integer info record.
+7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
+
+dnl Variable attributes record.
+7; 18; 1; COUNT (
+"I:$@Role('0'"; i8 10; ")";
+"/O:$@Role('1'"; i8 10; ")";
+"/B:$@Role('2'"; i8 10; ")";
+"/N:$@Role('3'"; i8 10; ")";
+"/P:$@Role('4'"; i8 10; ")";
+"/S:$@Role('5'"; i8 10; ")";
+"/X:$@Role('6'"; i8 10; ")";
+);
+
+dnl Character encoding record.
+7; 20; 1; 12; "windows-1252";
+
+dnl Dictionary termination record.
+999; 0;
+])
+for variant in \
+       "be b08b39cd005682f680d132d272f5158d" \
+       "le 176e4ac91197f5cb8732258033cfabdc"
+do
+  set $variant
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
+])
+  AT_DATA([sys-file.sps], [dnl
+GET FILE='sys-file.sav'.
+DISPLAY DICTIONARY.
+])
+  AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [dnl
+warning: `sys-file.sav': Invalid role for variable x.
+])
+  AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl
+warning: `sys-file.sav': Invalid role for variable x.
+
+Variable,Description,,Position
+i,Format: F8.0,,1
+o,Format: F8.0,,2
+,Role: Output,,
+b,Format: F8.0,,3
+,Role: Both,,
+n,Format: F8.0,,4
+,Role: None,,
+p,Format: F8.0,,5
+,Role: Partition,,
+s,Format: F8.0,,6
+,Role: Split,,
+x,Format: F8.0,,7
+])
+done
+AT_CLEANUP
+
 AT_SETUP([compressed data])
 AT_KEYWORDS([sack synthetic system file positive])
 AT_DATA([sys-file.sack], [dnl
@@ -1053,7 +1298,7 @@ dnl File header.
 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
 2; dnl Layout code
 6; dnl Nominal case size
-1; dnl Not compressed
+1; dnl Simple compression
 0; dnl Not weighted 
 -1; dnl Unspecified number of cases.
 100.0; dnl Bias.
@@ -1117,7 +1362,7 @@ dnl File header.
 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
 2; dnl Layout code
 6; dnl Nominal case size
-1; dnl Not compressed
+1; dnl Simple compression.
 0; dnl Not weighted 
 -1; dnl Unspecified number of cases.
 0.0; dnl Bias.
@@ -1181,7 +1426,7 @@ dnl File header.
 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
 2; dnl Layout code
 6; dnl Nominal case size
-1; dnl Not compressed
+1; dnl Simple compression.
 0; dnl Not weighted 
 -1; dnl Unspecified number of cases.
 50.0; dnl Bias.
@@ -1221,10 +1466,10 @@ DISPLAY DICTIONARY.
 LIST.
 ])
   AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], 
-    [warning: `sys-file.sav' near offset 0x5c: Compression bias is not the usual value of 100, or system file uses unrecognized floating-point format.
+    [warning: `sys-file.sav' near offset 0x54: Compression bias is not the usual value of 100, or system file uses unrecognized floating-point format.
 ])
   AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl
-"warning: `sys-file.sav' near offset 0x5c: Compression bias is not the usual value of 100, or system file uses unrecognized floating-point format."
+"warning: `sys-file.sav' near offset 0x54: Compression bias is not the usual value of 100, or system file uses unrecognized floating-point format."
 
 Variable,Description,,Position
 num1,Format: F8.0,,1
@@ -1241,6 +1486,105 @@ num1,num2,str4,str8,str15
 ])
 done
 AT_CLEANUP
+
+m4_divert_push([PREPARE_TESTS])
+zcompressed_sack () {
+    cat <<'EOF'
+dnl File header.
+"$FL3"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
+2; dnl Layout code
+6; dnl Nominal case size
+2; dnl zlib compressed
+0; dnl Not weighted
+-1; dnl Unspecified number of cases.
+100.0; dnl Bias.
+"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
+i8 0 *3;
+
+dnl Numeric variables.
+2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
+2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
+
+dnl String variable.
+2; 4; 0; 0; 0x010400 *2; s8 "STR4";
+2; 8; 0; 0; 0x010800 *2; s8 "STR8";
+2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
+2; -1; 0; 0; 0; 0; s8 "";
+
+dnl Dictionary termination record.
+999; 0;
+
+dnl ZLIB data header.
+i64 0x178;    # zheader_ofs
+i64 0x1e9;    # ztrailer_ofs
+i64 48;       # ztrailer_len
+
+dnl ZLIB data block.
+dnl
+dnl This is the compressed form of:
+dnl
+dnl 01 64 fe fd fe fd ff fb  61 62 63 64 65 66 67 68  |.d......abcdefgh|
+dnl 30 31 32 33 20 20 20 20  fd fd fd fe 65 66 fd fd  |0123    ....ef..|
+dnl 6a 6b 6c 6d 20 20 20 20  6e 6f 70 71 72 73 74 75  |jklm    nopqrstu|
+dnl 76 77 78 79 7a 41 42 43  44 45 46 47 20 20 20 20  |vwxyzABCDEFG    |
+dnl 48 49 4a 4b 4c 4d 4e 4f  fe fd fc 00 00 00 00 00  |HIJKLMNO........|
+dnl 50 51 52 53 54 55 56 57                           |PQRSTUVW|
+dnl
+dnl which is the data from the "compressed data" test.
+hex "78 01 63 4c f9 f7 f7 df  df ff bf 13 93 92 53 52";
+hex "d3 d2 33 0c 0c 8d 8c 15  80 e0 ef df bf ff 52 d3";
+hex "fe fe cd ca ce c9 05 f1  f3 f2 0b 0a 8b 8a 4b 4a";
+hex "cb ca 2b 2a ab 1c 9d 9c  5d 5c dd dc 41 e2 1e 9e";
+hex "5e de 3e be 7e fe ff fe  fe 61 00 81 80 c0 a0 e0";
+hex "90 d0 b0 70 00 0f 3f 23  d7";
+
+dnl ZLIB data trailer fixed header:
+i64 -100;     # ztrailer_bias
+i64 0;        # ztrailer_zero
+0x3ff000;     # block_size
+1;            # n_blocks
+
+dnl ZLIB block descriptor:
+i64 0x178;    # uncompressed_ofs
+i64 0x190;    # compressed_ofs
+88;           # uncompressed_size
+89;           # compressed_size
+EOF
+}
+m4_divert_pop([PREPARE_TESTS])
+
+AT_SETUP([zcompressed data])
+AT_KEYWORDS([sack synthetic system file positive zlib])
+zcompressed_sack > sys-file.sack
+for variant in \
+       "be 2d706c3ca0cc9be7f1721f09d0d42179" \
+       "le 3f362f338d65b0a836b3c752cc3fc5bc"
+do
+  set $variant
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
+])
+  AT_DATA([sys-file.sps], [dnl
+GET FILE='sys-file.sav'.
+DISPLAY DICTIONARY.
+LIST.
+])
+  AT_CHECK([pspp -o pspp.csv sys-file.sps])
+  AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl
+Variable,Description,,Position
+num1,Format: F8.0,,1
+num2,Format: F8.0,,2
+str4,Format: A4,,3
+str8,Format: A8,,4
+str15,Format: A15,,5
+
+Table: Data List
+num1,num2,str4,str8,str15
+-99,0,,abcdefgh,0123   @&t@
+.,151,jklm,nopqrstu,vwxyzABC       @&t@
+1,2,DEFG,HIJKLMNO,PQRSTUV
+])
+done
+AT_CLEANUP
 \f
 AT_BANNER([system file reader - negative])
 
@@ -1268,8 +1612,6 @@ do
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
    [error: `sys-file.sav' near offset 0xd4: Misplaced type 4 record.
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
 ])
 done
 AT_CLEANUP
@@ -1298,8 +1640,6 @@ do
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
    [error: `sys-file.sav' near offset 0xd4: Unrecognized record type 8.
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
 ])
 done
 AT_CLEANUP
@@ -1327,7 +1667,7 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], 
-   [warning: `sys-file.sav' near offset 0xd8: File header claims 2 variable positions but 1 were read from file.
+   [warning: `sys-file.sav': File header claims 2 variable positions but 1 were read from file.
 ])
 done
 AT_CLEANUP
@@ -1355,9 +1695,7 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
-   [error: `sys-file.sav' near offset 0xd0: Variable name begins with invalid character `$'.
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+   [error: `sys-file.sav' near offset 0xb4: Invalid variable name `$UM1'.
 ])
 done
 AT_CLEANUP
@@ -1385,9 +1723,7 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
-   [error: `sys-file.sav' near offset 0xd0: Invalid variable name `TO'.
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+   [error: `sys-file.sav' near offset 0xb4: Invalid variable name `TO'.
 ])
 done
 AT_CLEANUP
@@ -1415,13 +1751,13 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
-   [error: `sys-file.sav' near offset 0xd0: Bad width 256 for variable VAR1.
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+   [error: `sys-file.sav' near offset 0xb4: Bad width 256 for variable VAR1.
 ])
 done
 AT_CLEANUP
 
+dnl SPSS-generated system file can contain duplicate variable names
+dnl (see bug #41475).
 AT_SETUP([duplicate variable name])
 AT_KEYWORDS([sack synthetic system file negative])
 AT_DATA([sys-file.sack], [dnl
@@ -1444,11 +1780,20 @@ do
   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
 ])
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
+DISPLAY DICTIONARY.
 ])
-  AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
-   [error: `sys-file.sav' near offset 0xf0: Duplicate variable name `VAR1'.
+  AT_CHECK([pspp -O format=csv sys-file.sps], [0],
+   [warning: `sys-file.sav' near offset 0xd4: Renaming variable with duplicate name `VAR1' to `VAR001'.
 
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+Variable,Description,,Position
+var1,Format: F8.0,,1
+,Measure: Scale,,
+,Display Alignment: Right,,
+,Display Width: 8,,
+var001,Format: F8.0,,2
+,Measure: Scale,,
+,Display Alignment: Right,,
+,Display Width: 8,,
 ])
 done
 AT_CLEANUP
@@ -1476,9 +1821,7 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
-   [error: `sys-file.sav' near offset 0xd0: Variable label indicator field is not 0 or 1.
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+   [error: `sys-file.sav' near offset 0xb4: Variable label indicator field is not 0 or 1.
 ])
 done
 AT_CLEANUP
@@ -1506,9 +1849,7 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
-   ["error: `sys-file.sav' near offset 0xd0: Numeric missing value indicator field is not -3, -2, 0, 1, 2, or 3."
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+   ["error: `sys-file.sav' near offset 0xb4: Numeric missing value indicator field is not -3, -2, 0, 1, 2, or 3."
 ])
 done
 AT_CLEANUP
@@ -1536,9 +1877,7 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
-   ["error: `sys-file.sav' near offset 0xd0: String missing value indicator field is not 0, 1, 2, or 3."
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+   ["error: `sys-file.sav' near offset 0xb4: String missing value indicator field is not 0, 1, 2, or 3."
 ])
 done
 AT_CLEANUP
@@ -1567,49 +1906,22 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
-   [error: `sys-file.sav' near offset 0xd8: Missing string continuation record.
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+   [error: `sys-file.sav' near offset 0xb4: Missing string continuation record.
 ])
 done
 AT_CLEANUP
 
-AT_SETUP([unknown variable format])
+AT_SETUP([invalid variable format])
 AT_KEYWORDS([sack synthetic system file negative])
 AT_DATA([sys-file.sack], [dnl
 dnl File header.
 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
-2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
-
-dnl Numeric variable.
-2; 0; 0; 0; >>0xff0800<< *2; s8 "VAR1";
-
-dnl End of dictionary.
-999; 0;
-])
-for variant in \
-       "be fcf94b3ff11b7e2ff50c226b609cff1e" \
-       "le 88fc97cc80d5a170e53a7cc89e204b0d"
-do
-  set $variant
-  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
-])
-  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
-])
-  AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
-   [error: `sys-file.sav' near offset 0xd0: Unknown variable format 255.
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
-])
-done
-AT_CLEANUP
+2; 4; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
 
-AT_SETUP([invalid numeric variable format])
-AT_KEYWORDS([sack synthetic system file negative])
-AT_DATA([sys-file.sack], [dnl
-dnl File header.
-"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
-2; 3; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+dnl Numeric variable, invalid format types.
+dnl No warning is issued for type 0 because it has been observed in real
+dnl system files.
+2; 0; 0; 0; >>0xff0800; 0<<; s8 "NUM1";
 
 dnl Numeric variable, string formats.
 2; 0; 0; 0; >>0x010800<<; >>0x021000<<; s8 "VAR1";
@@ -1624,69 +1936,144 @@ dnl End of dictionary.
 999; 0;
 ])
 for variant in \
-       "be 0c36a39ec9118eb4a83f10a9483b5a37" \
-       "le 1d498d60eeb2c88e0479f113fb3ffe4b"
+       "be c6ef5d8fded46443aba89adfafe15cad" \
+       "le fccaf1764c973892f2d5adbcc2c36fb7"
 do
   set $variant
   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
 ])
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
-  AT_CHECK([pspp -O format=csv sys-file.sps], [0], 
-   [warning: `sys-file.sav' near offset 0xd0: Numeric variable VAR1 has invalid print format A8.
+  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
+warning: `sys-file.sav' near offset 0xc0: Variable NUM1 with width 0 has invalid print format 0xff0800.
 
-warning: `sys-file.sav' near offset 0xd0: Numeric variable VAR1 has invalid write format AHEX16.
+warning: `sys-file.sav' near offset 0xe0: Variable VAR1 with width 0 has invalid print format 0x10800.
 
-warning: `sys-file.sav' near offset 0xf0: String variable STR1 has invalid print format F8.0.
+warning: `sys-file.sav' near offset 0xe4: Variable VAR1 with width 0 has invalid write format 0x21000.
 
-warning: `sys-file.sav' near offset 0xf0: String variable STR1 has invalid write format E10.1.
+warning: `sys-file.sav' near offset 0x100: Variable STR1 with width 4 has invalid print format 0x50800.
 
-warning: `sys-file.sav' near offset 0x110: String variable STR2 has invalid print format A8.
+warning: `sys-file.sav' near offset 0x104: Variable STR1 with width 4 has invalid write format 0x110a01.
 
-warning: `sys-file.sav' near offset 0x110: String variable STR2 has invalid write format AHEX4.
+warning: `sys-file.sav' near offset 0x120: Variable STR2 with width 4 has invalid print format 0x10800.
+
+warning: `sys-file.sav' near offset 0x124: Variable STR2 with width 4 has invalid write format 0x20400.
 ])
 done
 AT_CLEANUP
 
-AT_SETUP([weighting variable must be numeric])
+AT_SETUP([invalid long string missing values])
 AT_KEYWORDS([sack synthetic system file negative])
 AT_DATA([sys-file.sack], [dnl
 dnl File header.
 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
-2; 2; 1; >>2<<; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+2; dnl Layout code
+7; dnl Nominal case size
+0; dnl Not compressed
+0; dnl Not weighted
+1; dnl 1 case.
+100.0; dnl Bias.
+"01 Jan 11"; "20:53:52";
+"PSPP synthetic test file: "; i8 244; i8 245; i8 246; i8 248; s34 "";
+i8 0 *3;
 
-dnl Numeric variable.
+dnl One numeric variable.
 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
 
-dnl String variable.
-2; 4; 0; 0; 0x010400 *2; s8 "STR1";
+dnl Long string variables that will have missing values added with a
+dnl later record.
+2; 9; 0; 0; 0x010900 *2; s8 "STR1";
+2; -1; 0; 0; 0; 0; s8 "";
+2; 10; 0; 0; 0x010a00 *2; s8 "STR2";
+2; -1; 0; 0; 0; 0; s8 "";
+2; 11; 0; 0; 0x010b00 *2; s8 "STR3";
+2; -1; 0; 0; 0; 0; s8 "";
 
-dnl End of dictionary.
-999; 0;
-])
-for variant in \
-       "be 82d30105e46c4896c24f9dcec26c4749" \
-       "le 32e235119be70050eb78bf4186a5a046"
+dnl Machine integer info record.
+7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
+
+dnl Machine floating-point info record.
+7; 4; 8; 3; SYSMIS; HIGHEST; LOWEST;
+
+dnl Long string variable missing values record.
+7; 22; 1; COUNT (
+dnl Zero missing values (not allowed) for STR1 .
+COUNT("STR1"); i8 >>0<<;
+
+dnl Four missing values (not allowed) for STR2.
+COUNT("STR2"); i8 4;
+8; "abcdefgh"; 8; "ijklmnop"; 8; "qrstuvwx"; 8; "yz012345";
+
+dnl Missing values for unknown variable
+COUNT(>>"Nonexistent"<<); i8 1; 8; "abcdefgh";
+
+dnl Missing values for numeric variable
+COUNT(>>"NUM1"<<); i8 1; 8; "abcdefgh";
+
+dnl Too long missing value
+COUNT("STR3"); i8 1; >>COUNT("abcdefghijkl")<<;
+);
+
+dnl Character encoding record.
+7; 20; 1; 12; "windows-1252";
+
+dnl Dictionary termination record.
+999; 0;
+s8 "abcd"; s8 "efgh"; s8 "ijkl"; s8 "mnop"; s8 "qrst"; s8 "uvwx";
+s16 "yzABCDEFGHI"; s16 "JKLMNOPQR"; s16 "STUVWXYZ01";
+s16 "23456789abc"; s32 "defghijklmnopqstuvwxyzABC";
+])
+
+for variant in \
+       "be 26e815cfb41eaedb435ea3c81b96215c" \
+       "le 72d70456bd4dc88bb0a0fdb039ccdfa3"
 do
   set $variant
   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
 ])
-  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
+  AT_DATA([sys-file.sps], [dnl
+GET FILE='sys-file.sav'.
+DISPLAY DICTIONARY.
 ])
-  AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
-   [error: `sys-file.sav' near offset 0xf4: Weighting variable must be numeric (not string variable `STR1').
+  AT_CHECK([pspp -O format=csv sys-file.sps], [0],
+   ["warning: `sys-file.sav' near offset 0x1f8: Long string missing values record says variable STR1 has 0 missing values, but only 1 to 3 missing values are allowed."
+
+"warning: `sys-file.sav' near offset 0x201: Long string missing values record says variable STR2 has 4 missing values, but only 1 to 3 missing values are allowed."
+
+warning: `sys-file.sav' near offset 0x242: Ignoring long string missing value record for unknown variable Nonexistent.
+
+warning: `sys-file.sav' near offset 0x257: Ignoring long string missing value record for numeric variable NUM1.
 
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+"warning: `sys-file.sav' near offset 0x270: Ignoring long string missing value 0 for variable str3, with width 11, that has bad value width 12."
+
+Variable,Description,,Position
+num1,Format: F8.0,,1
+,Measure: Scale,,
+,Display Alignment: Right,,
+,Display Width: 8,,
+str1,Format: A9,,2
+,Measure: Nominal,,
+,Display Alignment: Left,,
+,Display Width: 9,,
+str2,Format: A10,,3
+,Measure: Nominal,,
+,Display Alignment: Left,,
+,Display Width: 10,,
+,"Missing Values: ""abcdefgh""; ""ijklmnop""; ""qrstuvwx""",,
+str3,Format: A11,,4
+,Measure: Nominal,,
+,Display Alignment: Left,,
+,Display Width: 11,,
 ])
 done
 AT_CLEANUP
 
-AT_SETUP([bad weighting variable index])
+AT_SETUP([weighting variable must be numeric])
 AT_KEYWORDS([sack synthetic system file negative])
 AT_DATA([sys-file.sack], [dnl
 dnl File header.
 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
-2; 2; 1; >>3<<; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+2; 2; 1; >>2<<; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
 
 dnl Numeric variable.
 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
@@ -1698,23 +2085,32 @@ dnl End of dictionary.
 999; 0;
 ])
 for variant in \
-       "be cd9af924ff20bc75834aa2c696254c97" \
-       "le cbe0f2f514f5e95f27644d0b4314bc78"
+       "be 82d30105e46c4896c24f9dcec26c4749" \
+       "le 32e235119be70050eb78bf4186a5a046"
 do
   set $variant
   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
 ])
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
+DISPLAY DICTIONARY.
 ])
-  AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
-   [error: `sys-file.sav' near offset 0xf4: Variable index 3 not in valid range 1...2.
+  AT_CHECK([pspp -O format=csv sys-file.sps], [0],
+   [warning: `sys-file.sav': Ignoring string variable `STR1' set as weighting variable.
 
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+Variable,Description,,Position
+num1,Format: F8.0,,1
+,Measure: Scale,,
+,Display Alignment: Right,,
+,Display Width: 8,,
+str1,Format: A4,,2
+,Measure: Nominal,,
+,Display Alignment: Left,,
+,Display Width: 4,,
 ])
 done
 AT_CLEANUP
 
-AT_SETUP([variable index is long string contination])
+AT_SETUP([bad weighting variable index])
 AT_KEYWORDS([sack synthetic system file negative])
 AT_DATA([sys-file.sack], [dnl
 dnl File header.
@@ -1724,16 +2120,15 @@ dnl File header.
 dnl Numeric variable.
 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
 
-dnl Long string variable.
-2; 9; 0; 0; 0x010900 *2; s8 "STR1";
-(2; -1; 0; 0; 0; 0; s8 "");
+dnl String variable.
+2; 4; 0; 0; 0x010400 *2; s8 "STR1";
 
 dnl End of dictionary.
 999; 0;
 ])
 for variant in \
-       "be 0c395354df56ea5ff374aafcc535d633" \
-       "le d977f684ea9d4648ed40f8c6dddde9f7"
+       "be cd9af924ff20bc75834aa2c696254c97" \
+       "le cbe0f2f514f5e95f27644d0b4314bc78"
 do
   set $variant
   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
@@ -1741,52 +2136,44 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
-   [error: `sys-file.sav' near offset 0x114: Variable index 3 refers to long string continuation.
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+   [error: `sys-file.sav' near offset 0x4c: Variable index 3 not in valid range 1...2.
 ])
 done
 AT_CLEANUP
 
-AT_SETUP([multiple documents records])
+AT_SETUP([variable index is long string contination])
 AT_KEYWORDS([sack synthetic system file negative])
 AT_DATA([sys-file.sack], [dnl
 dnl File header.
 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
-2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+2; 3; 1; >>3<<; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
 
-dnl Numeric variable, no label or missing values.
+dnl Numeric variable.
 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
 
-dnl Two document records.
-(6; 1; s80 "One line of documents") >>* 2<<;
+dnl Long string variable.
+2; 9; 0; 0; 0x010900 *2; s8 "STR1";
+(2; -1; 0; 0; 0; 0; s8 "");
 
-dnl Dictionary termination record.
+dnl End of dictionary.
 999; 0;
-
-dnl Data.
-1.0;
 ])
 for variant in \
-       "be 18aa3348a216ed494efe28285b348fa8" \
-       "le 19b21522bcef1dcc60af328f923f307e"
+       "be e47d2d0e65846a9b534e004f0ae65083" \
+       "le e5e6e00f34c4697c7bee21f15f86c7e3"
 do
   set $variant
   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
 ])
-  AT_DATA([sys-file.sps], [dnl
-GET FILE='sys-file.sav'.
+  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
-  AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
-error: `sys-file.sav' near offset 0x12c: Multiple type 6 (document) records.
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+  AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
+   [error: `sys-file.sav' near offset 0x4c: Variable index 3 refers to long string continuation.
 ])
 done
 AT_CLEANUP
 
-
-AT_SETUP([empty document record])
+AT_SETUP([multiple documents records])
 AT_KEYWORDS([sack synthetic system file negative])
 AT_DATA([sys-file.sack], [dnl
 dnl File header.
@@ -1796,8 +2183,8 @@ dnl File header.
 dnl Numeric variable, no label or missing values.
 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
 
-dnl Empty document record.
-6; >>0<<;
+dnl Two document records.
+(6; 1; s80 "One line of documents") >>* 2<<;
 
 dnl Dictionary termination record.
 999; 0;
@@ -1806,8 +2193,8 @@ dnl Data.
 1.0;
 ])
 for variant in \
-       "be d8ef29c1b97f9ed226cbd938c9c49b6e" \
-       "le f6a560c5b62e2c472429d85294f36e61"
+       "be 18aa3348a216ed494efe28285b348fa8" \
+       "le 19b21522bcef1dcc60af328f923f307e"
 do
   set $variant
   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
@@ -1816,14 +2203,13 @@ do
 GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
-error: `sys-file.sav' near offset 0xd8: Number of document lines (0) must be greater than 0.
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+error: `sys-file.sav' near offset 0x12c: Duplicate type 6 (document) record.
 ])
 done
 AT_CLEANUP
 
-AT_SETUP([document contains null byte])
+
+AT_SETUP([empty document record])
 AT_KEYWORDS([sack synthetic system file negative])
 AT_DATA([sys-file.sack], [dnl
 dnl File header.
@@ -1833,8 +2219,8 @@ dnl File header.
 dnl Numeric variable, no label or missing values.
 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
 
-dnl Document record.
-6; 1; >>i8 0<<; s79 "One line of documents";
+dnl Empty document record.
+6; >>0<<;
 
 dnl Dictionary termination record.
 999; 0;
@@ -1843,8 +2229,8 @@ dnl Data.
 1.0;
 ])
 for variant in \
-       "be 24b5f451ae2559785c1a38358c511e39" \
-       "le b7e9802506307c28343293144bd6d4f4"
+       "be d8ef29c1b97f9ed226cbd938c9c49b6e" \
+       "le f6a560c5b62e2c472429d85294f36e61"
 do
   set $variant
   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
@@ -1853,9 +2239,7 @@ do
 GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
-error: `sys-file.sav' near offset 0x128: Document line contains null byte.
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+error: `sys-file.sav' near offset 0xd4: Number of document lines (0) must be greater than 0 and less than 26843545.
 ])
 done
 AT_CLEANUP
@@ -1884,9 +2268,7 @@ do
 GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
-error: `sys-file.sav' near offset 0xe0: Record type 7 subtype 3 too large.
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+error: `sys-file.sav' near offset 0xd8: Record type 7 subtype 3 too large.
 ])
 done
 AT_CLEANUP
@@ -1918,7 +2300,7 @@ do
 GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-"warning: `sys-file.sav' near offset 0xe0: Unrecognized record type 7, subtype 30.  Please send a copy of this file, and the syntax which created it to bug-gnu-pspp@gnu.org."
+"warning: `sys-file.sav' near offset 0xd8: Unrecognized record type 7, subtype 30.  Please send a copy of this file, and the syntax which created it to bug-gnu-pspp@gnu.org."
 ])
 done
 AT_CLEANUP
@@ -1928,27 +2310,27 @@ AT_KEYWORDS([sack synthetic system file negative])
 AT_DATA([sys-file.sack], [dnl
 dnl File header.
 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
-2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
 
 dnl Numeric variable, no label or missing values.
 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
 
 dnl Machine integer info record.
-7; 3; 4; >>9<<; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
+7; 3; 4; >>9<<; 1; 2; 3; -1; 1; 1; ENDIAN; 1252; >>1234<<;
+
+dnl End of dictionary.
+999; 0;
 ])
 for variant in \
        "be 21ec84826886b0a266d1360f8279d769" \
        "le 15dcba7b2b89b7d8a21ebcc872f515af"
 do
   set $variant
-  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
-])
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [ignore])
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
-  AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
-"error: `sys-file.sav' near offset 0x100: Bad size (4) or count (9) field on record type 7, subtype 3."
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
+"warning: `sys-file.sav' near offset 0xd8: Record type 7, subtype 3 has bad count 9 (expected 8)."
 ])
 done
 AT_CLEANUP
@@ -1965,20 +2347,20 @@ dnl Numeric variable, no label or missing values.
 
 dnl Machine integer info record.
 7; 3; 4; 8; 1; 2; 3; -1; >>2<<; 1; ENDIAN; 1252;
+
+dnl End of dictionary.
+999; 0;
 ])
 for variant in \
        "be d510ed28278649eee997fb6881a4c04f" \
        "le fbf1eca561a4e243b7ae844ed1677035"
 do
   set $variant
-  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
-])
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [ignore])
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
-error: `sys-file.sav' near offset 0x100: Floating-point representation indicated by system file (2) differs from expected (1).
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+error: `sys-file.sav' near offset 0xd8: Floating-point representation indicated by system file (2) differs from expected (1).
 ])
 done
 AT_CLEANUP
@@ -2011,7 +2393,7 @@ GET FILE='sys-file.sav'.
 DISPLAY DICTIONARY.
 ])
   AT_CHECK_UNQUOTED([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: \`sys-file.sav' near offset 0x100: Integer format indicated by system file (3) differs from expected ($[3]).
+warning: \`sys-file.sav' near offset 0xd8: Integer format indicated by system file (3) differs from expected ($[3]).
 
 Variable,Description,,Position
 num1,Format: F8.0,,1
@@ -2028,27 +2410,27 @@ AT_KEYWORDS([sack synthetic system file negative])
 AT_DATA([sys-file.sack], [dnl
 dnl File header.
 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
-2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
 
 dnl Numeric variable, no label or missing values.
 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
 
 dnl Machine floating-point info record.
 7; 4; 8; >>4<<; SYSMIS; HIGHEST; LOWEST; 0.0;
+
+dnl End of dictionary.
+999; 0;
 ])
 for variant in \
        "be 29c9a173638fbb8bb1efe1176c4d670f" \
        "le 5cb49eb1084e5b9cd573a54705ff86a7"
 do
   set $variant
-  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
-])
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [ignore])
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
-  AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
-error: `sys-file.sav' near offset 0xf8: Bad size (8) or count (4) on extension 4.
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
+"warning: `sys-file.sav' near offset 0xd8: Record type 7, subtype 4 has bad count 4 (expected 3)."
 ])
 done
 AT_CLEANUP
@@ -2078,12 +2460,12 @@ do
 ])
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
-  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xf8: File specifies unexpected value 0 as SYSMIS.
+  AT_CHECK([pspp -O format=csv sys-file.sps | sed 's/ [(].*/.../'], [0], [dnl
+"warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 0...
 
-warning: `sys-file.sav' near offset 0xf8: File specifies unexpected value 1 as HIGHEST.
+"warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 1...
 
-warning: `sys-file.sav' near offset 0xf8: File specifies unexpected value 2 as LOWEST.
+"warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 2...
 ])
 done
 AT_CLEANUP
@@ -2093,30 +2475,102 @@ AT_KEYWORDS([sack synthetic system file negative multiple response])
 AT_DATA([sys-file.sack], [dnl
 dnl File header.
 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
-2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+2; dnl Layout code
+16; dnl Nominal case size
+0; dnl Not compressed
+0; dnl Not weighted
+0; dnl No cases.
+100.0; dnl Bias.
+"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
+i8 0 *3;
 
-dnl Numeric variable, no label or missing values.
-2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
+dnl $a
+2; 0; 0; 0; 0x050800 *2; i8 0x82; i8 0xa0; s6 "";
+2; 0; 0; 0; 0x050800 *2; s8 "B";
+2; 0; 0; 0; 0x050800 *2; s8 "C";
 
-dnl Multiple response sets.
-7; 7; 1; COUNT("a=C");
-7; 19; 1; COUNT("xyz=D");
+dnl $b
+2; 0; 0; 0; 0x050800 *2; s8 "D";
+2; 0; 0; 0; 0x050800 *2; s8 "E";
+2; 0; 0; 0; 0x050800 *2; s8 "F";
+2; 0; 0; 0; 0x050800 *2; s8 "G";
+
+dnl $c
+2; 4; 0; 0; 0x010400 *2; s8 "H";
+2; 4; 0; 0; 0x010400 *2; s8 "I";
+2; 4; 0; 0; 0x010400 *2; s8 "J";
+
+dnl $d
+2; 0; 0; 0; 0x050800 *2; s8 "K";
+2; 0; 0; 0; 0x050800 *2; s8 "L";
+2; 0; 0; 0; 0x050800 *2; s8 "M";
+
+dnl $e
+2; 6; 0; 0; 0x010600 *2; s8 "N";
+2; 6; 0; 0; 0x010600 *2; s8 "O";
+2; 6; 0; 0; 0x010600 *2; s8 "P";
+
+dnl Machine integer info record.
+7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 932;
+
+7; 7; 1;
+COUNT(
+  "$a=C 10 my mcgroup "; i8 0x82; i8 0xa0; " b c"; i8 10;
+  "b=D2 55 0  g e f d"; i8 10;
+  "$c=D4 "; i8 0x82; i8 0xcd; i8 0x82; i8 0xa2; " 10 mdgroup #2 h i j"; i8 10);
+
+7; 19; 1;
+COUNT(
+  "$d=E 1 2 34 13 third mdgroup k l m"; i8 10;
+  "e=E 11 6 choice 0  n o p"; i8 10);
+
+dnl Character encoding record.
+7; 20; 1; 9; "shift_jis";
 
+dnl Dictionary termination record.
 999; 0;
 ])
 for variant in \
-       "be 15a9bf44d0cd6186a60629b77079c5a5" \
-       "le 161c99aca5e7a3684df096137e72ce5b"
+       "be 8832b331e09557a1ac0bf4e31611428a" \
+       "le 1c1dcd9930864632402b5c635395cb51"
 do
   set $variant
   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
 ])
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
+MRSETS /DISPLAY NAME=ALL.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xe3: `a' does not begin with `$' at offset 2 in MRSETS record.
+warning: `sys-file.sav': Multiple response set name `b' does not begin with `$'.
+
+warning: `sys-file.sav': Multiple response set name `e' does not begin with `$'.
 
-warning: `sys-file.sav' near offset 0xf8: `xyz' does not begin with `$' at offset 4 in MRSETS record.
+Table: Multiple Response Sets
+Name,Variables,Details
+$a,"あ
+b
+c
+","Multiple category set
+Label: my mcgroup
+"
+$c,"h
+i
+j
+","Multiple dichotomy set
+Label: mdgroup #2
+Label source: Provided by user
+Counted value: `はい'
+Category label source: Variable labels
+"
+$d,"k
+l
+m
+","Multiple dichotomy set
+Label: third mdgroup
+Label source: Provided by user
+Counted value: 34
+Category label source: Value labels of counted value
+"
 ])
 done
 AT_CLEANUP
@@ -2146,7 +2600,7 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xe5: Missing space following `C' at offset 4 in MRSETS record.
+warning: `sys-file.sav' near offset 0xd8: Missing space following `C' at offset 4 in MRSETS record.
 ])
 done
 AT_CLEANUP
@@ -2176,7 +2630,7 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xe5: Missing space following `E' at offset 4 in MRSETS record.
+warning: `sys-file.sav' near offset 0xd8: Missing space following `E' at offset 4 in MRSETS record.
 ])
 done
 AT_CLEANUP
@@ -2206,9 +2660,9 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xe6: Unexpected label source value `2' following `E' at offset 7 in MRSETS record.
+warning: `sys-file.sav' near offset 0xd8: Unexpected label source value following `E' at offset 7 in MRSETS record.
 
-warning: `sys-file.sav' near offset 0xe6: Expecting digit at offset 7 in MRSETS record.
+warning: `sys-file.sav' near offset 0xd8: Expecting digit at offset 7 in MRSETS record.
 ])
 done
 AT_CLEANUP
@@ -2238,7 +2692,7 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-"warning: `sys-file.sav' near offset 0xe3: Missing `C', `D', or `E' at offset 3 in MRSETS record."
+"warning: `sys-file.sav' near offset 0xd8: Missing `C', `D', or `E' at offset 3 in MRSETS record."
 ])
 done
 AT_CLEANUP
@@ -2268,7 +2722,7 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xe5: Expecting digit at offset 4 in MRSETS record.
+warning: `sys-file.sav' near offset 0xd8: Expecting digit at offset 4 in MRSETS record.
 ])
 done
 AT_CLEANUP
@@ -2298,7 +2752,7 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xe6: Expecting space at offset 5 in MRSETS record.
+warning: `sys-file.sav' near offset 0xd8: Expecting space at offset 5 in MRSETS record.
 ])
 done
 AT_CLEANUP
@@ -2328,7 +2782,7 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xe9: 4-byte string starting at offset 6 exceeds record length 9.
+warning: `sys-file.sav' near offset 0xd8: 4-byte string starting at offset 6 exceeds record length 9.
 ])
 done
 AT_CLEANUP
@@ -2358,7 +2812,7 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xea: Expecting space at offset 9 following 3-byte string.
+warning: `sys-file.sav' near offset 0xd8: Expecting space at offset 9 following 3-byte string.
 ])
 done
 AT_CLEANUP
@@ -2388,9 +2842,9 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xec: Missing new-line parsing variable names at offset 14 in MRSETS record.
+warning: `sys-file.sav' near offset 0xd8: Missing new-line parsing variable names at offset 13 in MRSETS record.
 
-warning: `sys-file.sav' near offset 0xec: MRSET $a has only 1 variables.
+warning: `sys-file.sav': MRSET $a has only one variable.
 ])
 done
 AT_CLEANUP
@@ -2420,9 +2874,9 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xf2: Duplicate variable name NUM1 at offset 18 in MRSETS record.
+warning: `sys-file.sav': MRSET $a contains duplicate variable name NUM1.
 
-warning: `sys-file.sav' near offset 0xf2: MRSET $a has only 1 variables.
+warning: `sys-file.sav': MRSET $a has only one variable.
 ])
 done
 AT_CLEANUP
@@ -2453,9 +2907,9 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0x112: MRSET $a contains both string and numeric variables.
+warning: `sys-file.sav': MRSET $a contains both string and numeric variables.
 
-warning: `sys-file.sav' near offset 0x112: MRSET $a has only 1 variables.
+warning: `sys-file.sav': MRSET $a has only one variable.
 ])
 done
 AT_CLEANUP
@@ -2485,12 +2939,12 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xed: MRSET $a has only 1 variables.
+warning: `sys-file.sav': MRSET $a has only one variable.
 ])
 done
 AT_CLEANUP
 
-AT_SETUP([only one variable in mrset])
+AT_SETUP([zero or one variable in mrset])
 AT_KEYWORDS([sack synthetic system file negative multiple response])
 AT_DATA([sys-file.sack], [dnl
 dnl File header.
@@ -2501,13 +2955,13 @@ dnl Numeric variable, no label or missing values.
 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
 
 dnl Multiple response sets.
-7; 7; 1; COUNT("$a=C 0  NUM1"; i8 10);
+7; 7; 1; COUNT("$a=C 0  NUM1"; i8 10; "$b=C 0  "; i8 10);
 
 999; 0;
 ])
 for variant in \
-       "be 3a891e0a467afb3d622629c70f329ada" \
-       "le 432998ec08370510411af4f5207c015e"
+       "be d94549fece75560fe5b47f32713b63a1" \
+       "le 63028521d460df9e998b40a75a93c330"
 do
   set $variant
   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
@@ -2515,7 +2969,9 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xed: MRSET $a has only 1 variables.
+warning: `sys-file.sav': MRSET $a has only one variable.
+
+warning: `sys-file.sav': MRSET $b has no variables.
 ])
 done
 AT_CLEANUP
@@ -2546,7 +3002,7 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xe0: Bad size 8 on extension 11.
+"warning: `sys-file.sav' near offset 0xd8: Record type 7, subtype 11 has bad size 8 (expected 4)."
 ])
 done
 AT_CLEANUP
@@ -2577,7 +3033,7 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xe0: Extension 11 has bad count 4 (for 1 variables).
+warning: `sys-file.sav' near offset 0xd8: Extension 11 has bad count 4 (for 1 variables).
 ])
 done
 AT_CLEANUP
@@ -2608,7 +3064,7 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xe8: Invalid variable display parameters for variable 0 (NUM1).  Default parameters substituted.
+warning: `sys-file.sav' near offset 0xd8: Invalid variable display parameters for variable 0 (NUM1).  Default parameters substituted.
 ])
 done
 AT_CLEANUP
@@ -2639,7 +3095,7 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xe8: Invalid variable display parameters for variable 0 (NUM1).  Default parameters substituted.
+warning: `sys-file.sav' near offset 0xd8: Invalid variable display parameters for variable 0 (NUM1).  Default parameters substituted.
 ])
 done
 AT_CLEANUP
@@ -2671,7 +3127,7 @@ do
 GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xe5: Dictionary record refers to unknown variable xyzzy.
+warning: `sys-file.sav' near offset 0xde: Dictionary record refers to unknown variable xyzzy.
 ])
 done
 AT_CLEANUP
@@ -2710,9 +3166,9 @@ do
 GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0x186: Long variable mapping from LONGVARI to invalid variable name `_Invalid'.
+warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `_Invalid'.
 
-warning: `sys-file.sav' near offset 0x186: Duplicate long variable name `LONGVARIABLENAME'.
+warning: `sys-file.sav' near offset 0x138: Duplicate long variable name `LONGVARIABLENAME'.
 ])
 done
 AT_CLEANUP
@@ -2748,13 +3204,11 @@ do
 GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
-warning: `sys-file.sav' near offset 0x104: NUM1 listed as string of invalid length 00000 in very long string record.
-
-"warning: `sys-file.sav' near offset 0x104: NUM1 listed in very long string record with width 00255, which requires only one segment."
+warning: `sys-file.sav' near offset 0xd8: NUM1 listed as string of invalid length 00000 in very long string record.
 
-error: `sys-file.sav' near offset 0x104: Very long string NUM1 overflows dictionary.
+"warning: `sys-file.sav' near offset 0xd8: NUM1 listed in very long string record with width 00255, which requires only one segment."
 
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+error: `sys-file.sav' near offset 0xd8: Very long string NUM1 overflows dictionary.
 ])
 done
 AT_CLEANUP
@@ -2791,9 +3245,7 @@ do
 GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
-error: `sys-file.sav' near offset 0x50c: Very long string with width 256 has segment 1 of width 9 (expected 4).
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+error: `sys-file.sav' near offset 0x4f8: Very long string with width 256 has segment 1 of width 9 (expected 4).
 ])
 done
 AT_CLEANUP
@@ -2823,9 +3275,7 @@ do
 GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
-error: `sys-file.sav' near offset 0xd8: Invalid number of labels 2147483647.
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+error: `sys-file.sav' near offset 0xd4: Invalid number of labels 2147483647.
 ])
 done
 AT_CLEANUP
@@ -2857,9 +3307,7 @@ do
 GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
-error: `sys-file.sav' near offset 0xec: Variable index record (type 4) does not immediately follow value label record (type 3) as it should.
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+error: `sys-file.sav' near offset 0xe8: Variable index record (type 4) does not immediately follow value label record (type 3) as it should.
 ])
 done
 AT_CLEANUP
@@ -2888,9 +3336,7 @@ do
 GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
-error: `sys-file.sav' near offset 0xf0: Number of variables associated with a value label (0) is not between 1 and the number of variables (1).
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+error: `sys-file.sav' near offset 0xec: Number of variables associated with a value label (0) is not between 1 and the number of variables (1).
 ])
 done
 AT_CLEANUP
@@ -2908,21 +3354,21 @@ dnl Long string variable.
 
 dnl Value label that names long string variable.
 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 1; >>1<<;
+
+dnl End of dictionary.
+999; 0;
 ])
 for variant in \
        "be 14053a4f09de4c7c4c55281534dd66f4" \
        "le 8a61cc994c659fd66307d2f0fd64ce20"
 do
   set $variant
-  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
-])
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [ignore])
   AT_DATA([sys-file.sps], [dnl
 GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
-error: `sys-file.sav' near offset 0x114: Value labels may not be added to long string variables (e.g. STR1) using records types 3 and 4.
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+error: `sys-file.sav' near offset 0xf4: Value labels may not be added to long string variables (e.g. STR1) using records types 3 and 4.
 ])
 done
 AT_CLEANUP
@@ -2940,21 +3386,21 @@ dnl Variables.
 
 dnl Value label that names numeric and string variables.
 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>1; 2<<;
+
+dnl End of dictionary.
+999; 0;
 ])
 for variant in \
        "be 7577c456726a88f52bbef63a8b47bf1a" \
        "le 3ba5c6af9ad0ae5cc88f9f63e726e414"
 do
   set $variant
-  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
-])
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [ignore])
   AT_DATA([sys-file.sps], [dnl
 GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
-"error: `sys-file.sav' near offset 0x118: Variables associated with value label are not all of identical type.  Variable STR1 is string, but variable NUM1 is numeric."
-
-sys-file.sps:1: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+"error: `sys-file.sav' near offset 0xf4: Variables associated with value label are not all of identical type.  Variable STR1 is string, but variable NUM1 is numeric."
 ])
 done
 AT_CLEANUP
@@ -2988,9 +3434,9 @@ do
 GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0x118: Duplicate value label for `xyzzy ' on STR1.
+warning: `sys-file.sav' near offset 0xf4: Duplicate value label for `xyzzy ' on STR1.
 
-warning: `sys-file.sav' near offset 0x140: Duplicate value label for 1 on NUM1.
+warning: `sys-file.sav' near offset 0x11c: Duplicate value label for 1 on NUM1.
 ])
 done
 AT_CLEANUP
@@ -3030,9 +3476,9 @@ do
 GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xe6: Error parsing attribute value Attr1[[1]].
+warning: `sys-file.sav' near offset 0xde: Error parsing attribute value Attr1[[1]].
 
-warning: `sys-file.sav' near offset 0x109: Error parsing attribute value fred[[2]].
+warning: `sys-file.sav' near offset 0x101: Error parsing attribute value fred[[2]].
 ])
 done
 AT_CLEANUP
@@ -3073,9 +3519,9 @@ do
 GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0xed: Attribute value Attr1[[1]] is not quoted: value.
+warning: `sys-file.sav' near offset 0xe4: Attribute value Attr1[[1]] is not quoted: value.
 
-warning: `sys-file.sav' near offset 0x10f: Attribute value fred[[1]] is not quoted: 23.
+warning: `sys-file.sav' near offset 0x106: Attribute value fred[[1]] is not quoted: 23.
 ])
 done
 AT_CLEANUP
@@ -3128,15 +3574,15 @@ do
   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
 ])
   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
-warning: `sys-file.sav' near offset 0x130: Ignoring long string value record for unknown variable STR9.
+warning: `sys-file.sav' near offset 0x128: Ignoring long string value label record for unknown variable STR9.
 
-warning: `sys-file.sav' near offset 0x16c: Ignoring long string value record for numeric variable NUM1.
+warning: `sys-file.sav' near offset 0x164: Ignoring long string value label record for numeric variable NUM1.
 
-warning: `sys-file.sav' near offset 0x19b: Ignoring long string value record for variable STR14 because the record's width (9) does not match the variable's width (14).
+warning: `sys-file.sav' near offset 0x193: Ignoring long string value label record for variable STR14 because the record's width (9) does not match the variable's width (14).
 
-"warning: `sys-file.sav' near offset 0x1dc: Ignoring long string value 0 for variable STR14, with width 14, that has bad value width 9."
+"warning: `sys-file.sav' near offset 0x1d4: Ignoring long string value label 0 for variable str14, with width 14, that has bad value width 9."
 
-warning: `sys-file.sav' near offset 0x289: Duplicate value label for `abcdefghijklmn' on STR14.
+warning: `sys-file.sav' near offset 0x259: Duplicate value label for `abcdefghijklmn' on str14.
 ])
 done
 AT_CLEANUP
@@ -3179,8 +3625,6 @@ num1,num2
 3,4
 5,6
 7,8
-
-sys-file.sps:2: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
 ])
 done
 AT_CLEANUP
@@ -3217,8 +3661,6 @@ LIST.
 Table: Data List
 num1,num2
 1,2
-
-sys-file.sps:2: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
 ])
 done
 AT_CLEANUP
@@ -3255,8 +3697,6 @@ LIST.
 Table: Data List
 str14
 one data item @&t@
-
-sys-file.sps:2: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
 ])
 done
 AT_CLEANUP
@@ -3307,9 +3747,300 @@ LIST.
 Table: Data List
 num1,num2,str4,str8,str15
 -99,0,,abcdefgh,0123   @&t@
+])
+done
+AT_CLEANUP
+
+AT_SETUP([zcompressed data - bad zheader_ofs])
+AT_KEYWORDS([sack synthetic system file negative zlib])
+zcompressed_sack | sed 's/.*zheader_ofs.*/>>i64 0<<;/' > sys-file.sack
+for variant in \
+       "be 6d5c32f34fa1bed6f9b8f7045d104fdc" \
+       "le 1f67fbda4f0021143e141fe8403c5a97"
+do
+  set $variant
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
+])
+  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
+])
+  AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x178: Wrong ZLIB data header offset 0 (expected 0x178).
+])
+done
+AT_CLEANUP
+
+AT_SETUP([zcompressed data - bad ztrailer_ofs])
+AT_KEYWORDS([sack synthetic system file negative zlib])
+zcompressed_sack | sed 's/.*ztrailer_ofs.*/>>i64 0<<;/' > sys-file.sack
+for variant in \
+       "be e2c8dec0c62d3d798825ad5906370634" \
+       "le c1cff4cdddeee80bf1580cbc26fa9fd5"
+do
+  set $variant
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
+])
+  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
+])
+  AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x178: Impossible ZLIB trailer offset 0x0.
+])
+done
+AT_CLEANUP
+
+# ztrailer_len must be a multiple of 24 and at least 48,
+# so a value of 12 is impossible.
+AT_SETUP([zcompressed data - invalid ztrailer_len])
+AT_KEYWORDS([sack synthetic system file negative zlib])
+zcompressed_sack | sed 's/.*ztrailer_len.*/>>i64 12<<;/' > sys-file.sack
+for variant in \
+       "be 27f5203463bc4c7644382f24ae87f84c" \
+       "le 0035fa6ee7690720429715150ede85f4"
+do
+  set $variant
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
+])
+  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
+])
+  AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x178: Invalid ZLIB trailer length 12.
+])
+done
+AT_CLEANUP
+
+# ztrailer_ofs + ztrailer_len must be the file size.
+AT_SETUP([zcompressed data - wrong ztrailer_len])
+AT_KEYWORDS([sack synthetic system file negative zlib])
+zcompressed_sack | sed 's/.*ztrailer_len.*/>>i64 72<<;/' > sys-file.sack
+for variant in \
+       "be 2ba9ae97bc0a7f5dcfe36e2463b9d7cb" \
+       "le d737ea0a53ca5c6f20be359027171d73"
+do
+  set $variant
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
+])
+  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
+])
+  AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [warning: `sys-file.sav' near offset 0x190: End of ZLIB trailer (0x231) is not file size (0x219).
+error: `sys-file.sav' near offset 0x201: 72-byte ZLIB trailer specifies 1 data blocks (expected 2).
+])
+done
+AT_CLEANUP
+
+AT_SETUP([zcompressed data - wrong ztrailer_bias])
+AT_KEYWORDS([sack synthetic system file negative zlib])
+zcompressed_sack | sed 's/.*ztrailer_bias.*/>>i64 0<<;/' > sys-file.sack
+for variant in \
+       "be a5b56ab5e799a3626de2cdd7bd8d7a03" \
+       "le d7cd584c6d5a95df10ba640eb3f1f24f"
+do
+  set $variant
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
+])
+  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
+])
+  AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x1f1: ZLIB trailer bias (0) differs from file header bias (100.00).
+])
+done
+AT_CLEANUP
+
+AT_SETUP([zcompressed data - wrong ztrailer_zero])
+AT_KEYWORDS([sack synthetic system file negative zlib])
+zcompressed_sack | sed 's/.*ztrailer_zero.*/>>i64 100<<;/' > sys-file.sack
+for variant in \
+       "be 8d746abedb3e74cfdc22207f3455db92" \
+       "le 79cea017365cab35d59c7a300cfa66c1"
+do
+  set $variant
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
+])
+  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
+])
+  AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [warning: `sys-file.sav' near offset 0x1f9: ZLIB trailer "zero" field has nonzero value 100.
+])
+done
+AT_CLEANUP
+
+AT_SETUP([zcompressed data - wrong block_size])
+AT_KEYWORDS([sack synthetic system file negative zlib])
+zcompressed_sack | sed 's/.*block_size.*/>>0x1000<<;/' > sys-file.sack
+for variant in \
+       "be 8d5a1caa56be8892d453faf1047005ca" \
+       "le 7daa1bd57b192893b313a351202e179b"
+do
+  set $variant
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
+])
+  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
+])
+  AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [warning: `sys-file.sav' near offset 0x1fd: ZLIB trailer specifies unexpected 4096-byte block size.
+])
+done
+AT_CLEANUP
+
+AT_SETUP([zcompressed data - wrong n_blocks])
+AT_KEYWORDS([sack synthetic system file negative zlib])
+zcompressed_sack | sed 's/.*n_blocks.*/>>2<<;/' > sys-file.sack
+for variant in \
+       "be cd29596fd6bf4a2f651febe820a7955f" \
+       "le 8fc1f718dfd2abac7c3442c1055d4cab"
+do
+  set $variant
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
+])
+  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
+])
+  AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x201: 48-byte ZLIB trailer specifies 2 data blocks (expected 1).
+])
+done
+AT_CLEANUP
+
+AT_SETUP([zcompressed data - wrong uncompressed_ofs])
+AT_KEYWORDS([sack synthetic system file negative zlib])
+zcompressed_sack | sed 's/.*uncompressed_ofs.*/i64 >>0x177<<;/' > sys-file.sack
+for variant in \
+       "be 5546120fe6161dc6ed20aec48d8e74a4" \
+       "le 86fafd625ed5ceaa1bff4fc7f500b6ab"
+do
+  set $variant
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
+])
+  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
+])
+  AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x201: ZLIB block descriptor 0 reported uncompressed data offset 0x177, when 0x178 was expected.
+])
+done
+AT_CLEANUP
+
+AT_SETUP([zcompressed data - wrong compressed_ofs])
+AT_KEYWORDS([sack synthetic system file negative zlib])
+zcompressed_sack | sed 's/.*@%:@ compressed_ofs.*/i64 >>0x191<<;/' > sys-file.sack
+for variant in \
+       "be 652e28f8d3f8e4ce47ad18d0f30e7bb9" \
+       "le ebf2c647f2d7c47858d4f5ed683526e6"
+do
+  set $variant
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
+])
+  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
+])
+  AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x201: ZLIB block descriptor 0 reported compressed data offset 0x191, when 0x190 was expected.
+])
+done
+AT_CLEANUP
+
+AT_SETUP([zcompressed data - compressed sizes don't add up])
+AT_KEYWORDS([sack synthetic system file negative zlib])
+AT_DATA([sys-file.sack], [dnl
+dnl File header.
+"$FL3"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
+2; dnl Layout code
+6; dnl Nominal case size
+2; dnl zlib compressed
+0; dnl Not weighted
+-1; dnl Unspecified number of cases.
+100.0; dnl Bias.
+"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
+i8 0 *3;
+
+dnl Numeric variables.
+2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
+2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
+
+dnl String variable.
+2; 4; 0; 0; 0x010400 *2; s8 "STR4";
+2; 8; 0; 0; 0x010800 *2; s8 "STR8";
+2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
+2; -1; 0; 0; 0; 0; s8 "";
+
+dnl Dictionary termination record.
+999; 0;
+
+dnl ZLIB data header.
+i64 0x178;    # zheader_ofs
+i64 0x190;    # ztrailer_ofs
+i64 72;       # ztrailer_len
+
+dnl This is where the ZLIB data blocks would go, but we don't need any to
+dnl provoke this message so we omit them.
+
+dnl ZLIB data trailer fixed header:
+i64 -100;     # ztrailer_bias
+i64 0;        # ztrailer_zero
+0x3ff000;     # block_size
+2;            # n_blocks
+
+dnl ZLIB block descriptor 1:
+i64 0x178;    # uncompressed_ofs
+i64 0x190;    # compressed_ofs
+0x100000;     # uncompressed_size
+0x12345;      # compressed_size
+
+dnl ZLIB block descriptor 2:
+i64 0x100178; # uncompressed_ofs
+i64 0x12405;  # compressed_ofs
+0x100000;     # uncompressed_size
+0x12345;      # compressed_size
+])
+for variant in \
+       "be 72ebf57bffa340afe16ed79959faac09" \
+       "le 80b34e98f6b181dcc2e8ca4ba13f768d"
+do
+  set $variant
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
+])
+  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
+])
+  AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [warning: `sys-file.sav' near offset 0x1a8: ZLIB block descriptor 0 reported block size 0x100000, when 0x3ff000 was expected.
+error: `sys-file.sav' near offset 0x1c0: ZLIB block descriptor 1 reported compressed data offset 0x12405, when 0x124d5 was expected.
+])
+done
+AT_CLEANUP
+
+AT_SETUP([zcompressed data - uncompressed_size > block_size])
+AT_KEYWORDS([sack synthetic system file negative zlib])
+zcompressed_sack | sed 's/.*uncompressed_size.*/>>0x400000<<;/' > sys-file.sack
+for variant in \
+       "be 9bb74ef407fe0b79e43c388eedc28212" \
+       "le 6f145fb5f820c513f50b6f81310cdad5"
+do
+  set $variant
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
+])
+  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
+])
+  AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [warning: `sys-file.sav' near offset 0x201: ZLIB block descriptor 0 reported block size 0x400000, when at most 0x3ff000 was expected.
+])
+done
+AT_CLEANUP
 
-sys-file.sps:2: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
+AT_SETUP([zcompressed data - compression expands data too much])
+AT_KEYWORDS([sack synthetic system file negative zlib])
+zcompressed_sack | sed 's/.*uncompressed_size.*/>>50<<;/
+s/.*@%:@ compressed_size.*/>>100<<;/' > sys-file.sack
+for variant in \
+       "be e11cadde5f0855c965a1cb388dedc36e" \
+       "le 37953e71462b6554c5644fec8b539164"
+do
+  set $variant
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
+])
+  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
+])
+  AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x201: ZLIB block descriptor 0 reports compressed size 100 and uncompressed size 50.
 ])
 done
 AT_CLEANUP
 
+AT_SETUP([zcompressed data - compressed sizes don't add up])
+AT_KEYWORDS([sack synthetic system file negative zlib])
+zcompressed_sack | sed 's/.*@%:@ compressed_size.*/>>88<<;/' > sys-file.sack
+for variant in \
+       "be 366eaf85be1f26fb6549e2f8ee393628" \
+       "le a756e5125e6a908cb4990f66cc419bef"
+do
+  set $variant
+  AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
+])
+  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
+])
+  AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x219: ZLIB trailer is at offset 0x1e9 but 0x1e8 would be expected from block descriptors.
+])
+done
+AT_CLEANUP