How to Store Zowe CLI Arguments in Team Config
{Core} Although we’ve seen how to quickly allocate data sets with custom attributes before, we can replicate this process in a simpler way using The Open Mainframe Project’s Zowe CLI’s project config that is provided with vNext. To download vNext see Installing the Zowe CLI @next version.
Let’s get started by storing some of our command line options within zowe.config.json
.
Before & After
The goal is to take a long command with lots of arguments:zowe files create pds "ibmuser.fb81.demo" --record-format FB --record-length 81 --block-size 162 --primary-space 2 --secondary-space 2 --directory-blocks 5 --show-attributes
And achieve the same result with something shorter (and easier to remember):
zowe files create pds "ibmuser.fb81.demo" --zosmf-p zosmf.fb81
It only takes 3 steps!
Step 0: zowe config init
Run zowe config init
to create a boilerplate config file:
Step 1: Determine Arguments
Since we’re allocating data sets, we need to see which arguments to put in our config. Use help, e.g. zowe files create pds --help
:
For each argument we want to store in our zowe.config.json
we need to transform the command line option syntax to a camel case variable name, e.g.: --record-format
— >recordFormat
Step 2: Nest Properties in Config
Add the camel case options to your zowe.config.json
, nested under a zosmf
profile:
End Result
Instead of long commands with lots of options, we can store those in our zowe.config.json
and share with other members in your team(s):
Conclusion
You can apply this same approach with other commands or Zowe CLI plugins which accept a lot of arguments and share values via zowe.config.json
. Please comment or ask questions below!
If you enjoyed this blog, checkout more Zowe blogs here. Or, ask a question and join the conversation on the Open Mainframe Project Slack Channel #Zowe-dev, #Zowe-user or #Zowe-onboarding. If this is your first time using the Open Mainframe Project slack channel register here.