Gasboy CFN III Mgnr's Mnl V3.4 User Manual
Page 217
MDE-4315 CFN Series CFN III Manager’s Manual for Windows NT · August 2004
Page 201
Advanced Command Files
The -Svar parameter of GOTO sets the value of the one-character variable var to the address
of the next line of the command file. The -Rvar tells GOTO to go to the location previously set
by GOTO -Svar for variable var.
The -S and -R parameters allow a limited form of subroutine. The call to the subroutine will
have a -S and the return a -R. Note that these variables are the same ones that are set by
SET_VAR.
Be careful to keep track of the variable names you have used, so you do not try to use the same
variable for more than one thing.
The first character on the line of a label for GOTO must be an asterisk; the label must come
right after the asterisk, with no spaces in between; a colon must come right after the label, also
with no spaces. Since the label is implemented as a comment line, the normal command
processor ignores it.
You can use GOTO to jump to anywhere in your command file, forward or backward. There is
no limit to the number of labels and GOTOs you can use in a file. GOTO starts its search for
the label at the beginning of the command file, so if you use subroutines, you should put them
at the beginning of your command file to improve performance.
You can also use LOOP and RETURN. Here is an example of a subroutine you could use with
LOOP and RETURN.
P* TYPE TEST6.CMD
↵
* short example of GOTO usage
* first go to main program
goto MAIN
* ----- CHECKPERM subroutine ----
* CHECKPERM is a subroutine to check user’s permission level
* %P is current user’s permission level
*CHECKPERM:
if - %P 4
BEGIN
echo Permission denied; has level %P, needs level 4
exit
END
goto -Rb
* ---- main program starts here ----
*MAIN:
echo Main program starting
* check permission level
goto -Sb CHECKPERM
* program returns to here after doing CHECKPERM subroutine
echo Main program continuing
P*