dcl_symbols
Differences
This shows you the differences between two versions of the page.
Next revisionBoth sides next revision | |||
dcl_symbols [2018/10/03 21:33] – initial commit lricker | dcl_symbols [2018/10/03 22:48] – add content lricker | ||
---|---|---|---|
Line 2: | Line 2: | ||
The term "// | The term "// | ||
+ | |||
+ | Shell variables are very useful, in scripts and on the command line itself, and DCL variables are just as useful for the same purposes. | ||
+ | |||
+ | DCL variables can have two **types of values** (datatypes): | ||
+ | |||
+ | * Strings (of characters), | ||
+ | * Integers (whole numbers, no fractions), for arithmetic and counting. | ||
+ | |||
+ | DCL variables have **scope** (visibility): | ||
+ | |||
+ | * Global symbols, created/ | ||
+ | * Local symbols, created/ | ||
+ | |||
+ | A DCL symbol can be used as a **command alias** -- the global variable' | ||
+ | |||
+ | $ ls == " | ||
+ | $ ls com:*.com;0 | ||
+ | | ||
+ | Directory DSA2: | ||
+ | | ||
+ | BELL.COM; | ||
+ | ... | ||
+ | BUILD.COM; | ||
+ | CD.COM; | ||
+ | CLS.COM; | ||
+ | ... | ||
+ | | ||
+ | Total of 37 files, 247 blocks. | ||
+ | |||
+ | A DCL variable can be used as a **counter** -- this example might be found in a command file (script): | ||
+ | |||
+ | $ count = 0 ! create and initialize | ||
+ | $LOOP: | ||
+ | $ IF count .gt. 10 THEN GOTO LOOP_EXIT | ||
+ | $ WRITE sys$output "Loop iteration: ", count | ||
+ | $ count = count + 1 | ||
+ | $ GOTO LOOP | ||
+ | $LOOP_EXIT: | ||
+ | $ EXIT 1 | ||
+ | |||
+ | **Message strings** can be built-up (concatenated) using string variables: | ||
+ | |||
+ | $ Brother == " | ||
+ | $ Sister | ||
+ | $ WRITE sys$output Sister, " & ", Brother, " are siblings." | ||
+ | Jane & John are siblings. | ||
+ | $ DELETE /SYMBOL /GLOBAL Sister | ||
+ | $ DELETE /SYMBOL /GLOBAL Brother | ||
+ | |||
+ | These examples only scratch the surface of what's possible with DCL variables. |
dcl_symbols.txt · Last modified: 2018/12/03 19:28 by lricker