Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 2, 2025

This PR implements support for multiple files in the cobj-idx migrate and cobj-idx unlock commands. Previously, these commands could only process one indexed file at a time, which was inefficient when working with multiple files.

Changes Made

Command Line Interface:

  • Both migrate and unlock commands now accept multiple file arguments
  • Updated help text to show [<indexed file>...] syntax indicating multiple files are supported
  • Maintains full backward compatibility with single file usage

Implementation Details:

  • Modified argument validation from unrecognizedArgs.length != 2 to unrecognizedArgs.length < 2
  • Added iteration logic to process all provided files sequentially
  • Enhanced error handling to continue processing remaining files when individual files fail
  • Proper exit codes: 0 for complete success, 1 if any file processing failed

Enhanced Testing:

  • Modified check_file.cbl to use ASSIGN TO INDEX_FILE_PATH with ASSIGN EXTERNAL feature for dynamic filename selection
  • Added comprehensive verification tests for all migrated files (indexed_file.dat, indexed_file2.dat, indexed_file3.dat)
  • Each migrated file is now verified to ensure proper read/write functionality after migration
  • Fixed cobj-idx script classpath to enable proper test execution

Error Handling:

  • Individual file errors are reported but don't stop processing of remaining files
  • Clear error messages identify which specific files failed
  • Maintains existing error message format for consistency

Example Usage

# Process multiple files at once
cobj-idx migrate file1.dat file2.dat file3.dat

# Unlock multiple indexed files
cobj-idx unlock db1.idx db2.idx db3.idx

# Single file usage still works (backward compatibility)
cobj-idx migrate single_file.dat

The implementation includes comprehensive testing that verifies each migrated file can be properly accessed for read and write operations, ensuring the migration process maintains data integrity across all processed files.

Fixes #707.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] cobj-idx unlock and cobj-idx migrate should handle multiple files Add multiple file support to cobj-idx migrate and unlock commands Sep 2, 2025
Copilot finished work on behalf of yutaro-sakamoto September 2, 2025 06:38
Copy link
Contributor

@yutaro-sakamoto yutaro-sakamoto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot AI changed the title Add multiple file support to cobj-idx migrate and unlock commands Add multiple file support to cobj-idx migrate and unlock commands with enhanced testing Sep 2, 2025
Copilot finished work on behalf of yutaro-sakamoto September 2, 2025 08:30
@yutaro-sakamoto yutaro-sakamoto marked this pull request as ready for review September 25, 2025 05:53
@Copilot Copilot AI review requested due to automatic review settings September 25, 2025 05:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements multiple file support for the cobj-idx migrate and unlock commands, allowing users to process several indexed files in a single operation instead of running the commands individually for each file.

  • Modified argument validation to accept multiple files and added iteration logic to process them sequentially
  • Enhanced error handling to continue processing remaining files when individual files fail, with proper exit codes
  • Updated test infrastructure to use dynamic file paths and added comprehensive verification tests for multiple file operations

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
IndexedFileUtilMain.java Added multiple file support to migrate/unlock commands with improved error handling
migrate.at Enhanced test to verify multiple file migration functionality with dynamic file paths
unlock.at Added test case for unlocking multiple files simultaneously

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@yutaro-sakamoto yutaro-sakamoto merged commit 1c85e3d into develop Sep 25, 2025
220 checks passed
@yutaro-sakamoto yutaro-sakamoto mentioned this pull request Sep 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cobj-idx unlock and cobj-idx migrate should handle multiple files

3 participants