Display z/OS activity


These scripts issue a command (for example, D A,L), process the output, and display it to the operator.

showJobs

As the operator, you can use this function to perform a DISPLAY JOBS,LIST command on a console. This function uses the built-in captureOuptut function to install a temporary rule to process the message. When the output is received, formatJobOutput is called to format the message text into a table and send the table back to the viewer as an HTML pop-up.


//
// Function showJobs
//
// Description:
//   This function uses captutureOutput to set up a handler for the
//   IEE114I message and sends a "D J,LIST" command to the console.
//   The formatJobOutput function is called in response to the 
//   IEE114I message and formats the job list and pops it up on the
//   user's desktop who invoked this function.
//
// See Also:
//  formatJobOutput
//
function showJobs()

// Send in a clear key to clear the command input field.
sendCommand("@C")

// Hook up the output of the "D J,LIST" command to the formatJobOutput
// function.
captureOutput("message.MSGID == \"CNZ4105I\"", "formatJobOutput")


// Send the D J,LIST command.
sendCommand("D J,LIST")

return true

formatJobOutput

//
// Function formatJobOutput
//
// Description:
//   This function formats the output from the "D j,LIST" command
//   into a table and sends the result to the viewer that invoked the
//   showJobs function.
//
// See Also:
//  showJObs
//
function formatJobOutput(message)
    session messageSource
    trace("In formatJobOutput", CYAN)
    
    jobInfoColumns.add("Name")
    jobInfoColumns.add("Step")
    jobInfoColumns.add("User ID/Step")
    jobInfoColumns.add("Status 1")
    jobInfoColumns.add("Status 2")

    // Each line of text contains the information
    // for two jobs. The list line may only contain
    // one job, however. 
    trace("Line count = " & message.LINES.size(), CYAN)
    do i = 3 to message.LINES.size() - 1
        lineText = strTrimLeading(message.LINES[i])
        tokens = strSplit(lineText, " +")
        trace(tokens, CYAN)
        jobinfo = false
        jobinfo.add(tokens[0])
        jobinfo.add(tokens[1])
        jobinfo.add(tokens[2])
        jobinfo.add(tokens[3])
        jobinfo.add(tokens[4])
        jobInfoList.add(jobinfo)
        if tokens[5] != false then
            jobinfo = false
            jobinfo.add(tokens[5])
            jobinfo.add(tokens[6])
            jobinfo.add(tokens[7])
            jobinfo.add(tokens[8])
            jobinfo.add(tokens[9])
            jobInfoList.add(jobinfo)
        endif 
    end

    sendPopupTable(messageSource.NAME & " Active Jobs", jobInfoColumns, jobInfoList)

return true

showTsoUsers

Similar to showJobs, you can use this function to show the TSO users who is logged in. The results are shown in an HTML pop-up.

//
// Function showTsoUsers
//
// Description:
//   This function uses captutureOutput to set up a handler for the
//   CNZ4105I message and sends a "D TS,LIST" command to the console.
//   The formatTsoUserOutput funciton is called in response to the
//   CNZ4105I message and formats the TSO users and pops it up on the
//   user's desktop who invoked this function.
//
// See Also:
//  formatTsoUserOutput
//
// Copyright (c) 2014, BMC Software, Inc.
//

function showTsoUsers()


// Send in a clear key to clear the command input field.
sendCommand("@C")

// Hook up the output of the "D TS,LIST" command to the formatTsoUserOutput
// function.
captureOutput("message.MSGID == \"CNZ4105I\"", "formatTsoUserOutput")

// Send the command to generate the output.
sendCommand("D TS,LIST")

return true

formatTsoUserOutput

//
// Function formatTsoUserOutput
//
// Description:
//   This function formats the output from the "D TS,LIST" command
//   into a table and sends the result to the viewer that invoked the
//   showTsoUsers function.
//
// See Also:
//  showTsoUsers
//
// Copyright (c) 2014, BMC Software, Inc.
//
function formatTsoUserOutput(message)
    session messageSource

    trace("In formatJobOutput", CYAN)
    
    userInfoColumns.add("TSO ID")
    userInfoColumns.add("Status")
    userInfoColumns.add("")

    // Each line of text contains the information
    // for two jobs. The list line may only contain
    // one job, however. 
    trace("Line count = " & message.LINES.size(), CYAN)
    do i = 3 to message.LINES.size() - 1
        lineText = strTrimLeading(message.LINES[i])
        
        trace("Parsing line " & lineText, CYAN)
        tokens = regex(lineText, "([^ ]+) ([^ ]+) (..) +(.*)")
        trace("Result " & tokens, CYAN)
        
        do while tokens.MATCHES
            userinfo = false
            userinfo.add(tokens.GROUPS[0])
            userinfo.add(tokens.GROUPS[1])
            userinfo.add(tokens.GROUPS[2])
            userInfoList.add(userinfo)
            
            lineText = strTrimLeading(tokens.GROUPS[3])
               trace("Parsing line '" & lineText & "'", CYAN)
            
            if strLength(lineText) > 0 then
                   tokens = regex(lineText, "([^ ]+) ([^ ]+) (..) +(.*)")
            else
                tokens.MATCHES = false
            endif
            trace("Result " & tokens, CYAN)
        end
        
        
    end

    sendPopupTable(messageSource.NAME & " Active Jobs", userInfoColumns, userInfoList)

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*