WHEN Statement

The WHEN statement is subordinate to a SELECT statement and is always followed by an expression enclosed in parentheses. Each WHEN statement is followed by a set of zero or more action statements preceding the next WHEN or OTHERWISE statement. This is called a WHEN group. The expression is a pair of edit scripts separated by either an equal sign (=) or a not equal set of symbols (¬=). The two scripts are run against a command and the results are compared, after the leading and trailing blanks or null values are removed. If the two are equal (or not equal, depending on the separator value), then the command is considered to have matched that WHEN statement. Such a command is acted upon by the action statements of the WHEN group and is not compared with other WHEN statements under the same SELECT statement, and it is not matched to the OTHERWISE statement.

The WHEN statement uses the following syntax:

WHEN

Read syntax diagramSkip visual syntax diagramWHEN  (action_statement)
Parameter
Description
action_statement
Edit orders that you can specify. See Table 1 for a list of the edit orders that you can specify.
Examples:
These are examples of the WHEN statement:
WHEN(CONSAUTH = 'I')           ! console's authority is "I/O"
WHEN(CONSNAME left 3 = 'MST')  ! console's name begins with "MST"
WHEN(WORD 2 = '')              ! command entered with no arguments
WHEN(ASTYPE = 'D')             ! command from USS persistent procedure
WHEN(CMDVERB = 'SWITCH')       ! switch command issued  -- or ....
WHEN(CMDVERB = 'I')            ! switch command issued

See the NetView® online help or IBM Z® NetView Programming: Pipes for information about using PIPE EDIT orders.