How to use branching and subroutines – Gasboy CFN III Manager Manual V3.6 User Manual
Page 222
![background image](https://www.manualsdir.com/files/787488/content/doc222.png)
Advanced Command Files
How to Use the IF Command
Page 20-10 MDE-4871 CFN III Manager’s Manual for Windows® XP Embedded - Version 3.6 · August 2010
In the first line of the example, note that there is a space before the equals sign (=), but not
after.
[P:]* SET x =M 1.23
↵
[P:]* SET
↵
x = “123”
[P:]* ECHO %x
↵
123
[P:]* ECHO;p1=”Money=@M” %x
↵
Money=1.23
[P:]*
New for internationalization, a number can be formatted into a user variable using the same
format options available for the p1 option. This converts the internal format of numbers in
command files (which do not have decimal points in them) in to a form that can be used as
input for commands that require decimal points in the correct place for different international
formats. For example, if the current international format is USA:
set x <@M 12345
would place ‘123.45’ into variable ‘x’.
How to Use Branching and Subroutines
The command GOTO allows branching to arbitrary locations in a command file. The format
of GOTO is:
GOTO [-Svar|-Rvar] label
The format of label is:
*label: any comments here
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 must put
them at the beginning of your command file to improve performance.