Prev Up Next
Go backward to 4.13 VAX Variables #1
Go up to 4 Labs
Go forward to 4.15 Editor - vi

4.14 VAX Variables -- #2

The use of command procedures saves time and simplifies completing a task. With the use of variables, this can be taken one step further. Variables can be defined that are remembered. This lab uses a variable to remember the name of the file that you last edited.
  1. Create the following file with the editor and call it EDITPICO.COM. Be careful with the spacing and single (') and double (") quotes. Also note that the underscore character (_) used in the symbol names prints below the line and is not the same as a hyphen (-). Use the filename EDITPICO.COM.
    $! COMMAND FILE TO REMEMBER EDIT FILE FOR NEXT TIME 
    $! CSC135  Your name 
    $
    $ IF (P1 .EQS. "") THEN P1 := 'CURRENT_FILE' 
    $ IF (P1 .NES. "") THEN GOTO EDITPICO 
    $
    $ASK_FILE:
    $ INQUIRE P1 "$_File"
    $ IF (P1 .EQS. "") THEN GOTO ASK_FILE 
    $
    $EDITPICO: 
    $ CURRENT_FILE :== 'P1'
    $
    $ WRITE SYS$OUTPUT "Editing ''CURRENT_FILE'" 
    $ ASSIGN /USERMODE SYS$COMMAND SYS$INPUT 
    $ PICO 'CURRENT_FILE' 
    $ EXIT 1
    
    Test out the command procedure EDITPICO.COM you created in this step. Set verify on so you can see what commands are executing and try the following. If any of the following examples do not seem to work correctly, or give you error messages, check your file with the lab handout and correct as necessary.
  2. Define a symbol that you can use as a command by typing the line
    
    EDITPICO :== "@EDITPICO.COM" 
    
  3. Type EDITPICO<cr>. Since this is the first time, it should ask you for a file name. Use any name you like. You should end up in PICO.
    ***** CHECK THE FILE NAME ****
    Quit (PF4, quit)from the file without saving changes.

    Note: If you get an error on this step, you must type

     
    $ DELETE /SYMBOL /GLOBAL CURRENT_FILE
    
    to clear the remembered file name before repeating.
  4. At DCL ($) level, type EDITPICO<cr> again. It should edit the same file as before. Check the file name again and quit to return to DCL without saving the file.
  5. This time give a name on the same line as the command, using a different name such as
    $ EDITPICO new.fil 
    
    Check that you are editing the new file and quit as before.
  6. $ SET VERIFY and repeat the last two steps.
  7. If you like this command, you can have it automatically defined each time you log in by adding the line in part to your LOGIN.COM with a "$" first in the line. Place the line just before the $ EXIT line.
Turn in a copy of EDITPICO.COM and mark it:
Your-Name
Lab 4.14: VAX Variables #2 - EDITPICO.COM
TABER CSC135
Place the lab in the instructor hand-in box in BUS R6E, the "terminal room".
Instructor: ltaber@pima.edu** My new Home on phRed** The Pima College Site** The Mad Dr. G.'s home page on phred.

Prev Up Next