How to use case statements in command files – Gasboy CFN III Mgnr's Mnl V3.4 User Manual
Page 212
Advanced Command Files
Page 196
MDE-4315 CFN Series CFN III Manager’s Manual for Windows NT · August 2004
How to Use Case Statements in Command Files
The command CASE, when used in a command file, allows the user to pick one command to
execute from a list of several. The maximum number of cases in a CASE statement is 99.
There are two forms of case statement. The first is:
CASE [-d] -p n1 n2
command1
command2
. . . .
commandn1
[default command]
In the first form, with the -p switch, the number of the case selected is passed from the
command line. The n1 argument is the total number of cases. The n2 argument is the case to
execute.
If the optional -d switch is used, the number of cases is one greater than the number indicated
by n1. The last command, the default command, will be executed if none of the other cases
matches.
The second form of the case statement is:
CASE [-d] -e n1 text
command1
command2
. . . .
commandn1
[default command]
In the second form, with the -e switch, the number of the case selected is entered by the user
from the data terminal or console. The n1 argument is the total number of cases. Text is
displayed on the command terminal or console. The user then enters the number of the case to
execute. If the user enters a number that is greater than n1, text is displayed again.
If the optional -d switch is used, the number of cases is one greater than the number indicated
by n1. With the -d option, if the user enters a number that is greater than n1, the default
command is executed, and text is not displayed again.
P* TYPE TEST3.CMD
↵
case -p 3 %1
shift1
shift2
shift3
P*
P* TYPE TEST4.CMD
↵
case -e 3 Shift (1-3):
shift1
shift2
shift3
P*