home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / ibm1 / do101j2.arj / VARIABLE.SCR < prev    next >
Text File  |  1991-12-13  |  6KB  |  182 lines

  1. .pg clr c 5 0
  2.     VARIABLES»#«
  3.  
  4.     »%t«DO»#« supports two types of variables: »pa 1 ye«
  5.  
  6. /BIG TEXT 4
  7. »pa 1 cy«
  8. /BIG NUMBER 4
  9. »pa 1 #«
  10.     The number of variables that you can have is limited only
  11.     by available memory. In fields that allow variable substitution,
  12.     all variables' and functions' values will be substituted.
  13. .pg clr
  14.     A variable name can use any of the letters »cy«A-Z»#« or numbers
  15.     »cy«0-9»#«. Variable names can be up to »re«32 characters»#« long.
  16.     UPPER/Lower case is »re«NOT»#« significant. For example:
  17.  
  18.             Variable1      : »ye«valid»#«
  19.             Fred           : »ye«valid»#«
  20.             A              : »ye«valid»#«
  21.             ThisVariable   : »ye«valid»#«
  22.             23             : »ye«valid»#«
  23.             That Variable  : »re«not valid»#«, contains a space
  24.             Variable-A     : »re«not valid»#«, contains a dash ("-")
  25.  
  26. .pg
  27.     Substitution variables are constructed with a leading
  28.     percent sign ("»ye«%»#«"). The two variable types are described
  29.     in more detail below.
  30. .go 1 5
  31.            »+ye«%»#«
  32. .pa 1
  33.            »+ye«%»#«
  34. .pa 1
  35.            »+ye«%»#«
  36. .pa 1
  37.            »+ye«%»#«
  38. .pa 1
  39.            »+ye«%»#«
  40. .pg -24 clr ye
  41.     Text Variables»gray«:»#«
  42.  
  43.     Text variables can contain any »gr«printable characters»#« or
  44.     »gr«numbers»#«. They are initialized by the »bo«/SET»#« command.
  45.  
  46.      Examples of valid text variable values are:»wh«
  47.  
  48.           This is a valid value.
  49.           A
  50.           2.25
  51.           The answer is    25
  52. .pg clr gr
  53.     Numbers»gray«:»#«
  54.  
  55.     Number variables are »ma«REAL NUMBERS»#« which can contain a
  56.     decimal part. Number variables contain the results of
  57.     »bo«/MATH»#« command executions.
  58.  
  59.           2.5       »ye«Valid»#«
  60.           3         »ye«Valid»#«
  61.           -2.5      »ye«Valid»#«
  62.           0.33451   »ye«Valid»#«
  63.           65,000    »ye«Valid»#«
  64.           3*2       »ye«Valid (»cy«evaluated and stored as 6»ye«)»#«
  65.           2AF6      »re«Not valid (»cy«contains letters»re«)»#«
  66. .pg clr re
  67.  
  68.     Variable Substitution in Strings and Tokens»#«
  69.  
  70.     Variables are substituted for in »gr«strings»#« and »gr«tokens»#«.
  71.     This includes lines that are written to the screen
  72.     and to files. Besides simple substitution, variables
  73.     can be formatted.
  74.  
  75.     If a variable is not found, it will return NULL ("").
  76.  
  77. :TEXT
  78. .pg clr ye
  79.     Text Variable Formatting»gray«:»#«
  80.  
  81.     Text variables are entered into a string using the
  82.     following general format:
  83.  
  84.     »cy«%{variable name}[({format option}{length})]»#«
  85.  
  86.     The »cy«{format option}»#« can be:
  87.  
  88.         »ma«L »gray«=»#« Left justify and pad with spaces.
  89.         »ma«R»gray« =»#« Right justify and pad with spaces.
  90.         »ma«C»gray« =»#« Center and pad with spaces.
  91. .pg clr
  92.     With variable »ye«VAR1»#« set to »cy«Fred»#«, here's a look at formatting. We'll
  93.     show you each display line before the result.  When you've
  94.     examined the line, press »bo«<enter>»#« to execute it.  First, we'll
  95.     »%t«/SET»#« the variable to "»wh«Fred»#«".
  96. |/SET VAR1 Fred
  97.  
  98.     This line »ye«Left-justifies»#« the field and pads with spaces:»cy«
  99. |          Your Name [%VAR1(L10)]
  100.  
  101. »#«    This line »ye«right-justifies»#« the field and pads with spaces:»cy«
  102. |          Your Name [%VAR1(R10)]
  103.  
  104.     This line »ye«centers»#« the field and pads with spaces:»cy«
  105. |          Your Name [%VAR1(C10)]
  106. :NUMBERS
  107. .pg clr c 12 0
  108.     Numeric Variable Formatting»gray«:»#«
  109.  
  110.     Numeric Variables are entered in the following general
  111.     format:
  112.  
  113.          »ye«%{variable name}[({format})]»#«
  114.  
  115.     if »cy«{format}»#« is not included, the number is displayed with
  116.     the least number of digits possible.  That is trailing zeros
  117.     to the right of the decimal point are removed.  If there are no
  118.     decimal places, the decimal point, if entered, is removed.
  119. »reset«
  120.     Here are some examples.  Press »bo«<enter>»#« to execute the line:
  121.  
  122. |/MATH N1 12345678.999000
  123.     N1 = %N1
  124. |/MATH N1 3.0000000
  125.     N1 = %N1
  126. |/MATH N1 -(4*3+2)
  127.     N1 = %N1
  128. |/MATH N1 -3000.22501
  129.     N1 = %N1
  130.  
  131. .pg clr
  132.     The following symbols can be used in »ye«{format}»#«:
  133.  
  134.     »c 12 0«#»cy«    A numeric position.»#« If the field is shorter than the
  135.          {format}, the unused positions will be filled with
  136.          blanks if no ("@", "$", "#") characters appear in the
  137.          format.
  138.  
  139.     »pg c 12 0«@»cy«    A numeric position.»#« Causes leading zeros to be
  140.          substituted in place of spaces. Only a single "@" needs
  141.          to be entered for this effect.
  142.  
  143.     »pg c 12 0«$»cy«    A floating dollar sign.»#« When this symbol appears, a
  144.          floating dollar sign will be displayed. The field will
  145.          be padded with spaces before the $ unless a special
  146.          character other than "#" appears in the field.
  147.  
  148.     »pg c 12 0«,»cy«    Comma or decimal separator.»#«
  149.     »c 12 0«.»cy«    Decimal point separator.»#« The last "." or "," is treated
  150.          as the decimal point separator.
  151.  
  152.     »pg c 12 0«+»cy«    A sign position.»#« If the number is negative, a "-" will
  153.          be printed at the indicated position. If it is
  154.          positive, a "+" is printed at the location.
  155.     »c 12 0«-»cy«    A sign position.»#« If the number is negative, a "-" is
  156.          printed at the indication position. If positive a space
  157.          is printed.
  158.  
  159.    All other symbols in the format are printed as indicated.
  160. /MATH Num1 1234.56
  161. /MATH Num2 -1234.56
  162. .pg clr
  163.  
  164.     Here are some examples. With a Result variable set to
  165.     »ye«1234.56»#« using the »%t«/MATH»#« command the formats give the
  166.     indicated results:
  167.  
  168.     (»wh«####.##»#«)       »gr«=»wh« %Num1(####.##)
  169.     (»wh«#,###.##»#«)      »gr«=»wh« %Num1(#,###.##)
  170.     (»wh«#####+»#«)        »gr«=»wh« %Num1(#####+)
  171.     (»wh«@#,###.»#«)       »gr«=»wh« %Num1(@#,###.)
  172.     (»wh«$#,###,###.##»#«) »gr«=»wh« %Num1($#,###,###.##)
  173.     (»wh«###»#«)           »gr«=»wh« %Num1(###)»#«
  174.  
  175.     With the Result variable set to »re«-»ye«1234.56»#«:
  176.  
  177.     (»wh«-$###,###.##»#«)  »gr«=»wh« %Num2(-$###,###.##)
  178.     (»wh«####.##»#«)       »gr«=»wh« %Num2(####.##)
  179.     (»wh«-#,###,###.##»#«) »gr«=»wh« %Num2(-#,###,###.##)
  180.     (»wh«@@@,@@@.@@-»#«)   »gr«=»wh« %Num2(@@@,@@@.@@-)»#«
  181. /ENDEXEC
  182.