Development and Pipeline

Development and Pipeline

Development and Pipeline

Connecting mainframe application developers to discuss efficiently creating and maintaining z/OS applications

 View Only

Using IDz V14.2 Menu Manager USS Action

By Claire Nelson posted Thu November 07, 2019 12:00 AM

  
IBM Developer for z/OS users can create their own menu items to run commands on TSO and MVS. Prior to version 14.2, however, there was no Menu Manager action for executing USS commands and scripts. The Developer for z/OS 14.2 release introduces support for running USS commands and scripts using Menu Manager. This new feature is accessible through a new Menu Manager action, which can be added to any views that support the Menu Manager TSO Action, such as Editors, the Remote Systems view, and the z/OS Projects view.

Running a USS command using Menu Manager


Creating the Menu Manager USS action


The following scenario illustrates how to create a Menu Manager action for running the following USS command to recursively list the directories and files of the current user.


ls -l -R /u/$userid


where $userid is a what is known as a variable. When the Menu Manager action is invoked, this variable gets replaced with the userid of the person running the menu manager action.


Follow these steps to create a simple Menu Manager USS action.



    1. Select Window > Preferences


      Opening Preferences page

    1. In the Preferences window, expand Menu Manager and select Actions and Menus.


      Opening the Menu Manager Preferences page

    1. On the Actions and Menus Preferences page, click New Local/Remote Action.

    1. On the New Action page, specify the name of the action, for example, “List user directories and files”.


      Specifying the new action name

    1. On the File Associations page, select the file type to associate with the action, for example select *.* and click Add.


      Selecting filter for the menu action
    2. Click Next.


      Done selecting filter for the menu action

    1. Optional: On the Data Set Filters page, specify any data set filter. Then, click Next.


      Optional data set filter page

    1. On the Run Options page, fill in the following information:

        1. In the command text area, specify the USS command: ls -l -R /u/$userid

          Note: Other variables are also available for use in a command. To explore what other variables are available, press the Variables… button.

        1. In the Action Properties section, select the Show on generic menu checkbox.

        1. In the Action Properties section, select Use existing action, and then click Select.


          New Action wizard command page

        1. On the Action Selection page, under com.ibm.ftt.ui.menumanager, select com.ibm.ftt.ui.menumanager.ussaction and then click OK.


          Select Menu Manager USS Action

        1. On the Run Options, page, click Finish.


          Finish providing information for the action

      1. On the Actions and Menus page, click OK to exit the Preferences window.


        Done with creating new action

Refer to the IDz Menu Manager documentation in the Developer for z/OS Knowledge Center and also the References section at the end of this article for more detailed IDz Menu Manager scenarios, such as creating menus, submenus, user prompts, and selection lists.


Using the new Menu Manager USS action


To use the new Menu Manager action created in the preceding steps, in the Remote Systems view, right-click a file under z/OS UNIX Files or an MVS data set member under MVS Files and select the menu item List user directories and files.




Context menu for selecting the Menu Manager action

After you select the menu item, click the Remote Console tab at the bottom of the page to see the results:


Remote Console view with the action results


Scroll down to see the rest of the contents, as needed. Click the maximize icon to expand the Remote Console to full view.


Bottom of the actions results page


Prompting the user for input and displaying the command output in a dialog


At times, you might want users to provide values to the script. Some information, such as the current user ID, is already known and does not need to be prompted. Some other information might need to be provided by the end user.


As an alternative to the above command, the following command prompts the end user with a list of directories from which to choose. When the action is executed, it lists the contents of the directory that the user has selected from the drop-down list.


ls -l -R $input(Select directory to list,,$list{/u/$userid/another,/u/$userid/sandbox,/u/$userid})


The command response can also be shown in a dialog that gives the user the opportunity to save the contents to a file. To add this function to the command, select Show output in dialog on the command Run Options page.


Menu Manager action creation dialog


When the Menu Manager action is selected from the menu, the user is prompted to select from a list:


Menu Manager pull-down input dialog


After execution, the output is shown in a dialog, with the option to save to a file if needed.


Menu Manager action response dialog


The following command (all in a single line) illustrates different types of input, each with default values specified. When the action is executed, a dialog is shown.


sh -c "/u/$userid/test/sample.sh --sourceDir $input(Source directory:,/u/$userid/sandbox,$list{/u/$userid/another,/u/$userid/sandbox,/u/$userid/test}) --workDir $input(Work directory:,/u/$userid/sandbox/work,$list{/u/$userid/another/work,/u/$userid/sandbox/work,/u/$userid/test/work}) --freeformInput $input(Free Form Input,$userid.free.form) --selectedResource $fullname"


sample.h is a simple Shell script, used for illustration, that displays the parameters that are passed to it. The following is the content of the script:

#!/bin/sh
#
# Sample Shell script to help illustrate invoking USS scripts using Menu Manager
#
# expected to run in shell share, do NOT use "exit"
#

rc=0

echo The full path of the script that is invoked: "$0"
echo The total number of arguments provided to the script: "$#"
echo The list of all the arguments are: "$*"
echo
echo The parameters passed to the script are:
echo
for parameter in "$@"
do
echo Parameter: $parameter
done
echo
echo Displaying the parameters and their values separately:
echo
echo The selected resource parameter is: "$7" and the selected resource is: "$8"
echo The source directory parameter is: "$1" and the source directory is: "$2"
echo The work directory parameter is: "$3" and the work directory is: "$4"
echo The Free Form Input parameter is: "$5" and the Free Form Input is: "$6"

exit $rc


This screen capture shows the Menu Manager run options for the command:


Menu Manager new action wizard page


When this command is selected from the menu, the user is presented with this input dialog:


Menu Manager input dialog


After the user clicks OK, the output is shown in the Action Output dialog:
Menu Manager action output dialog


Additional information


Storing Menu Manager actions
      By default, the Menu Manager actions are saved at the location specified by the %TPFSHARE% environment variable, which point to < IDz-Installation-directory>\Config\TPFSHARE, where < IDz-Installation-directory> is the location where the current IDz version is installed. To change the location where the Menu Manager actions are to be saved, click New… and then on the New File page, specify a different file location where to save the actions. Then, click Finish.

New file dialog for saving Menu Manager actions


Bringing the Remote Console view into focus
      Another way to get to bring the Remote Console view in focus, select Window -> Show View -> Other



Selecting a view to bring it into focus


      Then, under Remote Systems, select Remote Console



Selecting the Remote Console view

References



      1. RDz Workbench Menu Manager.pdf

      1. IDz Menu Manager documentation


Acknowledgements


      Many Thanks to Susan Mazzara for reviewing, restructuring and making this article much better. Also, many thanks to Bill Alexander, Dan McCarty, Gina Long for their valuable feedback.
0 comments
10 views

Permalink