/sys$common/syshlp/helplib.hlb Symbol Assign, Examples *Conan The Librarian (sorry for the slow response - running on an old VAX) |
1. $ LIST == "DIRECTORY" $ TIME == "SHOW TIME" $ QP == "SHOW QUEUE/DEVICE" $ SS == "SHOW SYMBOL" The file SYNONYM.COM contains the assignment statements shown; these are user-defined synonyms for commands. Execute this command procedure as follows: $ @SYNONYM After the command procedure creates the global symbol definitions, you can use these synonyms (LIST, TIME, QP,and SS) at the interactive command level. Note that the assignments are global; otherwise, the symbol names would have been deleted after the file SYNONYM.COM completed execution. 2. $ COUNT = 0 $ LOOP: $ COUNT = COUNT + 1 . . . $ IF COUNT .LT.5 THEN GOTO LOOP The symbol COUNT is initially assigned a numeric value of 0; a loop is established to increment the value of COUNT by 1 each time the loop is entered. Note that when the symbol name COUNT appears on the right-hand side of an arithmetic assignment statement, the command interpreter automatically substitutes its current value. The IF command tests the value of COUNT; if it is less than 5, the procedure branches to the label LOOP and the statements between the label LOOP through the IF command are executed again. When the value of the symbol count reaches 5, the loop is not executed again and the command following the IF command is executed. 3. $ A = 25 $ CODE = 4 + F$INTEGER("6") - A $ SHOW SYMBOL CODE CODE = -15 HEX = FFFFFFF1 Octal = 1777761 This example contains two assignment statements. The first statement assigns the value 25 to the symbol A. The second assignment statement evaluates an expression containing an integer (4), a lexical function (F$INTEGER("6")), and the symbol A. The result of the expression, -15, is assigned to the symbol CODE.
|