Convert COBOL Merge Sort to Java Implementation #28
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.
Convert COBOL Merge Sort to Java Implementation
Summary
This PR adds a Java implementation of the existing COBOL merge sort program in
merge_sort/merge_sort_test.cbl. The Java version replicates the exact functionality and output format of the COBOL program:Key Components Added:
Customer.java- Record class with fixed-width string formatting (135 chars per record)MergeSortJava.java- Main program implementing the same 3-phase workflow as COBOLREADME.md- Documentation comparing both implementationsProgram Flow (identical to COBOL):
merge-output.txtsorted-contract-id.txtOutput Verification:
diffcommand shows zero differences between COBOL and Java console output and generated files.Review & Testing Checklist for Human
./merge_sort_testandjava MergeSortJavato verify outputs are truly identicalCustomer.fromFixedWidthString()substring indices: (0,5), (5,55), (55,105), (105,110), (110,135) against COBOL record definitiontest-file-1.txt,test-file-2.txt,merge-output.txt,sorted-contract-id.txtbetween both implementationsDiagram
%%{ init : { "theme" : "default" }}%% graph TD COBOL["merge_sort_test.cbl<br/>Original COBOL Program"]:::context CustomerJava["Customer.java<br/>Record Class"]:::major-edit MergeSortJava["MergeSortJava.java<br/>Main Program"]:::major-edit README["README.md<br/>Documentation"]:::major-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 by Customer ID"]:::context SortOutput["sorted-contract-id.txt<br/>Sorted by Contract ID"]:::context COBOL -->|"generates"| TestFile1 COBOL -->|"generates"| TestFile2 COBOL -->|"creates"| MergeOutput COBOL -->|"creates"| SortOutput MergeSortJava -->|"uses"| CustomerJava MergeSortJava -->|"replicates behavior"| COBOL MergeSortJava -->|"generates identical"| TestFile1 MergeSortJava -->|"generates identical"| 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
picclausesSystem.exit(1)to match COBOL's error behaviorLink to Devin run: https://app.devin.ai/sessions/470daf8b12904ef09f63ccce7ad52515
Requested by: @schaudhry123