Copyright Digital Equipment Corp. All rights reserved.

Examples

   1.$ LIST == "DIRECTORY"

     The assignment statement in this example assigns the user-
     defined synonym LIST as a global symbol definition for the DCL
     command DIRECTORY.

   2.$ COUNT = 0
     $ LOOP:
     $      COUNT = COUNT + 1
     $      IF P'COUNT' .EQS. "" THEN EXIT
     $      APPEND/NEW &P'COUNT' SAVE.ALL
     $      DELETE &P'COUNT';*
     $      IF COUNT .LT. 8 THEN GOTO LOOP
     $ EXIT

     This command procedure, COPYDEL.COM, appends files (specified
     as parameters) to a file called SAVE.ALL. After a file has been
     appended, the command procedure deletes the file. Up to eight
     file names can be passed to the command procedure. The file
     names are assigned to the symbols P1, P2, and so on.

     The command procedure uses a counter to refer to parameters
     that are passed to it. Each time through the loop, the
     procedure uses an IF command to check whether the value of
     the current parameter is a null string. When the IF command is
     scanned, the current value of the symbol COUNT is concatenated
     with the letter P. The first time through the loop, the IF
     command tests P1; the second time through the loop it tests
     P2, and so on. After the expression P`COUNT' is evaluated, the
     substitution of the file names that correspond to P1, P2, and
     so on is automatic within the context of the IF command.

     The APPEND and DELETE commands do not perform any substitution
     automatically, because they expect and require file
     specifications as input parameters. The ampersand (&) precedes
     the P`COUNT' expression for these commands to force the
     appropriate symbol substitution. When these commands are
     initially scanned each time through the loop, COUNT is
     substituted with its current value. Then, when the commands
     execute, the ampersand causes another substitution: the first
     file specification is substituted for P1, the second file
     specification is substituted for P2, and so on.

     To invoke this procedure, use the following command:

       $ @COPYDEL ALAMO.TXT BEST.DOC

     The files ALAMO.TXT and BEST.DOC are each appended to the file
     SAVE.ALL and are then deleted.

   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
     assignment 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.

   4.$ FILENAME = "JOBSEARCH" - "JOB"
     $ FILETYPE = ".OBJ"
     $ FILESPEC = FILENAME + FILETYPE
     $ TYPE 'FILESPEC'

     The first command in this example assigns the symbol FILENAME
     the value "SEARCH". Notice that the string "SEARCH" is the
     result of the string reduction operation performed by the
     expression. The second command assigns the symbol FILETYPE
     the character string ".OBJ".

     The symbols FILENAME and FILETYPE are then added together in an
     expression assigned to the symbol FILESPEC. Because the values
     of the symbols FILENAME and FILETYPE are concatenated, the
     resultant value assigned to FILESPEC is the character string
     "SEARCH.OBJ". The symbol FILESPEC is then used as a parameter
     for the TYPE command. The single quotation marks (` ')  request
     the command interpreter to replace the symbol FILESPEC with its
     value SEARCH.OBJ. Thus, the TYPE command types the file named
     SEARCH.OBJ.

   5.$ BELL[0,32] = %X07
     $ SHOW SYMBOL BELL
       BELL = ""

     In this example, the symbol BELL is created with an arithmetic
     overlay assignment statement. Because the symbol BELL is
     previously undefined, the hexadecimal value 7 is inserted
     over a null character string and is interpreted as the ASCII
     code for the bell character on a terminal. When you issue the
     command SHOW SYMBOL BELL, the terminal beeps.

     If the symbol BELL had been previously defined with an integer
     value, the result of displaying BELL would have been to show
     its new integer value.

   6.$ $=34
     %DCL-W-NOCOMD, no command on line - reenter with alphabetic first
     character
     $ $$=34
     $ SHOW SYMBOL $$
     %DCL-W-UNDSYM, undefined symbol - check validity and spelling
     $ SHOW SYMBOL $
     $ = 34   Hex = 00000022  Octal = 00000000042

     If you begin a symbol name with the dollar sign ($),  use two
     dollar signs ($$)  because DCL discards the first instance of
     the dollar sign.

   7.$ COUNT = 0
     $ LOOP:
     $      COUNT = COUNT + 1
     $      IF P'COUNT' .EQS. "" THEN EXIT
     $      APPEND/NEW &P'COUNT' SAVE.ALL
     $      DELETE &P'COUNT';*
     $      IF COUNT .LT. 16 THEN GOTO LOOP
     $ EXIT

     This command procedure, COPYDEL.COM, appends files (specified
     as parameters) to a file called SAVE.ALL. After a file has been
     appended, the command procedure deletes the file. Up to sixteen
     file names can be passed to the command procedure. The file
     names are assigned to the symbols P1, P2, and so on. This is
     applicable only when you set bit 3 of DCL_CTLFLAGS to 1.

     The command procedure uses a counter to refer to parameters
     that are passed to it. Each time through the loop, the
     procedure uses an IF command to check whether the value of
     the current parameter is a null string. When the IF command is
     scanned, the current value of the symbol COUNT is concatenated
     with the letter P. The first time through the loop, the IF
     command tests P1; the second time through the loop it tests
     P2, and so on. After the expression PCOUNT is evaluated, the
     substitution of the file names that correspond to P1, P2, and
     so on is automatic within the context of the IF command.

     The APPEND and DELETE commands do not perform any substitution
     automatically, because they expect and require file
     specifications as input parameters. The ampersand (&) precedes
     the P`COUNT' expression for these commands to force the
     appropriate symbol substitution. When these commands are
     initially scanned each time through the loop, COUNT is
     substituted with its current value. Then, when the commands
     execute, the ampersand causes another substitution: the first
     file specification is substituted for P1, the second file
     specification is substituted for P2, and so on.

     To invoke this procedure, use the following command:

       $ @COPYDEL ALAMO.TXT BEST.DOC

     The files ALAMO.TXT and BEST.DOC are each appended to the file
     SAVE.ALL and are then deleted.