beautypg.com

How to use loops in command files – Gasboy CFN III Mgnr's Mnl V3.4 User Manual

Page 210

background image

Advanced Command Files

Page 194

MDE-4315 CFN Series CFN III Manager’s Manual for Windows NT · August 2004

How to Use Loops in Command Files

Two commands, LOOP and RETURN, support looping in command files.
When the command LOOP is executed, the current position in the command file
is recorded. If the command RETURN is executed, processing will resume at
the location where the last LOOP was found. If a RETURN is executed and
there was no LOOP, the command file is restarted. To get out of a loop, use IF to
skip over the RETURN.
Note: You cannot perform “nested” loops.

The three forms of LOOP-RETURN are:

• do . . . while
• do . . . until
• while . . . do

The do . . . while form uses an IF with a positive statement and looks like this:

P* TYPE TEST2.CMD

if -y Are you sure?

BEGIN
pr da
pr pu
END

else

BEGIN
echo Not sure.
if -y Are you really REALLY not sure?
BEGIN
echo Definitely not sure.
exit
END
else
echo Not sure if not sure.
END

P* TEST2

Are you sure? y

pr da
Sat 9/18/99 11:40AM, Trans=57, Seq=624 SCIIIv3.3
pr pu
P# T# Pr Pc Price

Totals

$Total

Rate

Limit Slow

1 1 1 1 0.799

178.770

181.10

100/$

$30

0.500

2 2 2 0.859

360.716

322.74

3 3 3 0.919

740.360

741.94

2 1 1 1 0.799

84.110

66.44

100/$

$30

0.500

3 2 3 0.919

2.140

3.13

3 3 3 0.919

462.540

494.42

3 3 3 3 0.919

353.044

357.14

100/$

$30

0.500

4 4 4 4 1.069

336.634

349.97

100/$

$30

0.500

5 1 1 1 0.799

7019.954

6722.35

100/G

$500

0.500

6 2 2 2 0.859

503.411

548.22

100/G

$30

0.500

7 3 3 3 0.919

464.840

578.71

100/G

$30

0.500

8 4 4 4 1.069

778.470

804.44

100/G

$30

0.500

========

=======

11284.99 11170.60

P* TEST2

Are you sure? n

Not sure.
Are you really REALLY not sure? y

Definitely not sure.

P*

This manual is related to the following products: