Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit of a PDS or PDSE (as opposed to a member) should fail or show a list of members #75

Open
MikeFultonDev opened this issue Oct 22, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@MikeFultonDev
Copy link
Collaborator

This is opened from a report in: #68

Edit a PDS by mistake
vim "//'@02858.t.cntl'"

@IgorTodorovskiIBM we probably need more 'handshaking' for this scenario and it is also related to: #73 but perhaps we at least fail the edit as a starting point.

@MikeFultonDev
Copy link
Collaborator Author

MikeFultonDev commented Oct 23, 2024

@IgorTodorovskiIBM for now, I think a reasonable fix would be for you to check the information on the dataset after the open, and if it's a PDSE or PDS and no member was specified, to fail, e.g.

struct DFILE* dsfile = open_dataset(ffname, NULL);
...
if ((dsfile->dsorg == D_PDSE || dsfile->dsorg == D_PDS) && has_member(dsfile->difile)) {
   error
}

We need to expose the has_member function for this - and probably that can be at the dsfile level.
I don't think it makes sense to put this into libdio because for other uses, the user may want to read the pds member (e.g. to get the directory information for the pds).

Thoughts?

@IgorTodorovskiIBM
Copy link
Collaborator

Agree, I have added the code in 2149fe0 and zopencommunity/libdio@fcabd76. It will be available in the next release of vim%datasetio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants