Optimize the EBCDIC table sizes.

* lib/converters.h (DEDUPLICATE_TABLES): New macro.
* lib/ebcdic1025.h: Deduplicate tables with ebcdic880.h.
* lib/ebcdic1123.h: Deduplicate tables with ebcdic1025.h.
* lib/ebcdic1132.h: Deduplicate tables with ebcdic838.h.
* lib/ebcdic1153.h: Deduplicate tables with ebcdic870.h.
* lib/ebcdic1154.h: Deduplicate tables with ebcdic880.h.
* lib/ebcdic1155.h: Deduplicate tables with ebcdic1026.h.
* lib/ebcdic1156.h: Deduplicate tables with ebcdic1112.h.
* lib/ebcdic1157.h: Deduplicate tables with ebcdic1122.h.
* lib/ebcdic1158.h: Deduplicate tables with ebcdic1154.h, ebcdic1123.h.
* lib/ebcdic1160.h: Deduplicate tables with ebcdic838.h.
* lib/ebcdic1164.h: Deduplicate tables with ebcdic1130.h.
* lib/ebcdic1165.h: Deduplicate tables with ebcdic870.h.
* lib/ebcdic1166.h: Deduplicate tables with ebcdic1154.h.
* lib/ebcdic4971.h: Deduplicate tables with ebcdic875.h.
* lib/ebcdic12712.h: Deduplicate tables with ebcdic424.h.
diff --git a/ChangeLog b/ChangeLog
index 45e277d..aa3fad6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,25 @@
 2022-01-23  Bruno Haible  <bruno@clisp.org>
 
+	Optimize the EBCDIC table sizes.
+	* lib/converters.h (DEDUPLICATE_TABLES): New macro.
+	* lib/ebcdic1025.h: Deduplicate tables with ebcdic880.h.
+	* lib/ebcdic1123.h: Deduplicate tables with ebcdic1025.h.
+	* lib/ebcdic1132.h: Deduplicate tables with ebcdic838.h.
+	* lib/ebcdic1153.h: Deduplicate tables with ebcdic870.h.
+	* lib/ebcdic1154.h: Deduplicate tables with ebcdic880.h.
+	* lib/ebcdic1155.h: Deduplicate tables with ebcdic1026.h.
+	* lib/ebcdic1156.h: Deduplicate tables with ebcdic1112.h.
+	* lib/ebcdic1157.h: Deduplicate tables with ebcdic1122.h.
+	* lib/ebcdic1158.h: Deduplicate tables with ebcdic1154.h, ebcdic1123.h.
+	* lib/ebcdic1160.h: Deduplicate tables with ebcdic838.h.
+	* lib/ebcdic1164.h: Deduplicate tables with ebcdic1130.h.
+	* lib/ebcdic1165.h: Deduplicate tables with ebcdic870.h.
+	* lib/ebcdic1166.h: Deduplicate tables with ebcdic1154.h.
+	* lib/ebcdic4971.h: Deduplicate tables with ebcdic875.h.
+	* lib/ebcdic12712.h: Deduplicate tables with ebcdic424.h.
+
+2022-01-23  Bruno Haible  <bruno@clisp.org>
+
 	New EBCDIC encodings.
 	Reported by Ulrich Schwab and Calvin Buckley via Jack Woehr.
 	* NOTES: Mention how to enable EBCDIC encodings.
diff --git a/lib/converters.h b/lib/converters.h
index db53acd..e2e2227 100644
--- a/lib/converters.h
+++ b/lib/converters.h
@@ -291,6 +291,7 @@
 #endif
 
 #ifdef USE_ZOS
+#define DEDUPLICATE_TABLES 1
 #include "ebcdic037.h"
 #include "ebcdic273.h"
 #include "ebcdic277.h"
diff --git a/lib/ebcdic1025.h b/lib/ebcdic1025.h
index d6c94d4..28dcb2b 100644
--- a/lib/ebcdic1025.h
+++ b/lib/ebcdic1025.h
@@ -104,6 +104,9 @@
   0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, /* 0xa0-0xa7 */
   0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, /* 0xa8-0xaf */
 };
+#if DEDUPLICATE_TABLES
+#define ebcdic1025_page04 ebcdic880_page04
+#else /* Unoptimized */
 static const unsigned char ebcdic1025_page04[96] = {
   0x00, 0x63, 0x59, 0x62, 0x64, 0x65, 0x66, 0x67, /* 0x00-0x07 */
   0x68, 0x69, 0x70, 0x71, 0x72, 0x00, 0x74, 0x75, /* 0x08-0x0f */
@@ -118,6 +121,7 @@
   0x00, 0x44, 0x42, 0x43, 0x45, 0x46, 0x47, 0x48, /* 0x50-0x57 */
   0x49, 0x51, 0x52, 0x53, 0x54, 0x00, 0x55, 0x56, /* 0x58-0x5f */
 };
+#endif
 
 static int
 ebcdic1025_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)
diff --git a/lib/ebcdic1123.h b/lib/ebcdic1123.h
index 9f60dae..bcd1952 100644
--- a/lib/ebcdic1123.h
+++ b/lib/ebcdic1123.h
@@ -80,6 +80,9 @@
   return 1;
 }
 
+#if DEDUPLICATE_TABLES
+#define ebcdic1123_page00 ebcdic1025_page00
+#else /* Unoptimized */
 static const unsigned char ebcdic1123_page00[176] = {
   0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 0x00-0x07 */
   0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -104,6 +107,7 @@
   0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, /* 0xa0-0xa7 */
   0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, /* 0xa8-0xaf */
 };
+#endif
 static const unsigned char ebcdic1123_page04[152] = {
   0x00, 0x63, 0x59, 0x00, 0x64, 0x65, 0x66, 0x67, /* 0x00-0x07 */
   0x68, 0x69, 0x70, 0x71, 0x72, 0x00, 0x74, 0x75, /* 0x08-0x0f */
diff --git a/lib/ebcdic1132.h b/lib/ebcdic1132.h
index 582be5f..1a6e91c 100644
--- a/lib/ebcdic1132.h
+++ b/lib/ebcdic1132.h
@@ -84,6 +84,9 @@
   return RET_ILSEQ;
 }
 
+#if DEDUPLICATE_TABLES
+#define ebcdic1132_page00 ebcdic838_page00
+#else /* Unoptimized */
 static const unsigned char ebcdic1132_page00[176] = {
   0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 0x00-0x07 */
   0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -108,6 +111,7 @@
   0x41, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x6a, 0x00, /* 0xa0-0xa7 */
   0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
 };
+#endif
 static const unsigned char ebcdic1132_page0e[96] = {
   0x00, 0x42, 0x43, 0x00, 0x44, 0x00, 0x00, 0x45, /* 0x80-0x87 */
   0x46, 0x00, 0x48, 0x00, 0x00, 0x52, 0x00, 0x00, /* 0x88-0x8f */
diff --git a/lib/ebcdic1153.h b/lib/ebcdic1153.h
index 09bdd6d..590e548 100644
--- a/lib/ebcdic1153.h
+++ b/lib/ebcdic1153.h
@@ -131,12 +131,16 @@
   0xfb, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
   0x00, 0xb9, 0xb7, 0xb4, 0xb2, 0xb8, 0xb6, 0x00, /* 0x78-0x7f */
 };
+#if DEDUPLICATE_TABLES
+#define ebcdic1153_page02 ebcdic870_page02
+#else /* Unoptimized */
 static const unsigned char ebcdic1153_page02[32] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, /* 0xc0-0xc7 */
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */
   0x80, 0xb0, 0x00, 0x9e, 0x00, 0x64, 0x00, 0x00, /* 0xd8-0xdf */
 };
+#endif
 
 static int
 ebcdic1153_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)
diff --git a/lib/ebcdic1154.h b/lib/ebcdic1154.h
index 3d7c866..52095a9 100644
--- a/lib/ebcdic1154.h
+++ b/lib/ebcdic1154.h
@@ -104,6 +104,9 @@
   0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
   0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, /* 0xa8-0xaf */
 };
+#if DEDUPLICATE_TABLES
+#define ebcdic1154_page04 ebcdic880_page04
+#else /* Unoptimized */
 static const unsigned char ebcdic1154_page04[96] = {
   0x00, 0x63, 0x59, 0x62, 0x64, 0x65, 0x66, 0x67, /* 0x00-0x07 */
   0x68, 0x69, 0x70, 0x71, 0x72, 0x00, 0x74, 0x75, /* 0x08-0x0f */
@@ -118,6 +121,7 @@
   0x00, 0x44, 0x42, 0x43, 0x45, 0x46, 0x47, 0x48, /* 0x50-0x57 */
   0x49, 0x51, 0x52, 0x53, 0x54, 0x00, 0x55, 0x56, /* 0x58-0x5f */
 };
+#endif
 
 static int
 ebcdic1154_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)
diff --git a/lib/ebcdic1155.h b/lib/ebcdic1155.h
index acf874a..0638a31 100644
--- a/lib/ebcdic1155.h
+++ b/lib/ebcdic1155.h
@@ -114,6 +114,9 @@
   0x00, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xa1, 0xe1, /* 0xf0-0xf7 */
   0x70, 0xdd, 0xde, 0xdb, 0xe0, 0x00, 0x00, 0xdf, /* 0xf8-0xff */
 };
+#if DEDUPLICATE_TABLES
+#define ebcdic1155_page01 ebcdic1026_page01
+#else /* Unoptimized */
 static const unsigned char ebcdic1155_page01[72] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a, 0xd0, /* 0x18-0x1f */
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
@@ -125,6 +128,7 @@
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x6a, /* 0x58-0x5f */
 };
+#endif
 
 static int
 ebcdic1155_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)
diff --git a/lib/ebcdic1156.h b/lib/ebcdic1156.h
index 78c128a..20ca348 100644
--- a/lib/ebcdic1156.h
+++ b/lib/ebcdic1156.h
@@ -131,9 +131,13 @@
   0x00, 0x00, 0x75, 0x55, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
   0x00, 0xbc, 0xab, 0xad, 0x8d, 0x69, 0x49, 0x00, /* 0x78-0x7f */
 };
+#if DEDUPLICATE_TABLES
+#define ebcdic1156_page20 ebcdic1112_page20
+#else /* Unoptimized */
 static const unsigned char ebcdic1156_page20[8] = {
   0x00, 0xdf, 0x00, 0x00, 0x57, 0xaa, 0x56, 0x00, /* 0x18-0x1f */
 };
+#endif
 
 static int
 ebcdic1156_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)
diff --git a/lib/ebcdic1157.h b/lib/ebcdic1157.h
index 1118a76..3a79ecf 100644
--- a/lib/ebcdic1157.h
+++ b/lib/ebcdic1157.h
@@ -114,12 +114,16 @@
   0x00, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0x6a, 0xe1, /* 0xf0-0xf7 */
   0x70, 0xdd, 0xde, 0xdb, 0xa1, 0x8d, 0x00, 0xdf, /* 0xf8-0xff */
 };
+#if DEDUPLICATE_TABLES
+#define ebcdic1157_page01 ebcdic1122_page01
+#else /* Unoptimized */
 static const unsigned char ebcdic1157_page01[32] = {
   0xac, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
   0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0x8e, 0x00, /* 0x78-0x7f */
 };
+#endif
 
 static int
 ebcdic1157_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)
diff --git a/lib/ebcdic1158.h b/lib/ebcdic1158.h
index 95aa784..0d82b2a 100644
--- a/lib/ebcdic1158.h
+++ b/lib/ebcdic1158.h
@@ -80,6 +80,9 @@
   return 1;
 }
 
+#if DEDUPLICATE_TABLES
+#define ebcdic1158_page00 ebcdic1154_page00
+#else /* Unoptimized */
 static const unsigned char ebcdic1158_page00[176] = {
   0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 0x00-0x07 */
   0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -104,6 +107,10 @@
   0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
   0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, /* 0xa8-0xaf */
 };
+#endif
+#if DEDUPLICATE_TABLES
+#define ebcdic1158_page04 ebcdic1123_page04
+#else /* Unoptimized */
 static const unsigned char ebcdic1158_page04[152] = {
   0x00, 0x63, 0x59, 0x00, 0x64, 0x65, 0x66, 0x67, /* 0x00-0x07 */
   0x68, 0x69, 0x70, 0x71, 0x72, 0x00, 0x74, 0x75, /* 0x08-0x0f */
@@ -125,6 +132,7 @@
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
   0x62, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
 };
+#endif
 
 static int
 ebcdic1158_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)
diff --git a/lib/ebcdic1160.h b/lib/ebcdic1160.h
index e0104b0..480bd8c 100644
--- a/lib/ebcdic1160.h
+++ b/lib/ebcdic1160.h
@@ -80,6 +80,9 @@
   return 1;
 }
 
+#if DEDUPLICATE_TABLES
+#define ebcdic1160_page00 ebcdic838_page00
+#else /* Unoptimized */
 static const unsigned char ebcdic1160_page00[176] = {
   0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 0x00-0x07 */
   0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -104,6 +107,10 @@
   0x41, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x6a, 0x00, /* 0xa0-0xa7 */
   0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
 };
+#endif
+#if DEDUPLICATE_TABLES
+#define ebcdic1160_page0e ebcdic838_page0e
+#else /* Unoptimized */
 static const unsigned char ebcdic1160_page0e[96] = {
   0x00, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, /* 0x00-0x07 */
   0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x62, /* 0x08-0x0f */
@@ -118,6 +125,7 @@
   0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x50-0x57 */
   0xb8, 0xb9, 0x90, 0xa0, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */
 };
+#endif
 
 static int
 ebcdic1160_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)
diff --git a/lib/ebcdic1164.h b/lib/ebcdic1164.h
index 6620da9..d7f38fb 100644
--- a/lib/ebcdic1164.h
+++ b/lib/ebcdic1164.h
@@ -138,6 +138,9 @@
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xed, /* 0xa8-0xaf */
   0xcd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */
 };
+#if DEDUPLICATE_TABLES
+#define ebcdic1164_page03 ebcdic1130_page03
+#else /* Unoptimized */
 static const unsigned char ebcdic1164_page03[40] = {
   0x8e, 0xae, 0x00, 0x58, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
   0x00, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
@@ -145,6 +148,7 @@
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
   0x00, 0x00, 0x00, 0xad, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
 };
+#endif
 static const unsigned char ebcdic1164_page20[8] = {
   0x00, 0x00, 0x00, 0x78, 0x9f, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
 };
diff --git a/lib/ebcdic1165.h b/lib/ebcdic1165.h
index e7ced17..79e99b7 100644
--- a/lib/ebcdic1165.h
+++ b/lib/ebcdic1165.h
@@ -131,12 +131,16 @@
   0xfb, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
   0x00, 0xb9, 0xb7, 0xb4, 0xb2, 0xb8, 0xb6, 0x00, /* 0x78-0x7f */
 };
+#if DEDUPLICATE_TABLES
+#define ebcdic1165_page02 ebcdic870_page02
+#else /* Unoptimized */
 static const unsigned char ebcdic1165_page02[32] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, /* 0xc0-0xc7 */
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */
   0x80, 0xb0, 0x00, 0x9e, 0x00, 0x64, 0x00, 0x00, /* 0xd8-0xdf */
 };
+#endif
 
 static int
 ebcdic1165_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)
diff --git a/lib/ebcdic1166.h b/lib/ebcdic1166.h
index 2b1fb6c..e7aa22d 100644
--- a/lib/ebcdic1166.h
+++ b/lib/ebcdic1166.h
@@ -80,6 +80,9 @@
   return 1;
 }
 
+#if DEDUPLICATE_TABLES
+#define ebcdic1166_page00 ebcdic1154_page00
+#else /* Unoptimized */
 static const unsigned char ebcdic1166_page00[176] = {
   0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 0x00-0x07 */
   0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -104,6 +107,7 @@
   0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
   0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, /* 0xa8-0xaf */
 };
+#endif
 static const unsigned char ebcdic1166_page04[240] = {
   0x00, 0x63, 0x00, 0x00, 0x64, 0x65, 0x66, 0x00, /* 0x00-0x07 */
   0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, /* 0x08-0x0f */
diff --git a/lib/ebcdic12712.h b/lib/ebcdic12712.h
index bafb3f0..42d9d33 100644
--- a/lib/ebcdic12712.h
+++ b/lib/ebcdic12712.h
@@ -84,6 +84,9 @@
   return RET_ILSEQ;
 }
 
+#if DEDUPLICATE_TABLES
+#define ebcdic12712_page00 ebcdic424_page00
+#else /* Unoptimized */
 static const unsigned char ebcdic12712_page00[248] = {
   0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 0x00-0x07 */
   0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -117,12 +120,17 @@
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, /* 0xf0-0xf7 */
 };
+#endif
+#if DEDUPLICATE_TABLES
+#define ebcdic12712_page05 ebcdic424_page05
+#else /* Unoptimized */
 static const unsigned char ebcdic12712_page05[32] = {
   0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, /* 0xd0-0xd7 */
   0x49, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0xd8-0xdf */
   0x58, 0x59, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0xe0-0xe7 */
   0x68, 0x69, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
 };
+#endif
 static const unsigned char ebcdic12712_page20[56] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xfe, /* 0x08-0x0f */
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, /* 0x10-0x17 */
diff --git a/lib/ebcdic4971.h b/lib/ebcdic4971.h
index 0fa4683..63e23d9 100644
--- a/lib/ebcdic4971.h
+++ b/lib/ebcdic4971.h
@@ -84,6 +84,9 @@
   return RET_ILSEQ;
 }
 
+#if DEDUPLICATE_TABLES
+#define ebcdic4971_page00 ebcdic875_page00
+#else /* Unoptimized */
 static const unsigned char ebcdic4971_page00[192] = {
   0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 0x00-0x07 */
   0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -110,6 +113,10 @@
   0x90, 0xda, 0xea, 0xfa, 0xa0, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */
   0x00, 0x00, 0x00, 0xfe, 0x00, 0xdb, 0x00, 0x00, /* 0xb8-0xbf */
 };
+#endif
+#if DEDUPLICATE_TABLES
+#define ebcdic4971_page03 ebcdic875_page03
+#else /* Unoptimized */
 static const unsigned char ebcdic4971_page03[80] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x71, 0xdd, /* 0x80-0x87 */
   0x72, 0x73, 0x75, 0x00, 0x76, 0x00, 0x77, 0x78, /* 0x88-0x8f */
@@ -122,10 +129,15 @@
   0xad, 0xae, 0xba, 0xaf, 0xbb, 0xbc, 0xbd, 0xbe, /* 0xc0-0xc7 */
   0xbf, 0xcb, 0xb4, 0xb8, 0xb6, 0xb7, 0xb9, 0x00, /* 0xc8-0xcf */
 };
+#endif
+#if DEDUPLICATE_TABLES
+#define ebcdic4971_page20 ebcdic875_page20
+#else /* Unoptimized */
 static const unsigned char ebcdic4971_page20[16] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0xcf, 0x00, 0x00, /* 0x10-0x17 */
   0xce, 0xde, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
 };
+#endif
 
 static int
 ebcdic4971_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)