z/OS DFSMS Implementing System-Managed Storage
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Using SELECT Statements

z/OS DFSMS Implementing System-Managed Storage
SC23-6849-00

Programming Interface Information

The SELECT statement defines a set of conditional execution statements. This statement has two formats: format-1 and format-2. Format-1 has an implied = operator between the SELECT variable and the WHEN value, as follows:

  • SELECT   ( variable )
       WHEN  ( constant )
             statement
       WHEN  ( constant or
             filtlist_name )
             statement
       OTHERWISE
             statement
       END

A format-2 SELECT statement has no select variable:

  • SELECT
       WHEN  (  condition )
             statement
       WHEN  (  condition )
             statement
       OTHERWISE
             statement
       END

All IBM-supplied ACS environment conditions are tested by the WHEN clauses. The comment, /* INSTALLATION EXIT */, indicates that the OTHERWISE clause is run only if an installation exit has set &ACSENVIR to a value you defined in an ACS routine exit. Figure 1 shows a format-1 SELECT statement with the select variable ACSENVIR:

Figure 1. Example of the Format-1 SELECT Statement
SELECT   (&ACSENVIR)
    WHEN  ('ALLOC')
         DO    ...    END
    WHEN  ('RECALL')
         DO    ...    END
    WHEN  ('RECOVER')
         DO    ...    END
    WHEN  ('CONVERT')
         DO    ...    END
    OTHERWISE  /* INSTALLATION EXIT */
         DO    ...    END
END

When coding ACS routines, remember that the WHEN clauses of the SELECT statement are tested serially. The first WHEN that is true causes its clause to be run. After the first true WHEN is encountered, the rest of the SELECT is not run. Figure 2 shows a format-2 SELECT statement:

Figure 2. Example of the Format-2 SELECT Statement
SELECT
    WHEN  (&RETPD  <  7)
         SET &MGMTCLAS  = 'DELSOON'
    WHEN  (&RETPD  <  30)
         SET &MGMTCLAS  = 'FREQBKUP'
    WHEN  (&RETPD  <  60)
         SET &MGMTCLAS  = 'NORMAL'
    OTHERWISE
         SET &MGMTCLAS  = 'DELNEVER'
END

End Programming Interface Information

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014