From 994d3005ed8e576928eb83851885e49b7394353a Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Tue, 26 Mar 2024 17:25:52 -0400 Subject: [PATCH 01/29] Update README.md Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2d41f3c..0cd4ba1 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,11 @@ IBM Mainframe files on any workstation or laptop etc. that supports Java. ## Updates ## +**Version 5.0.1: March 2024** + +- Added support to decompress then recompress into a gzip file if output-file name ends in ".gz" +- Updated pom.xml to have Maven compile using Java 17, and shade the jar. + **Version 5: March 2021** - Support for variable length binary records. Variable length records processed in binary mode will be prefixed with a 4 byte field in the same format as the IBM RDW i.e. 2 byte record length field (including RDW length, big-endian) followed by 2 bytes of zeros. @@ -25,7 +30,7 @@ For execution, TerseDecompress needs a JVM runtime environment. Usage: -```java -jar tersedecompress-5.0.0.jar [-b] tersed-file output-file``` +```java -jar tersedecompress-5.0.1.jar [-b] tersed-file output-file``` Default mode is text mode, which will attempt EBCDIC -> ASCII conversion. From 4b22ad368fbc72b8a03522d589878af8cbbd13c9 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Tue, 26 Mar 2024 17:28:46 -0400 Subject: [PATCH 02/29] Update pom.xml Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- pom.xml | 57 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index af9b839..5f279ff 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.openmainframeproject.tersedecompress tersedecompress - 5.0.0 + 5.0.1 jar tersedecompress @@ -13,6 +13,10 @@ UTF-8 + 17 + 4.13.1 + 3.12.1 + 3.5.1 true @@ -20,24 +24,47 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + ${maven-compiler-version} - 1.8 - 1.8 + ${jdk-release} org.apache.maven.plugins - maven-jar-plugin - 3.2.0 - - - - true - org.openmainframeproject.tersedecompress.TerseDecompress - - - + maven-shade-plugin + ${maven-shade-version} + + + package + + shade + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + true + + org.openmainframeproject.tersedecompress.TerseDecompress + + + + + org.openmainframeproject.tersedecompress.TerseDecompress + + + + + + @@ -45,7 +72,7 @@ junit junit - 4.13.1 + ${junit-version} test From 5708147e1302b7ed6294828733789453b9c6f79d Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Tue, 26 Mar 2024 17:33:10 -0400 Subject: [PATCH 03/29] Handle gzip output files Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- .../tersedecompress/TerseDecompress.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java index 497e28c..cf82829 100644 --- a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java +++ b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java @@ -34,8 +34,12 @@ /* Andrew Rowley, Black Hill Software */ /* Mario Bezzi, Watson Walker */ /*****************************************************************************/ +/* Version 6: support for gzipped output records */ +/* Russell Shaw */ +/*****************************************************************************/ import java.io.*; +import java.util.zip.GZIPOutputStream; class TerseDecompress { @@ -46,7 +50,7 @@ class TerseDecompress { +"The -b flag turns on binary mode, no conversion will be attempted\n" ); - private static final String Version = new String ("Version 5, March 2021"); + private static final String Version = new String ("Version 6, March 2024"); private void printUsageAndExit() { System.out.println(DetailedHelp); @@ -95,14 +99,17 @@ else if (outputFileName == null) printUsageAndExit(); } + TerseDecompresser outputWriter = null; + FileOutputStream fileOutputStream = new FileOutputStream(outputFileName); + + if (outputFileName.endsWith(".gz")) + outputWriter = TerseDecompresser.create(new FileInputStream(inputFileName), new GZIPOutputStream(fileOutputStream)); + else + outputWriter = TerseDecompresser.create(new FileInputStream(inputFileName), fileOutputStream); - try (TerseDecompresser outputWriter - = TerseDecompresser.create(new FileInputStream(inputFileName), new FileOutputStream(outputFileName))) - { - outputWriter.TextFlag = textMode; - System.out.println("Attempting to decompress input file (" + inputFileName +") to output file (" + outputFileName +")"); - outputWriter.decode(); - } + outputWriter.TextFlag = textMode; + System.out.println("Attempting to decompress input file (" + inputFileName +") to output file (" + outputFileName +")"); + outputWriter.decode(); System.out.println("Processing completed"); } From abcb9c686481ef5318a1c3322ef55cd73b35d314 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Tue, 26 Mar 2024 17:33:52 -0400 Subject: [PATCH 04/29] Handle gzip output files Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0cd4ba1..6daf824 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ IBM Mainframe files on any workstation or laptop etc. that supports Java. ## Updates ## -**Version 5.0.1: March 2024** +**Version 6: March 2024** - Added support to decompress then recompress into a gzip file if output-file name ends in ".gz" - Updated pom.xml to have Maven compile using Java 17, and shade the jar. From 23cdcdc33113ab3f8a1686090217f915a1f153f9 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Tue, 26 Mar 2024 17:34:44 -0400 Subject: [PATCH 05/29] Handle gzip output files Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6daf824..580c845 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ For execution, TerseDecompress needs a JVM runtime environment. Usage: -```java -jar tersedecompress-5.0.1.jar [-b] tersed-file output-file``` +```java -jar tersedecompress-6.0.0.jar [-b] tersed-file output-file``` Default mode is text mode, which will attempt EBCDIC -> ASCII conversion. From 9ab9bc5f37202a355fec05fab15687c5cecefb60 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Tue, 26 Mar 2024 17:36:23 -0400 Subject: [PATCH 06/29] Handle gzip output files Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5f279ff..bf29766 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.openmainframeproject.tersedecompress tersedecompress - 5.0.1 + 6.0.0 jar tersedecompress From 2ebc0ce4d6156d836c29661b57a918cfd0b52367 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Wed, 27 Mar 2024 11:18:33 -0400 Subject: [PATCH 07/29] Update README.md Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 580c845..0cd4ba1 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ IBM Mainframe files on any workstation or laptop etc. that supports Java. ## Updates ## -**Version 6: March 2024** +**Version 5.0.1: March 2024** - Added support to decompress then recompress into a gzip file if output-file name ends in ".gz" - Updated pom.xml to have Maven compile using Java 17, and shade the jar. @@ -30,7 +30,7 @@ For execution, TerseDecompress needs a JVM runtime environment. Usage: -```java -jar tersedecompress-6.0.0.jar [-b] tersed-file output-file``` +```java -jar tersedecompress-5.0.1.jar [-b] tersed-file output-file``` Default mode is text mode, which will attempt EBCDIC -> ASCII conversion. From fc0333ce556750ec6bc2423dbf586b138bd84772 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Wed, 27 Mar 2024 11:19:08 -0400 Subject: [PATCH 08/29] Update pom.xml Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bf29766..5f279ff 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.openmainframeproject.tersedecompress tersedecompress - 6.0.0 + 5.0.1 jar tersedecompress From 01a884cbfd784a076bbc2469e916496fa53c6728 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Wed, 27 Mar 2024 11:23:01 -0400 Subject: [PATCH 09/29] Update TerseDecompress.java Restored try clause. Increased GZIP buffer size for effciency and for CryptoCards that only get used if buffer > = 8192 bytes Set GZIP flush option to prevent corruption of file on last write Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- .../tersedecompress/TerseDecompress.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java index cf82829..c26c2ce 100644 --- a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java +++ b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java @@ -99,18 +99,23 @@ else if (outputFileName == null) printUsageAndExit(); } - TerseDecompresser outputWriter = null; - FileOutputStream fileOutputStream = new FileOutputStream(outputFileName); + System.out.println("Attempting to decompress input file (" + inputFileName +") to output file (" + outputFileName +")"); - if (outputFileName.endsWith(".gz")) - outputWriter = TerseDecompresser.create(new FileInputStream(inputFileName), new GZIPOutputStream(fileOutputStream)); - else - outputWriter = TerseDecompresser.create(new FileInputStream(inputFileName), fileOutputStream); + if (outputFileName.endsWith(".gz")) { + try (TerseDecompresser outputWriter = TerseDecompresser.create(new FileInputStream(inputFileName), new GZIPOutputStream(new FileOutputStream(outputFileName), 8192, true))) + { + outputWriter.TextFlag = textMode; + outputWriter.decode(); + } + } + else { + try (TerseDecompresser outputWriter = TerseDecompresser.create(new FileInputStream(inputFileName), new FileOutputStream(outputFileName))) + { + outputWriter.TextFlag = textMode; + outputWriter.decode(); + } + } - outputWriter.TextFlag = textMode; - System.out.println("Attempting to decompress input file (" + inputFileName +") to output file (" + outputFileName +")"); - outputWriter.decode(); - System.out.println("Processing completed"); } From e0d6cd417010dc8a23f925b344d7cfcd9a93e9ef Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Wed, 27 Mar 2024 17:20:39 -0400 Subject: [PATCH 10/29] Update TerseDecompress.java Rebased upon existing 5.0.1 branch Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- .../tersedecompress/TerseDecompress.java | 49 ++++++++++++++----- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java index c26c2ce..46c6529 100644 --- a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java +++ b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java @@ -34,9 +34,6 @@ /* Andrew Rowley, Black Hill Software */ /* Mario Bezzi, Watson Walker */ /*****************************************************************************/ -/* Version 6: support for gzipped output records */ -/* Russell Shaw */ -/*****************************************************************************/ import java.io.*; import java.util.zip.GZIPOutputStream; @@ -47,10 +44,17 @@ class TerseDecompress { "Usage: \"TerseDecompress [-b]\"\n\n" +"Java TerseDecompress will decompress a file compressed using the terse program on z/OS\n" +"Default mode is text mode, which will attempt EBCDIC -> ASCII conversion\n" - +"The -b flag turns on binary mode, no conversion will be attempted\n" + +"If no provided in text mode, it will default to .txt\n" + +"Options:\n" + +"-b flag turns on binary mode, no conversion will be attempted\n" + +"-h or --help prints this message\n" ); - + private static final String Version = new String ("Version 6, March 2024"); + private String inputFileName = null; + private String outputFileName = null; + private boolean isHelpRequested = false; + private boolean textMode = true; private void printUsageAndExit() { System.out.println(DetailedHelp); @@ -59,15 +63,15 @@ private void printUsageAndExit() { } private void process (String args[]) throws Exception { - - String inputFileName = null; - String outputFileName = null; - boolean textMode = true; - - if (args.length == 0) + parseArgs(args); + if (args.length == 0 || (inputFileName == null && outputFileName == null) || (outputFileName == null && textMode == false) || isHelpRequested == true) { printUsageAndExit(); } + + if (outputFileName == null) { + outputFileName = inputFileName + ".txt"; + } for (int i=0; i < args.length; i++) { @@ -119,6 +123,29 @@ else if (outputFileName == null) System.out.println("Processing completed"); } + private void parseArgs(String args[]) { + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-h") || args[i].equals("--help")) { + isHelpRequested = true; + } + else if (args[i].equals("-b")) { + textMode = false; + } + // first non-flag argument is the input file name + else if (inputFileName == null) { + inputFileName = args[i]; + } + // second non-flag argument is the input file name + else if (outputFileName == null) { + outputFileName = args[i]; + } + else // we have more args than we know what to do with + { + isHelpRequested = true; + } + } + } + public static void main (String args[]) throws Exception { TerseDecompress tersed = new TerseDecompress(); From 1b4f1eb0fb379c6f6b6f099656a5b416f2b66cd4 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Wed, 27 Mar 2024 17:21:47 -0400 Subject: [PATCH 11/29] Update pom.xml Rebased upon existing 5.0.1 branch Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5f279ff..b022589 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.openmainframeproject.tersedecompress tersedecompress - 5.0.1 + 5.0.2 jar tersedecompress From 521c136df252892f702ea695068155cb43d3f5c3 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Wed, 27 Mar 2024 17:26:08 -0400 Subject: [PATCH 12/29] Update README.md Rebased change using existing 5.0.1 branch Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0cd4ba1..162db83 100644 --- a/README.md +++ b/README.md @@ -15,11 +15,15 @@ IBM Mainframe files on any workstation or laptop etc. that supports Java. ## Updates ## -**Version 5.0.1: March 2024** +**Version 5.0.2: March 2024** - Added support to decompress then recompress into a gzip file if output-file name ends in ".gz" - Updated pom.xml to have Maven compile using Java 17, and shade the jar. +**Version 5.0.1: March 2024** + +- allow user to specify only for text files. Resulting will be .txt + **Version 5: March 2021** - Support for variable length binary records. Variable length records processed in binary mode will be prefixed with a 4 byte field in the same format as the IBM RDW i.e. 2 byte record length field (including RDW length, big-endian) followed by 2 bytes of zeros. @@ -30,7 +34,7 @@ For execution, TerseDecompress needs a JVM runtime environment. Usage: -```java -jar tersedecompress-5.0.1.jar [-b] tersed-file output-file``` +```java -jar tersedecompress-5.0.2.jar [-b] tersed-file output-file``` Default mode is text mode, which will attempt EBCDIC -> ASCII conversion. From 65c942b30525d3fbb9b7dac2b0f5a0cb02a1cad7 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Wed, 27 Mar 2024 17:27:24 -0400 Subject: [PATCH 13/29] Update README.md Rebased upon existing 5.0.1 branch Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 162db83..ebb7ff4 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ IBM Mainframe files on any workstation or laptop etc. that supports Java. - Added support to decompress then recompress into a gzip file if output-file name ends in ".gz" - Updated pom.xml to have Maven compile using Java 17, and shade the jar. -**Version 5.0.1: March 2024** +**Version 5.0.1: July 2023** - allow user to specify only for text files. Resulting will be .txt From e390069df341a2dc36bb5518b7149f84b4b778bb Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Wed, 27 Mar 2024 17:29:29 -0400 Subject: [PATCH 14/29] Update .gitignore Rebased using existing 5.0.1 branch Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 30ed173..8a63e77 100644 --- a/.gitignore +++ b/.gitignore @@ -109,4 +109,6 @@ buildNumber.properties .mvn/wrapper/maven-wrapper.jar .flattened-pom.xml -# End of https://www.gitignore.io/api/java,maven,eclipse \ No newline at end of file +# End of https://www.gitignore.io/api/java,maven,eclipse + +.vscode From 206548115ccde68d5ab63d12b6dab239d72afb2f Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Wed, 27 Mar 2024 17:34:03 -0400 Subject: [PATCH 15/29] Update pom.xml Rebased using existing 5.0.1 branch. Note this change bumps java to Java 17, and uses Shade to reduce output size Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b022589..1d90d59 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ UTF-8 17 - 4.13.1 + 4.13.2 3.12.1 3.5.1 true From 39b00950143cca7f9d3a5d9f529df97711a77aa7 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Wed, 27 Mar 2024 17:37:36 -0400 Subject: [PATCH 16/29] Update TerseDecompress.java trivial indentation fix Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- .../openmainframeproject/tersedecompress/TerseDecompress.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java index 46c6529..611356d 100644 --- a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java +++ b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java @@ -123,7 +123,7 @@ else if (outputFileName == null) System.out.println("Processing completed"); } - private void parseArgs(String args[]) { + private void parseArgs(String args[]) { for (int i = 0; i < args.length; i++) { if (args[i].equals("-h") || args[i].equals("--help")) { isHelpRequested = true; From 0bf3a24b817767d41bf74894d30dc42c22dd4569 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Thu, 28 Mar 2024 10:16:14 -0400 Subject: [PATCH 17/29] Update pom.xml Restored maven jar plug-in Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- pom.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pom.xml b/pom.xml index 1d90d59..07aa533 100644 --- a/pom.xml +++ b/pom.xml @@ -16,6 +16,7 @@ 17 4.13.2 3.12.1 + 3.2.0 3.5.1 true @@ -31,6 +32,18 @@ org.apache.maven.plugins + maven-jar-plugin + ${maven-jar-version} + + + + true + org.openmainframeproject.tersedecompress.TerseDecompress + + + + + maven-shade-plugin ${maven-shade-version} From d45495be38fe9254f33cd419f03cef2499c1dbc5 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Thu, 28 Mar 2024 10:24:53 -0400 Subject: [PATCH 18/29] Create .editorconfig Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- .editorconfig | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c0d4b75 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# Declares that this is the top-level configuration +root = true + +# Applies to all files +[*] +indent_style = space +indent_size = 2 + +# Applies to all Markdown files +[*.md] +trim_trailing_whitespace = false + +# Applies to all C# and Java files, overriding rules declared before +[*.{cs,java}] +indent_size = 4 From a6475009c8810e17a0a5d6d5357d93a0ee7b0113 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Thu, 28 Mar 2024 10:26:25 -0400 Subject: [PATCH 19/29] Update .editorconfig Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index c0d4b75..566485d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,7 +4,7 @@ root = true # Applies to all files [*] indent_style = space -indent_size = 2 +indent_size = 4 # Applies to all Markdown files [*.md] From 6d1f1949f4ddf5270e101932712400f2f163cb68 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Mon, 6 May 2024 10:14:56 -0400 Subject: [PATCH 20/29] Update .gitignore Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 8a63e77..495e286 100644 --- a/.gitignore +++ b/.gitignore @@ -112,3 +112,5 @@ buildNumber.properties # End of https://www.gitignore.io/api/java,maven,eclipse .vscode + +.editorconfig From a9b96c360966cd5d5f102ae177b2da1f6d0ffc9a Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Mon, 6 May 2024 10:32:58 -0400 Subject: [PATCH 21/29] Update TerseDecompress.java Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- .../tersedecompress/TerseDecompress.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java index 611356d..d7e52ea 100644 --- a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java +++ b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java @@ -64,7 +64,8 @@ private void printUsageAndExit() { private void process (String args[]) throws Exception { parseArgs(args); - if (args.length == 0 || (inputFileName == null && outputFileName == null) || (outputFileName == null && textMode == false) || isHelpRequested == true) + + if (isHelpRequested == true) { printUsageAndExit(); } @@ -98,7 +99,7 @@ else if (outputFileName == null) printUsageAndExit(); } } - if (inputFileName == null || outputFileName == null) + if (inputFileName == null) { printUsageAndExit(); } @@ -135,7 +136,7 @@ else if (args[i].equals("-b")) { else if (inputFileName == null) { inputFileName = args[i]; } - // second non-flag argument is the input file name + // second non-flag argument is the output file name else if (outputFileName == null) { outputFileName = args[i]; } From 414657d69cd5530ca2f86f80f3d4627f00250780 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Mon, 6 May 2024 10:35:46 -0400 Subject: [PATCH 22/29] Update TerseDecompress.java Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- .../openmainframeproject/tersedecompress/TerseDecompress.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java index d7e52ea..cca5927 100644 --- a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java +++ b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java @@ -143,6 +143,7 @@ else if (outputFileName == null) { else // we have more args than we know what to do with { isHelpRequested = true; + break; } } } From a07cdbfb04e4398e9697144ebae6587c2f33b480 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Mon, 6 May 2024 10:50:30 -0400 Subject: [PATCH 23/29] Update TerseDecompress.java Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- .../tersedecompress/TerseDecompress.java | 73 +++++++------------ 1 file changed, 27 insertions(+), 46 deletions(-) diff --git a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java index cca5927..760c93d 100644 --- a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java +++ b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java @@ -68,58 +68,39 @@ private void process (String args[]) throws Exception { if (isHelpRequested == true) { printUsageAndExit(); - } - - if (outputFileName == null) { - outputFileName = inputFileName + ".txt"; - } + } - for (int i=0; i < args.length; i++) - { - if (args[i].equals("-h") || args[i].equals("--help")) - { - printUsageAndExit(); - } - else if (args[i].equals("-b")) - { - textMode = false; - } - // first non-flag argument is the input file name - else if (inputFileName == null) - { - inputFileName = args[i]; - } - // second non-flag argument is the input file name - else if (outputFileName == null) - { - outputFileName = args[i]; - } - else // we have more args than we know what to do with - { - printUsageAndExit(); - } - } if (inputFileName == null) { printUsageAndExit(); } - System.out.println("Attempting to decompress input file (" + inputFileName +") to output file (" + outputFileName +")"); - - if (outputFileName.endsWith(".gz")) { - try (TerseDecompresser outputWriter = TerseDecompresser.create(new FileInputStream(inputFileName), new GZIPOutputStream(new FileOutputStream(outputFileName), 8192, true))) - { - outputWriter.TextFlag = textMode; - outputWriter.decode(); - } - } - else { - try (TerseDecompresser outputWriter = TerseDecompresser.create(new FileInputStream(inputFileName), new FileOutputStream(outputFileName))) - { - outputWriter.TextFlag = textMode; - outputWriter.decode(); - } - } + if (outputFileName == null) { + outputFileName = inputFileName + ".txt"; + } + + System.out.println("Opening output file (" + outputFileName + ")"); + var outputStream = null; + try { + if (outputFileName.endsWith(".gz")) { + outputStream = new GZIPOutputStream(new FileOutputStream(outputFileName), 8192, true); + } + else { + outputStream = new FileOutputStream(outputFileName); + } + } + catch (Exception e) { + System.out.println("Got exception while opening output file (" + outputFileName + ").\nError message:\n" + e.toString()); + } + + System.out.println("Attempting to decompress input file (" + inputFileName + ") to output file (" + outputFileName + ")"); + try (TerseDecompresser outputWriter = TerseDecompresser.create(new FileInputStream(inputFileName), outputStream)) { + outputWriter.TextFlag = textMode; + outputWriter.decode(); + } + catch (Exception e) { + System.out.println("Got exception while decompressing input file (" + inputFileName + ").\nError message:\n" + e.toString()); + } System.out.println("Processing completed"); } From 04a155d9c6501d074dca655508fe33e0088fdc7d Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Mon, 6 May 2024 13:14:14 -0400 Subject: [PATCH 24/29] Update TerseDecompress.java Simplied, and actually still works Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- .../tersedecompress/TerseDecompress.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java index 760c93d..9dec279 100644 --- a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java +++ b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java @@ -94,13 +94,24 @@ private void process (String args[]) throws Exception { } System.out.println("Attempting to decompress input file (" + inputFileName + ") to output file (" + outputFileName + ")"); - try (TerseDecompresser outputWriter = TerseDecompresser.create(new FileInputStream(inputFileName), outputStream)) { - outputWriter.TextFlag = textMode; - outputWriter.decode(); - } - catch (Exception e) { + + TerseDecompresser outputWriter = null; + try { + if (outputFileName.endsWith(".gz")) + outputWriter = TerseDecompresser.create(new FileInputStream(inputFileName), new GZIPOutputStream(new FileOutputStream(outputFileName), 8192, true)); + else + outputWriter = TerseDecompresser.create(new FileInputStream(inputFileName), new FileOutputStream(outputFileName)); + + outputWriter.TextFlag = textMode; + outputWriter.decode(); + } + catch( IOException e) { System.out.println("Got exception while decompressing input file (" + inputFileName + ").\nError message:\n" + e.toString()); } + finally { + if (outputWriter != null) + outputWriter.close(); + } System.out.println("Processing completed"); } From 5b3761f6e663ab878aafb7114518a1f271495a10 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Mon, 6 May 2024 13:22:21 -0400 Subject: [PATCH 25/29] Update TerseDecompress.java Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- .../tersedecompress/TerseDecompress.java | 25 +++---------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java index 9dec279..64af8f7 100644 --- a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java +++ b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java @@ -66,33 +66,14 @@ private void process (String args[]) throws Exception { parseArgs(args); if (isHelpRequested == true) - { - printUsageAndExit(); - } + printUsageAndExit(); if (inputFileName == null) - { printUsageAndExit(); - } - if (outputFileName == null) { + if (outputFileName == null) outputFileName = inputFileName + ".txt"; - } - - System.out.println("Opening output file (" + outputFileName + ")"); - var outputStream = null; - try { - if (outputFileName.endsWith(".gz")) { - outputStream = new GZIPOutputStream(new FileOutputStream(outputFileName), 8192, true); - } - else { - outputStream = new FileOutputStream(outputFileName); - } - } - catch (Exception e) { - System.out.println("Got exception while opening output file (" + outputFileName + ").\nError message:\n" + e.toString()); - } - + System.out.println("Attempting to decompress input file (" + inputFileName + ") to output file (" + outputFileName + ")"); TerseDecompresser outputWriter = null; From 6a0498964ba74c5145447b47c5e5dab23546496b Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Mon, 6 May 2024 13:48:39 -0400 Subject: [PATCH 26/29] Update TerseDecompress.java Improved outfilename suffix defaults Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- .../tersedecompress/TerseDecompress.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java index 64af8f7..935abba 100644 --- a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java +++ b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java @@ -44,7 +44,10 @@ class TerseDecompress { "Usage: \"TerseDecompress [-b]\"\n\n" +"Java TerseDecompress will decompress a file compressed using the terse program on z/OS\n" +"Default mode is text mode, which will attempt EBCDIC -> ASCII conversion\n" - +"If no provided in text mode, it will default to .txt\n" + +"If no is provided, it will default to either\n" + +" 1) if then \n" + +" 2) if and text mode, then \n" + +" 3) if and binary mode, then \n" +"Options:\n" +"-b flag turns on binary mode, no conversion will be attempted\n" +"-h or --help prints this message\n" @@ -71,8 +74,16 @@ private void process (String args[]) throws Exception { if (inputFileName == null) printUsageAndExit(); - if (outputFileName == null) - outputFileName = inputFileName + ".txt"; + if (outputFileName == null) { + if (inputFileName.toLowerCase().endsWith(".trs") ) + outputFileName = inputFileName.substring(0, inputFileName.length() - 4); + else { + if (textMode) + outputFileName = inputFileName.concat(".txt"); + else + outputFileName = inputFileName.concat(".bin"); + } + } System.out.println("Attempting to decompress input file (" + inputFileName + ") to output file (" + outputFileName + ")"); From 14b65d1ecb34c37ca5bce53b502dac320ceec32b Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Mon, 13 May 2024 15:53:22 -0400 Subject: [PATCH 27/29] Delete .editorconfig As requested Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- .editorconfig | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 566485d..0000000 --- a/.editorconfig +++ /dev/null @@ -1,15 +0,0 @@ -# Declares that this is the top-level configuration -root = true - -# Applies to all files -[*] -indent_style = space -indent_size = 4 - -# Applies to all Markdown files -[*.md] -trim_trailing_whitespace = false - -# Applies to all C# and Java files, overriding rules declared before -[*.{cs,java}] -indent_size = 4 From 97f217a5cb288a24a9c788f452f1c62727471d16 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Mon, 13 May 2024 15:59:50 -0400 Subject: [PATCH 28/29] Update TerseDecompress.java updated version string and date Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- .../openmainframeproject/tersedecompress/TerseDecompress.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java index 935abba..64a256a 100644 --- a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java +++ b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java @@ -53,7 +53,7 @@ class TerseDecompress { +"-h or --help prints this message\n" ); - private static final String Version = new String ("Version 6, March 2024"); + private static final String Version = new String ("Version 5, May 2024"); private String inputFileName = null; private String outputFileName = null; private boolean isHelpRequested = false; From aabbf76b72eaa8d95f3803f95e5be3eabc10a9d7 Mon Sep 17 00:00:00 2001 From: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> Date: Thu, 16 May 2024 13:51:38 -0400 Subject: [PATCH 29/29] Update TerseDecompress.java Fix -b detection Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com> --- .../openmainframeproject/tersedecompress/TerseDecompress.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java index 64a256a..8285138 100644 --- a/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java +++ b/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java @@ -113,7 +113,7 @@ private void parseArgs(String args[]) { if (args[i].equals("-h") || args[i].equals("--help")) { isHelpRequested = true; } - else if (args[i].equals("-b")) { + else if (textMode && args[i].equals("-b")) { textMode = false; } // first non-flag argument is the input file name