SpyderByte.com: OpenVMS.org dba.OpenVMS.org dcl.OpenVMS.org de.OpenVMS.org fr.OpenVMS.org it.OpenVMS.org
   
Home Contribute News, Jobs, Press Releases, etc. Advertise on OpenVMS.org About/Contact Search News Archives
More Links
  • The OpenVMS Consultant: Logical Names (Part 1)
  • OpenVMS Consultant
  • Robert Gezelter, CDP, CSA, CSE, Software Consultant
  • Computer Security Handbook, 5th Edition
  • Ruminations - An IT Blog
  • http://www.rlgsc.com
  • Printer friendly version
    Share this story

    Navigation
    VMS Audio Network (VAN)
    Featured Articles
    Vendors
    Training
    Golden Eggs
    Golden Eggs x86
    Help for VMS Beginners
    Documentation
    Developer Resources
    Books
    Commercial Software
    Open Source & Freeware
    OpenSource ported to VMS
    Resources
    FAQs/How-to
    Lists/Newsgroups/Forums
    Security Advisories & Info
    OpenVMS Patches

    Forums
     HP ITRC OpenVMS forum
     OpenVMS Hobbyist forums
     Usenet: comp.os.vms

    Mailing Lists
    OpenVMS.org Newsletter
    OpenVMS.org Alerts
    Rdb Managers

    Roadmaps
    OpenVMS Roadmap (2009)
    Itanium Roadmap
    HP Roadmaps (2002)
    BCS Roadmap FAQ (2002)
    Storage Roadmap FAQ (2002)


    OpenVMS.org Info
    OpenVMS.org Admin Staff:
    Ken Farmer, Ian Miller
    About
    Search OpenVMS.org
    News Archives
    Mobile Edition
    Submit News
    Advertising Information

    OpenVMS.org Websites

    Databases running on OpenVMS


    Digital Command Languauge


    French



    German


    Italian



    Latest News

    The OpenVMS Consultant: DCL Symbols: Starting at the beginning
    Posted by Bob Gezelter on Monday March 02 2009 @ 05:06AM EST

    Those unfamiliar with OpenVMS DCL symbol substitution often find it a source of confusion. This powerful DCL feature is avoided out of misunderstanding. This is very unfortunate, since symbol substitution dramatically shortens development tasks and reduces the cost of ongoing maintenance.

    The fact that DCL symbol substitution can be used for some of the same purposes as logical names admittedly contributes to some of the confusion.

    However, while logical names and DCL symbols can be used for some similar purposes, they are completely different mechanisms. A previous series of articles in this column discussed the fundamentals of logical names (“The OpenVMS Consultant: Logical Names (Part 1)” is the first article in that series).

    Logical names are used implicitly by RMS and other OpenVMS system services. They can be explicitly defined and accessed from within user-mode programs using system service and run-time library calls, and can be explicitly accessed from within DCL using the F$TRNLNM lexical function. Some logical name tables (e.g., LNM$SYSTEM, LNM$GROUP, and LNM$JOB) are accessible outside the scope of an individual process).

    By contrast, symbols are purely creatures of DCL and are limited by the DCL implementation to certain semantics and uses. They are restricted to the context of a single process, although by default, both local and global symbols are copied to sub-processes created using the SPAWN command or LIB$SPAWN run-time library routine.

    As a simple example, consider the common DCL command:
            $ directory/size/date *.lis

    This command will produce a listing of all files in the current directory with the file type of *.lis together with the size and creation date of each file. The command is not complex, but it requires typing 25 characters. Even using the OpenVMS DCL feature of allowing for only enough of verbs and qualifiers to resolve ambiguity, 17 characters must be typed.

    This example is only a simple case. It is not uncommon to have commands that require more than 80 characters (a common problem across all platforms; many utility functions have many different parameters).

    The simple OpenVMS solution to this is to use DCL symbols to define command shortcuts. This eliminates the need to type the entire command each time:
            $ dsd :== directory/size/date

    Once this symbol is defined in our process, DCL will automatically substitute the full value when that symbol appears as the first item in a DCL statement. So there is far less typing involved, to wit:
            $ dsd *.lis

    For the simple case of a command, with extremely simple parameters, this works quite well. When there is a more complex need, with more extensive processing, there is often a need to use DCL symbols in a more advanced fashion to build and dissect strings needed by the computation.

    Command shortcuts are merely the simplest use of a feature with far more capabilities. Using the more advanced capabilities requires the use of a DCL command file.

    So, let us start by building a small command file to take a file type, without the accompanying punctuation, and list all files of that type in the current directory.
            $! DCL Program to List Directory Contents
            $! Author:  Robert Gezelter , 1-March-2009
            $ FILETYPE = P1
            $ DIRECTORY/SIZE/DATE *.'FILETYPE'
            $ EXIT $STATUS

    Admittedly, this five line example is simplistic. However, it is sufficient to have the same structure as far larger DCL command procedures, even those consisting of hundreds or thousands of lines of code.

    The comment lines identifying the file, its author, and its date of origin are the first common feature. Often, these comments (lines beginning with $!) include information about the purpose, background and history of the command procedure.

    The remaining three statements each fall into a different category: setup, work, and returning status.

    The setup in this procedure is straightforward. It begins by making use of the DCL feature that parses the input line into separate sub-strings separated by whitespace (e.g., space, tab) and separates it into a defined set of DCL local symbols, numbered P1 through P8. As convenient as it is for DCL to place the parameters in P1 through P8, these parameters are not particularly mnemonic. [do they survive sub procedures]

    A common first step is to convert the DCL-supplied parameters into local symbols that accurately reflect their contents. The line $ FILETYPE = P1 accomplishes this function in our sample.

    The actual processing is done by the second command, the $ DIRECTORY/SIZE/DATE *.'FILETYPE' command. Here, a DCL symbolic substitution is marked by a symbol name wrapped with ASCII single quote (“'”) characters.

    The last step is to return the result of the command procedure to whatever invoked it. Often, this is the user themselves at the command prompt, but it could just as easily be an outer command procedure. Just as conventional programs are often separated into different routines; it is common to have both internal and external DCL command procedures.

    The preceding is admittedly one of the more simple uses of symbols. Future columns will review more advanced uses of DCL symbols.

    Reader questions about using DCL, or other questions relating to OpenVMS should be addressed to the OpenVMSConsultant (at) OpenVMS.org. While I cannot promise to answer all messages, I will try to respond as time allows. The OpenVMS Consultant welcomes questions from readers about OpenVMS and related technologies. Please submit your questions to the OpenVMS Consultant.


    Biography:

    Robert Gezelter, CDP, CSA, CSE, Software Consultant, has more than 30 years of international consulting experience in both the private and public sectors. He is a regular guest speaker at technical conferences worldwide including the HP Technology Forum. In 2004, the IEEE Computer Society appointed Mr. Gezelter to its Distinguished Visitors Program, which provides meeting speakers for IEEE chapters throughout North America. He is also a published numerous technical papers and book chapters, including two chapters in the recently released Computer Security Handbook, 5th Edition,

    Recently, he started Ruminations - An IT Blog on IT topics not strictly related to OpenVMS.

    His firm's practice emphasizes in-depth technical expertise in computer architectures, operating systems, networks, security, APIs, and related matters. Mr. Gezelter has worked with OpenVMS since the initial release of VAX/VMS in 1977.

    His clients include small businesses to the Fortune 10, locally, nationally, and internationally on matters spanning the range from individual telephone questions to major projects.

    He can be reached via his firm's web site at http://www.rlgsc.com.



    < Connect with OpenVMS on Blades | 0MQ on OpenVMS >



    ADVERTISEMENT:
    Sponsors







    The OpenVMS Consultant
    OpenVMS Consulting


    The Minimum You Need to Know book series
    Books by Roland Hughes


    Alpha and VAX Replacement
    StanQ.com



    Interested in Advertising? Click here...

    Friends of VMS
    Connect (HP User Community):
    Connect Home
    Connect Chapters
    Connect Special Interest Groups

    United Kingdom
    Canada
    Encompasserve/DECUServe
    OpenVMS Hobbyist
    More usergroups...
    Other Sites:
    Aaron's OpenVMS blog
    Alexey Chupahin
    Arne Vajhoej
    DECUS Library Compendium
    DJE Systems
    Dr OpenVMS blog
    Francesco Gennai
    Eight-Cubed blog
    Free OpenVMS Software
    Galen Tackett
    HoffmanLabs
    Hunter Goatley
    Ian Miller
    Itanium Solutions Alliance
    Jeff Cameron
    John Fisher
    Syltrem VMS Page (French)
    Kednos PL/I
    Keith Parris
    Migration Specialties
    Noetic Systems, Inc
    OpenOffice Port to VMS
    OpenVMSPlanet.org
    OpenVMS Rocks
    Preatorian.net
    Retrobeep
    Steven M. Schweda
    SYSMGR Blog
    TMESIS Software
    Trends That Matter
    VAMP (VMS, Apache, MySQL, PHP)
    VIM
    Vaxination
    Visio Cafe (HP Templates)
    VMSresource.org.uk
    XDelta
    Free VMS Accounts:
    Deathrow Public OpenVMS Cluster
    Encompasserve/DECUServe/EISNER
    Polarhome
    Fafner
    Poetry Hacklab
    Marway.Org
    In Memory:
    John Wisniewski Memorial Site
    Terry Shannon Memorial Site


    OpenVMS Rings

    OpenVMS Webring

    Prev

    Random

    Next

    Prev5

    List

    Next5

    OpenVMS Gurus

    Prev

    Random

    Next

    Prev5

    List

    Next5




    Home About & Contact Search Archive Mobile Submit News Sponsorship & Advertising
         Copyright © 2001-2007 SCORSE, LLC
    OpenVMS® is a trademark of HP
    All other trademarks are those of their owners.
        
      SpyderByte.com ;Technical Portals