User Tools

Site Tools


dcl_symbols

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dcl_symbols [2018/10/03 22:49] – tweaks lrickerdcl_symbols [2018/12/03 19:28] (current) lricker
Line 1: Line 1:
 ===== DCL Symbols ===== ===== DCL Symbols =====
  
-The term "//symbol//" is nothing more than an old-fashioned name for "//variable//" -- a DCL symbol is simply a DCL variable, just as Linux/Unix shells like bash have shell variables.+The term "//symbol//" is nothing more than an old-fashioned name for "//variable//" -- a DCL symbol is simply a DCL variable, just as Linux/Unix shells like bash have shell variables. The term "DCL //symbol//" likely just comes from terminology used by the DCL software developers in the 1970s, probably related to their use of the terms "global and local //symbol// tables;" the term "symbol" has no more magic in it than that.
  
 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 are used for arithmetic and string computations/calculations, and as command aliases (short &/or memorable names for more complicated command verbs). 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 are used for arithmetic and string computations/calculations, and as command aliases (short &/or memorable names for more complicated command verbs).
Line 17: Line 17:
 A DCL symbol can be used as a **command alias** -- the global variable's value is a string of characters, the first element or "word" of which is an executable DCL command; for example: A DCL symbol can be used as a **command alias** -- the global variable's value is a string of characters, the first element or "word" of which is an executable DCL command; for example:
  
-  $ ls == "DIRECTORY /SIZE /DATE /PROTECTION" +<code> 
-  $ ls com:*.com;+$ ls == "DIRECTORY /SIZE /DATE /PROTECTION" 
-   +$ ls com:*.com;
-  Directory DSA2:[JSMITH.COM] + 
-   +Directory DSA2:[JSMITH.COM] 
-  BELL.COM;                         20-SEP-2017 09:41:19.35  (RWED,RWED,,+ 
-  ... +BELL.COM;                         20-SEP-2017 09:41:19.35  (RWED,RWED,,
-  BUILD.COM;                       1  26-JUL-1997 17:48:20.58  (RWED,RWED,RE,+... 
-  CD.COM;                            9-FEB-2016 08:51:05.90  (RWED,RWED,,+BUILD.COM;                       1  26-JUL-1997 17:48:20.58  (RWED,RWED,RE,
-  CLS.COM;10                          11-FEB-2016 10:41:25.45  (RWED,RWED,,+CD.COM;                            9-FEB-2016 08:51:05.90  (RWED,RWED,,
-  ... +CLS.COM;10                          11-FEB-2016 10:41:25.45  (RWED,RWED,,
-   +... 
-  Total of 37 files, 247 blocks.+ 
 +Total of 37 files, 247 blocks. 
 +</code>
  
 A DCL variable can be used as a **counter** -- this example might be found in a command file (script): A DCL variable can be used as a **counter** -- this example might be found in a command file (script):
  
-  $ count = 0   ! create and initialize +<code> 
-  $LOOP: +$ count = 0   ! create and initialize 
-  $ IF count .gt. 10 THEN GOTO LOOP_EXIT +$LOOP: 
-  $ WRITE sys$output "Loop iteration: ", count +$ IF count .gt. 10 THEN GOTO LOOP_EXIT 
-  $ count = count + 1 +$ WRITE sys$output "Loop iteration: ", count 
-  $ GOTO LOOP +$ count = count + 1 
-  $LOOP_EXIT: +$ GOTO LOOP 
-  $ EXIT 1+$LOOP_EXIT: 
 +$ EXIT 1 
 +</code>
  
 **Message strings** can be built-up (concatenated) using string variables: **Message strings** can be built-up (concatenated) using string variables:
  
-  $ Brother == "John" +<code> 
-  $ Sister  == "Jane" +$ Brother == "John" 
-  $ WRITE sys$output Sister, " & ", Brother, " are siblings." +$ Sister  == "Jane" 
-  Jane & John are siblings. +$ WRITE sys$output Sister, " & ", Brother, " are siblings." 
-  $ DELETE /SYMBOL /GLOBAL Sister +Jane & John are siblings. 
-  $ DELETE /SYMBOL /GLOBAL Brother+$ DELETE /SYMBOL /GLOBAL Sister 
 +$ DELETE /SYMBOL /GLOBAL Brother 
 +</code>
  
 These examples only scratch the surface of what's possible with DCL variables.  The best places to learn more are to read existing command files, including your system's own SYS$SYLOGIN script, your own LOGIN.COM file, and various application or utility scripts that may be available. These examples only scratch the surface of what's possible with DCL variables.  The best places to learn more are to read existing command files, including your system's own SYS$SYLOGIN script, your own LOGIN.COM file, and various application or utility scripts that may be available.
dcl_symbols.txt · Last modified: 2018/12/03 19:28 by lricker

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki