CONTACT US Phone: (412) 835-9417 Email: sales@vss3.com |
Tip #6 Dummy Variables
In my work with filePro, I see a lot of code written by other consultants and end-users. Some older code and techniques with dummy variables could use a new coat of paint. Here are the current rules:
Maximum number of characters in a dummy variable:
32,768 characters (Page 13-143 filePro 3.0 Manual)
Defining a dummy variable
All memory for dummy variables is allocated when the table is loaded, so the location of the definition in the table is not important. If it defined more than once, only the last definition is used. (Don't do this as a rule.) Also if it defined as global in the automatic table, it will be defined for every table that is used with the automatic table, i.e. scan/select, input, output, calls and chains.
aa(10) -------- it is not necessary to specify the "*" edit. aa(10,*) is assumed.
aa(10,,g) ------ two commas and add the "g" for global variables. Again the * is assumed.
If: | |
Then: |
aa(10);ab(12,.0);ac(8,mdy/) |
Just a listing with no assignment of value is enough to establish the dummy field definitions.
Arrays
Use an array to quickly define a list of variables and use the array to clear the variables.
Then: |
dim list(10,mdy/):aa |
Now you have aa, ab, ac, ad, ae, af, ag, ah, ai, aj, available and defined. To clear the values just issue the command:
Then: |
clear list |
This type of variable will not be displayed on the cross-reference table unless an assignment is made to it in the processing. On a short array, I might use this command line to clear the array just to be sure it is listed on the cross-reference list.
Then: |
aa="";ab="";ac="";ad="";ae="";af="";ag="";ah="";ai="";aj="" |
Not too much longer.
Undefined variables
A dummy variable that is not defined, will use a new memory location each time an assignment is made to that variable.
Use this type of variable over and over to test if a field is changed during input. Without a definition it will hold any type of data.
@wef10 If: |
|
Then: | oo=10;end |
@wlf10 If: | 10 eq oo |
Then: | show"Value of field 10 has not changed";end |
If: | |
Then: | show" at this point do what ever needs to be done if 10 changes.";end |
Be careful to only leave variables undefined by intention not accident.
Written by Nancy Palmquist
Copyright, 1997 by Virtual Software Systems. All rights reserved.