Migrate COBOL merge sort program to Java #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Migrate COBOL merge sort program to Java
Summary
This PR migrates the existing COBOL merge sort program (
merge_sort/merge_sort_test.cbl) to Java while preserving the file-based sorting approach and exact functionality. The implementation creates a CustomerRecord class with the same field structure as the COBOL program and implements external file-based merge and sort operations rather than using in-memory collections.Key Components:
CustomerRecord.java- Data structure matching COBOL record layout with fixed-width file serializationFileMergeSorter.java- Core merge and sort operations using file I/OMergeSortExample.java- Main entry point replicating COBOL program flowREADME.md- Comprehensive documentation with COBOL comparisonBehavior Preserved:
Review & Testing Checklist for Human
Recommended Test Plan:
Diagram
%%{ init : { "theme" : "default" }}%% graph TD COBOL["merge_sort_test.cbl"]:::context CustomerRecord["CustomerRecord.java<br/>Data structure & serialization"]:::major-edit FileMergeSorter["FileMergeSorter.java<br/>Core merge/sort operations"]:::major-edit MergeSortExample["MergeSortExample.java<br/>Main program entry point"]:::major-edit README["README.md<br/>Documentation"]:::minor-edit TestFile1["test-file-1.txt<br/>East region data"]:::context TestFile2["test-file-2.txt<br/>West region data"]:::context MergeOutput["merge-output.txt<br/>Merged & sorted by ID"]:::context SortedOutput["sorted-contract-id.txt<br/>Sorted by contract ID desc"]:::context COBOL -.->|"migrated to"| MergeSortExample MergeSortExample --> FileMergeSorter FileMergeSorter --> CustomerRecord FileMergeSorter -->|"creates"| TestFile1 FileMergeSorter -->|"creates"| TestFile2 FileMergeSorter -->|"merges to"| MergeOutput FileMergeSorter -->|"sorts to"| SortedOutput CustomerRecord -->|"serializes to"| TestFile1 CustomerRecord -->|"serializes to"| TestFile2 subgraph Legend L1[Major Edit]:::major-edit L2[Minor Edit]:::minor-edit L3[Context/No Edit]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes
Link to Devin run: https://app.devin.ai/sessions/1b508ed0eecf47b9a63318a1222a926f
Requested by: @schaudhry123