Using command line to interact with z/OS

You can use the Terminal window in VS Code to run command-line operations on your client. For example, you can use the terminal to perform file-based operations and execute any kind of Git commandsopen in new window on your local files right from this terminal.

In addition, you can interact with z/OS® by using commands that are provided by IBM® RSE API plug-in for Zowe™ CLI (RSE CLI plug-in), Zowe CLI, or both in the Terminal window. These commands provide various capabilities for interacting with z/OS resources that include MVS™, jobs, and z/OS UNIX System Services.

To open the Terminal window, click Terminal > New Terminal or press Ctrl+`. It is opened at the bottom below the editor and inside the working directory that contains all the files that are shown in the Files view.

Comparison between Zowe CLI and RSE CLI plug-in

Both of Zowe CLI and RSE CLI plug-in provide the commands, with slight differences in command names and options, to let you perform the following tasks:

  • List, create, rename, delete z/OS UNIX System Services files and directories and MVS data sets and members
  • Run JCL jobs
  • Browse job spool files

Though the capabilities of Zowe CLI and RSE CLI plug-in are similar, the installation and configuration requirements are different:

  • To use the commands provided by Zowe CLI to interact with z/OS, you must configure z/OSMFopen in new window before you install Zowe CLI.

  • RSE CLI plug-in extends Zowe CLI to let you interact with z/OS resources by using IBM Remote System Explorer API (RSE API) as an alternative to using z/OSMF. The RSE API is a collection of REST APIs that allow a client to work with various components on the z/OS host system, including MVS data sets, z/OS UNIX files and commands, JES jobs, and more. The overall solution results in a complete set of operations that allows you to do everything as you could do with z/OSMF. Therefore, RSE CLI plug-in is a great alternative if you have used the Remote System Explorer API with other IBM offerings such as IBM Developer for z/OS or IBM Explorer for z/OS.

For more information about the commands provided by Zowe CLI and RSE CLI plug-in, see the command mapping table.

Using RSE CLI plug-in commands

Prerequisites

Running RSE CLI plug-in commands

After installing RSE CLI plug-in, you can use it in a command-line window on your development machine. You can issue commands to perform the following tasks:

  • List, create, download, upload, and delete MVS data sets and members as well as z/OS UNIX System Services files and directories.
  • Submit jobs, list jobs and spool files, download or view spool content, view job status, cancel a job, and delete a job.

For example, after you created your RSE profile for the user USER1 and a data set with your COBOL programs called USER1.SAMPLE.COBOL, you can work on your MVS data sets with the following commands:

  • List your data sets and members:

    zowe rse ls ds USER1
    zowe rse ls all-members USER1.SAMPLE.COBOL
    
  • Download members:

    zowe rse download ds "USER1.SAMPLE.COBOL(SAM1)"
    

    You will see that new folders appear on the left with the names based on your data set that contains the file SAM1. You can rename it by adding a .cbl extension to edit it in the COBOL editor, and then upload it later using drag-and-drop or via the command line.

  • Check the status of your jobs:

    zowe rse ls js | grep ACTIVE
    

    The command above shows an example of how RSE CLI plug-in commands can be used in combination with other Linux® commands and scripts. This example returns the complete list of jobs and pipes that list into the Linux grep command to filter it down to show only the active jobs. This kind of capability enables you to define all kinds of batch jobs and automation for remotely interacting with z/OS.

For the full list of available commands, see IBM RSE API Plug-in for Zowe CLI commands.

Debugging CLI commands via logs

RSE CLI plug-in will write logs to Zowe CLI's log file located in ~/.zowe/zowe/zowe.log. The default log level for Zowe CLI's logging is WARN. To change the log level, set the environment variable ZOWE_APP_LOG_LEVEL to the preferred level.

For more information about Zowe CLI's logging, see Setting CLI log levelsopen in new window.

Getting help about commands and options

To learn about a command and all options for the command, add --help after the command. For example, by specifying zowe rse list --help, you can see all the different items that can be listed and a help response like this in the terminal:

DESCRIPTION
 -----------

   List z/OS UNIX System Services file and folders, data sets and data set members, or jobs and spool
   files. Optionally, you can list their details and attributes.

 USAGE
 -----

   zowe rse-api-for-zowe-cli list <command>

   Where <command> is one of the following:

 COMMANDS
 --------

   all-members | am            List all members of a pds
   data-set | ds               List data sets
   jobs | js                   List z/OS jobs on JES spool/queues
   spool-files-by-jobid | sfbj List spool files of a z/OS job
   uss-files | uss             List z/OS UNIX System Services files

GLOBAL OPTIONS
 --------------

   --response-format-json  | --rfj (boolean)

      Produce JSON formatted data from a command

   --help  | -h (boolean)

      Display help text

   --help-examples  (boolean)

      Display examples for all the commands in a the group

   --help-web  | --hw (boolean)

      Display HTML help in browser

If you want to view the help response in a web browser, enter --help-web. For example, zowe rse list --help-web.

Online Help rendered as a web page

Run interactive TSO commands

zowe rse issue cmd "TSO EX 'HLQ.REXX.EXEC(ASKNAME)'" --shell-id myshell

The system prompts for a response:

What is your name?

Enter your response:

zowe rse issue cmd "BABE RUTH" --shell-id myshell

The system again responds:

Your name is:  BABE RUTH

The preceding example shows how RSE CLI plug-in commands can be used to execute interactive TSO commands by using the --shell-id option. This example executes a REXX exec that prompts the user for a name. It also demonstrates how to respond and allow the interactive command to continue to completion.

Using Zowe CLI z/OSMF commands

Prerequisites

Running Zowe CLI commands

For example, after you created your Zowe CLI z/OSMF profile for the user USER1 and a data set with your COBOL programs called USER1.SAMPLE.COBOL, you can work on your MVS data sets with the following commands:

  • List your data sets and members:

    zowe files ls ds USER1
    zowe files ls all-members USER1.SAMPLE.COBOL
    
  • Download members:

    zowe files download ds "USER1.SAMPLE.COBOL(SAM1)"
    

    You will see that new folders appear on the left with the names based on your data set that contains the file SAM1. You can rename it by adding a .cbl extension to edit it in the COBOL editor, and then upload it later using drag-and-drop or via the command line.

  • Check the status of your jobs:

    zowe jobs ls js | grep ACTIVE
    

    The preceding command shows an example of how Zowe CLI commands can be used in combination with other Linux commands and scripts. This example returns the complete list of jobs and pipes that list into the Linux grep command to filter it down to show only the active jobs. This kind of capability enables you to define all kinds of batch jobs and automation for remotely interacting with z/OS.

For an overview of available Zowe CLI commands, type zowe --help.

To learn about all the capabilities of Zowe CLI, see Zowe CLI Online Documentationopen in new window.

Last Updated:
Contributors: Shi Kun Li, Billie Simmons, KRISTINA MAYO, Billie Simmons, kmaselli, Min Huang, Billie, BillieJean-Simmons, Chun Hong Zheng, Greg Lambert, Peter Haumer, Rudy Leonel Pichola Flores