Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
CASE
◄Up► ◄Contents► ◄Index► ◄Back►
─────CASE───────────────────────────────────────────────────────────────────
Action
Marks the beginning of a statement block that executes if an item
in its expression list matches the test expression in a SELECT CASE
statement.
Syntax
CASE {DEFAULT | (expressionlist)}
statementblock
Parameter Description
DEFAULT The keyword indicating that the following
statement block is to execute if none of the
expressions in any other CASE statements match
the test expression constants or ranges of
constants.
expressionlist A list of constants or ranges of constants.
The values must be of type INTEGER, LOGICAL,
or CHARACTER*1. If the test expression matches
one of the values, the following block of
statements executes.
statementblock Executable statements (may be empty).
Remarks
The CASE statement may only appear within the SELECT CASE...END
SELECT construct.
Indicate ranges by placing a colon (:) between two values (such as
5:10 or 'A':'Z').
■ Omitting the low end of a range (:10 or :'Z') causes the CASE
statement block to execute for any test expression with a
value less than or equal to the specified upper bound.
■ Omitting the high end of the range executes the statement
block for any test expression with a value greater than or
equal to the low end given (such as 5: or 'a':).
The CASE DEFAULT statement is optional. You can include only one
CASE DEFAULT statement in a SELECT CASE block.
See Also: ◄SELECT CASE...END SELECT►
Example
CHARACTER*1 cmdchar
SELECT CASE (cmdchar)
CASE ('0')
WRITE (*, *) "Must retrieve one to nine files"
CASE ('1':'9')
CALL RetrieveNumFiles (cmdchar)
CASE ('A', 'd')
CALL AddEntry
CASE ('D', 'd')
CALL DeleteEntry
CASE ('H', 'h')
CALL Help
CASE ('R':'T', 'r':'t')
WRITE (*, *) "REDUCE, SPREAD and TRANSFER commands ",
+ "not yet supported"
CASE DEFAULT
WRITE (*, *) "Command not recognized; please re-enter"
END SELECT
-♦-