Skip to content

Add --overwrite option to creation commands#938

Open
t1m0thyj wants to merge 6 commits intomainfrom
fix/add-overwrite-flag
Open

Add --overwrite option to creation commands#938
t1m0thyj wants to merge 6 commits intomainfrom
fix/add-overwrite-flag

Conversation

@t1m0thyj
Copy link
Copy Markdown
Member

@t1m0thyj t1m0thyj commented Apr 14, 2026

What It Does

Fixes #642

How to Test

Run the following commands with and without the --overwrite flag:

  • zowex ds create-member {pdsWithMemberThatExists}
  • zowex uss create-file {filePathThatExists}

Also try with the VSCE to create PDS members and USS files that already exist. For data sets, you should be prompted to replace. For USS, you should see an error. This behavior matches z/OSMF.

Review Checklist
I certify that I have:

Additional Comments

Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
@github-project-automation github-project-automation bot moved this to New Issues in Zowe CLI Squad Apr 14, 2026
@zowe-robot zowe-robot moved this from New Issues to In Progress in Zowe CLI Squad Apr 14, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 14, 2026

Comment thread native/c/zusf.hpp Outdated

int zusf_copy_file_or_dir(ZUSF *zusf, const std::string &source_fs, const std::string &dest_fs, const CopyOptions &options);
int zusf_create_uss_file_or_dir(ZUSF *zusf, const std::string &file, mode_t mode, bool createDir);
int zusf_create_uss_file_or_dir(ZUSF *zusf, const std::string &file, mode_t mode, bool createDir, bool overwrite = false);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

perhaps this is a good time to add an options struct?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Resolved in 1100c36

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should we be concerned about this being a breaking change?

If so, I could add back an overload for passing create_dir parameter to keep backward compatibility.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No concerns here

Comment thread native/c/commands/ds.cpp Outdated
if (!overwrite && zds_member_exists(dataset_name, member_name))
{
context.error_stream() << "Error: could not create data set member: '" << member_name << "' rc: '" << RTNCD_FAILURE << "'" << std::endl;
context.error_stream() << " Details: Data set member already exists: '" << dsn << "'" << std::endl;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can we hint that the user should specify an overwrite

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I like this idea, but am on the fence about how it would come across to users of the VS Code extension - if we suggest to pass the --overwrite flag that will only be applicable for zowex CLI.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I see. Two thoughts in response:

  1. perhaps this should be a warning condition instead of a failure?
  2. how would the VS Code extension indicate the overwrite behavior?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Discussed offline - plan to make it a warning, but no need to support overwrite from the VSCE at this time.

Copy link
Copy Markdown
Contributor

@pujal0909 pujal0909 Apr 15, 2026

Choose a reason for hiding this comment

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

Image

Should we call it replace to match VSCE behavior?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We show the same prompt for SSH profiles in the VSCE. Is the suggestion to rename the --overwrite flag on the CLI command?

Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
@pull-request-size pull-request-size bot added size/L and removed size/M labels Apr 16, 2026
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
@t1m0thyj t1m0thyj linked an issue Apr 17, 2026 that may be closed by this pull request
jace-roell and others added 2 commits April 17, 2026 10:55
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
@t1m0thyj t1m0thyj marked this pull request as ready for review April 17, 2026 15:18
@sonarqubecloud
Copy link
Copy Markdown

@zowe-robot zowe-robot moved this from In Progress to Review/QA in Zowe CLI Squad Apr 17, 2026
Comment thread native/CHANGELOG.md
- `c`: Added the `getInfo` RPC to retrieve the middleware version and build information. [#922](https://github.com/zowe/zowex/pull/922)
- `c`: Added a DCB abend exit for handling edge cases around PDS member open, write, and close operations. When an abend is encountered, it is either delayed or ignored (when applicable) and an error is returned gracefully via the diagnostic structure (`ZDIAG`) rather than terminating the process. Refer to [DCB abend exits](doc/dcb-abend-exit.md) for more information on how and when abends are handled. **Note:** In the event of an end-of-space (end-of-volume) abend, the operating system closes the DCB if the ignore request is honored from the abend exit. However, the abend might still percolate during end-of-volume `CLOSE` routines. An ESTAE/ESTAEX recovery routine should be used to gracefully handle these cases. [#839](https://github.com/zowe/zowex/issues/839)
- `c`: Fixed an issue where listing the members of a protected, partitioned data set resulted in an unclear error message. Now, the error messages are more specific and include information about insufficient permissions when applicable. [#297](https://github.com/zowe/zowex/issues/297)
- `c`: Fixed an issue where `zowex ds create-member` command would overwrite an existing member. Added an `--overwrite` flag to the command that defaults to false. [#642](https://github.com/zowe/zowex/issues/642)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
- `c`: Fixed an issue where `zowex ds create-member` command would overwrite an existing member. Added an `--overwrite` flag to the command that defaults to false. [#642](https://github.com/zowe/zowex/issues/642)
- `c`: Fixed an issue where the `zowex ds create-member` command would overwrite an existing member. Added an `--overwrite` flag to the command that defaults to false. [#642](https://github.com/zowe/zowex/issues/642)

## Recent Changes

- **Breaking:** Renamed contributed setting IDs from `zowe-native-proto` to `zowex`. All references to `zowe-native-proto` should be replaced with `zowex` in VS Code `settings.json` files. [#831](https://github.com/zowe/zowex/issues/831)
- Fixed an error when creating a member that already exists if the "Replace" option is selected. [#642](https://github.com/zowe/zowex/issues/642)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Fixed an error when creating a member that already exists if the "Replace" option is selected. [#642](https://github.com/zowe/zowex/issues/642)
- Fixed an error that would overwrite a member that already existed when creating a member with the "Replace" option. [#642](https://github.com/zowe/zowex/issues/642)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Review/QA

Development

Successfully merging this pull request may close these issues.

zowex(ds): zowex ds create-member may cause data-loss

6 participants