home *** CD-ROM | disk | FTP | other *** search
- .pg clr c 5 0
- VARIABLES»#«
-
- »%t«DO»#« supports two types of variables: »pa 1 ye«
-
- /BIG TEXT 4
- »pa 1 cy«
- /BIG NUMBER 4
- »pa 1 #«
- The number of variables that you can have is limited only
- by available memory. In fields that allow variable substitution,
- all variables' and functions' values will be substituted.
- .pg clr
- A variable name can use any of the letters »cy«A-Z»#« or numbers
- »cy«0-9»#«. Variable names can be up to »re«32 characters»#« long.
- UPPER/Lower case is »re«NOT»#« significant. For example:
-
- Variable1 : »ye«valid»#«
- Fred : »ye«valid»#«
- A : »ye«valid»#«
- ThisVariable : »ye«valid»#«
- 23 : »ye«valid»#«
- That Variable : »re«not valid»#«, contains a space
- Variable-A : »re«not valid»#«, contains a dash ("-")
-
- .pg
- Substitution variables are constructed with a leading
- percent sign ("»ye«%»#«"). The two variable types are described
- in more detail below.
- .go 1 5
- »+ye«%»#«
- .pa 1
- »+ye«%»#«
- .pa 1
- »+ye«%»#«
- .pa 1
- »+ye«%»#«
- .pa 1
- »+ye«%»#«
- .pg -24 clr ye
- Text Variables»gray«:»#«
-
- Text variables can contain any »gr«printable characters»#« or
- »gr«numbers»#«. They are initialized by the »bo«/SET»#« command.
-
- Examples of valid text variable values are:»wh«
-
- This is a valid value.
- A
- 2.25
- The answer is 25
- .pg clr gr
- Numbers»gray«:»#«
-
- Number variables are »ma«REAL NUMBERS»#« which can contain a
- decimal part. Number variables contain the results of
- »bo«/MATH»#« command executions.
-
- 2.5 »ye«Valid»#«
- 3 »ye«Valid»#«
- -2.5 »ye«Valid»#«
- 0.33451 »ye«Valid»#«
- 65,000 »ye«Valid»#«
- 3*2 »ye«Valid (»cy«evaluated and stored as 6»ye«)»#«
- 2AF6 »re«Not valid (»cy«contains letters»re«)»#«
- .pg clr re
-
- Variable Substitution in Strings and Tokens»#«
-
- Variables are substituted for in »gr«strings»#« and »gr«tokens»#«.
- This includes lines that are written to the screen
- and to files. Besides simple substitution, variables
- can be formatted.
-
- If a variable is not found, it will return NULL ("").
-
- :TEXT
- .pg clr ye
- Text Variable Formatting»gray«:»#«
-
- Text variables are entered into a string using the
- following general format:
-
- »cy«%{variable name}[({format option}{length})]»#«
-
- The »cy«{format option}»#« can be:
-
- »ma«L »gray«=»#« Left justify and pad with spaces.
- »ma«R»gray« =»#« Right justify and pad with spaces.
- »ma«C»gray« =»#« Center and pad with spaces.
- .pg clr
- With variable »ye«VAR1»#« set to »cy«Fred»#«, here's a look at formatting. We'll
- show you each display line before the result. When you've
- examined the line, press »bo«<enter>»#« to execute it. First, we'll
- »%t«/SET»#« the variable to "»wh«Fred»#«".
- |/SET VAR1 Fred
-
- This line »ye«Left-justifies»#« the field and pads with spaces:»cy«
- | Your Name [%VAR1(L10)]
-
- »#« This line »ye«right-justifies»#« the field and pads with spaces:»cy«
- | Your Name [%VAR1(R10)]
-
- This line »ye«centers»#« the field and pads with spaces:»cy«
- | Your Name [%VAR1(C10)]
- :NUMBERS
- .pg clr c 12 0
- Numeric Variable Formatting»gray«:»#«
-
- Numeric Variables are entered in the following general
- format:
-
- »ye«%{variable name}[({format})]»#«
-
- if »cy«{format}»#« is not included, the number is displayed with
- the least number of digits possible. That is trailing zeros
- to the right of the decimal point are removed. If there are no
- decimal places, the decimal point, if entered, is removed.
- »reset«
- Here are some examples. Press »bo«<enter>»#« to execute the line:
-
- |/MATH N1 12345678.999000
- N1 = %N1
- |/MATH N1 3.0000000
- N1 = %N1
- |/MATH N1 -(4*3+2)
- N1 = %N1
- |/MATH N1 -3000.22501
- N1 = %N1
-
- .pg clr
- The following symbols can be used in »ye«{format}»#«:
-
- »c 12 0«#»cy« A numeric position.»#« If the field is shorter than the
- {format}, the unused positions will be filled with
- blanks if no ("@", "$", "#") characters appear in the
- format.
-
- »pg c 12 0«@»cy« A numeric position.»#« Causes leading zeros to be
- substituted in place of spaces. Only a single "@" needs
- to be entered for this effect.
-
- »pg c 12 0«$»cy« A floating dollar sign.»#« When this symbol appears, a
- floating dollar sign will be displayed. The field will
- be padded with spaces before the $ unless a special
- character other than "#" appears in the field.
-
- »pg c 12 0«,»cy« Comma or decimal separator.»#«
- »c 12 0«.»cy« Decimal point separator.»#« The last "." or "," is treated
- as the decimal point separator.
-
- »pg c 12 0«+»cy« A sign position.»#« If the number is negative, a "-" will
- be printed at the indicated position. If it is
- positive, a "+" is printed at the location.
- »c 12 0«-»cy« A sign position.»#« If the number is negative, a "-" is
- printed at the indication position. If positive a space
- is printed.
-
- All other symbols in the format are printed as indicated.
- /MATH Num1 1234.56
- /MATH Num2 -1234.56
- .pg clr
-
- Here are some examples. With a Result variable set to
- »ye«1234.56»#« using the »%t«/MATH»#« command the formats give the
- indicated results:
-
- (»wh«####.##»#«) »gr«=»wh« %Num1(####.##)
- (»wh«#,###.##»#«) »gr«=»wh« %Num1(#,###.##)
- (»wh«#####+»#«) »gr«=»wh« %Num1(#####+)
- (»wh«@#,###.»#«) »gr«=»wh« %Num1(@#,###.)
- (»wh«$#,###,###.##»#«) »gr«=»wh« %Num1($#,###,###.##)
- (»wh«###»#«) »gr«=»wh« %Num1(###)»#«
-
- With the Result variable set to »re«-»ye«1234.56»#«:
-
- (»wh«-$###,###.##»#«) »gr«=»wh« %Num2(-$###,###.##)
- (»wh«####.##»#«) »gr«=»wh« %Num2(####.##)
- (»wh«-#,###,###.##»#«) »gr«=»wh« %Num2(-#,###,###.##)
- (»wh«@@@,@@@.@@-»#«) »gr«=»wh« %Num2(@@@,@@@.@@-)»#«
- /ENDEXEC