zowe / zowe-cli

Zowe CLI
Eclipse Public License 2.0
113 stars 88 forks source link

LIKE parameter for zowe zos-files create data-set-* #771

Closed zszabo14 closed 3 years ago

zszabo14 commented 4 years ago

Is your feature request related to a problem or limitation? Please describe. LIKE parameter missing from zowe zos-files create data-set-*

Describe the experience you'd like I would like to have --LIKE parameter for create data-set functions

Describe alternatives you've considered

Additional context Add any other context or screenshots about the feature request here.

Alexandru-Dumitru commented 4 years ago

Some context:

Enhancement request for Zowe SDK https://github.com/zowe/zowe-cli/issues/754 is being worked on as we speak, having open PR https://github.com/zowe/zowe-cli/pull/766.

That being said, moving this to Zowe CLI backlog, since this request is for the front-end CLI part.

Nike682631 commented 3 years ago

is this issue resolved

t1m0thyj commented 3 years ago

is this issue resolved

No, although the "like" functionality for creating a data set has been added to the zosfiles SDK (in ./packages/zosfiles), this new functionality has not yet been exposed with a parameter in Zowe CLI.

Until this issue has someone assigned, anyone who wants to contribute can feel free to pick it up 🙂

MikeBauerCA commented 3 years ago

@zszabo14 @t1m0thyj instead of a new parameter, what about a new command: zowe files create data-set-like with two positional parameters likeDataSetName and dataSetName so in use in would be syntactically similar to copy....

zowe files create data-set-like my.data.orig my.data.copy

zszabo14 commented 3 years ago

But the LIKE in JCL could be override: //SMSDS7 DD DSNAME=MYDS7.PGM,LIKE=MYDSCAT.PGM,DISP=(NEW,KEEP), LRECL=1024

MikeBauerCA commented 3 years ago

@Alexandru-Dumitru @katelynienaber does the new API support overriding specific attributes when performing allocate-like?

If so, we could stick with a separate new command and allow for override options. I just find it odd to perform a zowe files create pds command and then specify a --like flag that points to a physical sequential data set.

We also don't have a generic zowe files create data-set command. Perhaps we could choose not to have default values, but allow overrides. For example, zowe files create data-set my.data.copy --like my.data.orig --lrecl 1024.

Current syntax proposals:

  1. zowe files create data-set-like my.data.orig my.data.copy --lrecl 1024
  2. zowe files create data-set my.data.copy --like my.data.orig --lrecl 1024
Alexandru-Dumitru commented 3 years ago

@MikeBauerCA

The new API in Zowe CLI (Create.dataSetLike) doesn't support overrides as far as I can tell, but I checked z/OSMF documentation and I would like to suggest to move the implementation of Create.dataSetLike into the basic Create.dataSet, and have the like parameter as one of the ICreateDataSetOptions properties. This way we have the SDK API options modelled like the data expected by the REST API counterpart (more or less).

Create.dataSetLike is not used in CLI at the moment because it was added for Zowe Explorer's benefit. I think it's safe to assume we can deprecate it and coordinate with ZE squad to move to Create.dataSet if this will support the like attribute.

If I were to vote, I like the second proposal for the command format 😃 . It adds more flexibility for power users and I have the feeling this is what it's asked/expected. Does this mean Create.dataSet should be reworked to be type agnostic? currently it's not.

See REST API doc from z/OSMF here. Also, another thing to take into consideration is that this option is only available for z/OS 2.4. Not sure if there is some error handling in Zowe Explorer to catch this case. I think it was tested at the time and there is a pretty distinctive message from z/OSMF that this parameter is not available (something along those lines). Maybe @katelynienaber can validate.

Nike682631 commented 3 years ago

@MikeBauerCA then is proposal 1 a no go ??

zszabo14 commented 3 years ago

If I may vote, I vote the 2nd option : zowe files create data-set my.data.copy --like my.data.orig --lrecl 1024

MikeBauerCA commented 3 years ago

Thanks for the feedback all. Option 2 sounds good to me.

Does this mean Create.dataSet should be reworked to be type agnostic?

We need to enhance it to at least support a type without defaults. We need to continue to support the template types but I think having a generic create data set command could be helpful. While the data set types may be useful for a developer new to the mainframe platform, the various data set types in the CLI have led to confusion for some experienced mainframers adopting the CLI. For example, I've heard comments like what is a data-set-binary, or data-set-c, or data-set-classic. I think many experienced mainframers expect just as @zszabo14 outlined, I just want to create a data set and specify a --like parameter.

Now, for this zowe files create data-set command, I'm thinking all of the options should be left without defaults. The expectation being that users will either leverage the --like option and specify optional overrides or not leverage the --like option and fully specify the attributes. If they didn't want to fully specify the attributes they could always opt to use one of the template type creation commands.

Alexandru-Dumitru commented 3 years ago

If they didn't want to fully specify the attributes they could always opt to use one of the template type creation commands.

Either that or have them as templates under zowe files create data-set potentially having only one create data-set command. It will be a breaking change if others are removed, but even having them in parallel would make sense for a while.

Something like:

zowe files create data-set my.data.copy --template data-set-binary zowe files create data-set my.data.copy --template data-set-binary --lrecl 1024 would be equivalent to: zowe files create data-set-binary my.data.copy zowe files create data-set-binary my.data.copy --lrecl 1024

I can see the first format being a lot more easier to parametrize in automation scenarios. In this combo, I guess --template and --like should be mutually exclusive, as both would provide the starting values for allocation.

Just a thought 😃

MikeBauerCA commented 3 years ago

@Alexandru-Dumitru I personally like that direction. Perhaps longer term, we could also expose templates in config allowing for full user customization of templates so they can modify existing or add additional ones. For the scope of this issue though, let's keep it to the --like flag.

MikeBauerCA commented 3 years ago

Draft PR just opened related to this: #894. Still needs reviewed but wanted to link it all together.