Chapter 11: Programming Amanda
85
record in a database for any company that sends you supplies. The individual parts of your
name and address are fields of that record. In a database, another name for a record is a
row, and another name for a field is a column.
Sample Address Record:
First Name: MARY
Last Name: HU
Street Address: 28291 HOOVER ST.
City: WINTER FALLS
State: MI
Zip: 48444
Text files that contain database records should have commas separating each field of each
record and a carriage return/linefeed separating one record from another. (A carriage
return/linefeed is the pair of ASCII characters placed in a file when you press Enter on
your keyboard.)
Sample Address Record as a line in a text file:
MARY,HU,28291 HOOVER ST.,WINTER FALLS,MI,48444
When Amanda reads records from a text file, you tell her the number of the fields you
want to read or change the data in. The fields are numbered starting with 1. In our
example, First Name is 1, and Last Name is 2.
dBase files are created using dBase, a database software product. For dBase files, you tell
Amanda the name of the field instead of its number. When Amanda reads data from a
dBase file, she deletes any spaces at the end of the data as she stores the data into a
variable. For example, if the field contains "MARY ", Amanda reads only
"MARY".
Flow of Control: Branching and Looping
When programming Amanda, you often type the tokens for a program in more than one
field. This is not because you have exceeded the 65-character limit for the Extension or
Notify Method field, but because you want to control the flow of token processing. For
example, the only way to have Amanda perform different actions based on the value of a
variable, is to put the tokens for one set of actions in another Extension field.
The commands that control the flow of tokens are:
•
The I() command which compares two values. (Notice that this is not the same as
the %I() command/system variable discussed earlier in this chapter.) This com-
mand is similar to the If command or If statement in other programming languag-
es. It is used to branch in either of two directions, depending on whether the
comparison is true or false. If the comparison is true, Amanda goes to another
mailbox’s Extension field and processes the tokens there. If the comparison is
false (for example, %S1 is not equal to the empty string), Amanda continues pro-
cessing tokens where she is.
For example, I(%S1,=,'',101) can be read as “If the variable %S1 equals the empty
string, go to mailbox 101. If not, go to the next token in this mailbox.”
I(%G0,>,5,2000) can be read as “If the variable %G0 is greater than 5, go to mailbox
2000. If not, go to the next token in this mailbox.”
Содержание [email protected] Version 3.xx
Страница 1: ...Installing AmAndA Work Place Version 3 xx Installer s Guide Edition 7 01...
Страница 4: ...iv Installing Amanda Work Place...
Страница 60: ...52 Installing Amanda Work Place...
Страница 68: ...60 Installing Amanda Work Place...
Страница 132: ...124 Installing Amanda Work Place...
Страница 150: ...142 Installing Amanda Work Place...
Страница 156: ...148 Installing Amanda Work Place...
Страница 194: ...186 Installing Amanda Work Place...
Страница 206: ...198Installing Amanda Work Place...