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
Last revisionBoth sides next revision
dcl_symbols [2018/10/03 22:48] – add content lrickerdcl_symbols [2018/10/23 19:41] – <code>...</code> tweaks lricker
Line 12: Line 12:
 DCL variables have **scope** (visibility): DCL variables have **scope** (visibility):
  
-  * Global symbols, created/assigned with the **''==''** (or '':=='') operator, are visible at any level, including on the command line (level 0) and within executing command files (scripts, level 1 and higher/deeper). +  * Global symbols, created/assigned with the **''==''** (or **'':==''**) operator, are visible at any level, including on the command line (level 0) and within executing command files (scripts, level 1 and higher/deeper). 
-  * Local symbols, created/assigned with the ''='' (or '':='') operator, usually used and visible only within command files where created (and in nested command files).+  * Local symbols, created/assigned with the **''=''** (or **'':=''**) operator, usually used and visible only within command files where created (and in nested command files).
  
 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