OpenVMS DCL File Access

This sample code was the subject of “DCL File Access”, the February 6, 2011 installment of The OpenVMS Consultant, a column on OpenVMS computing hosted by OpenVMS.org.

Accessing files is a common programming task. Different languages have variations in the syntax and semantics. OpenVMS DCL is no different than any other language in this respect. Familiarity with the details of the mechanics of file management, together with how to effectively use its different features is crucial.

In OpenVMS DCL, file references can take two forms:

The three DCL command files comprising this example may be downloaded from this page. For your convenience, the files have been packaged in a ZIP archive.

 
HP OpenVMS 30th Anniversary Logo
The downloadable ZIP archive contains three example command files:

OPENVMS-DCLFILEACCESS-EXAMPLE1.COM This procedure executes two procedures, using different mechanisms. The main procedure opens a file (which associates the RMS process permanent file with a process logical name), creates a logical name pointing to the logical name created by the DCL OPEN and then invokes two sub-procedures: an internal SUBROUTINE; and an external DCL procedure, OPENVMS-DCLFILEACCESS-EXAMPLE2.COM.
OPENVMS-DCLFILEACCESS-EXAMPLE2.COM This procedure is invoked by OPENVMS-DCL-FILEACCESS-EXAMPLE1.COM It demonstrates that a file opened from DCL may be indirectly accessed by a logical name pointing to the logical name assigned when the file was opened.
OPENVMS-DCLFILEACCESS-EXAMPLE3.COM This procedure executes two procedures, using different mechanisms. The main procedure opens a file (which associates the RMS process permanent file with a process logical name), creates a DCL symbol containing the name of the logical name (as opposed to its contents), and then uses the resulting symbol pass the name to a subroutine, which then writes to the file. Two sub-procedures are invoked: an internal SUBROUTINE; and an external DCL procedure, OPENVMS-DCLFILEACCESS-EXAMPLE3.COM.
OPENVMS-DCLFILEACCESS-EXAMPLE4.COM This procedure is invoked by OPENVMS-DCL-FILEACCESS-EXAMPLE3.COM It demonstrates that a file opened from DCL may be indirectly accessed by a logical name pointing to the logical name assigned when the file was opened.


Download DCL File Access Examples (OpenVMS ZIP Archive)

References

  • Robert Gezelter “DCL Symbols: Starting at the beginning” The OpenVMS Consultant, OpenVMS.org, March 2, 2009, Retrieved from http://www.openvms.org/stories.php?story=09/03/02/8398294 on July 8,#2010.
  • Robert Gezelter “Logical Names: Part 5” The OpenVMS Consultant, OpenVMS.org, March 3, 2003, Retrieved from http://www.openvms.org/stories.php?story=03/03/03/4358185 on July 8,#2010.
  • Robert Gezelter “Logical Names: Part 4” The OpenVMS Consultant, OpenVMS.org, February 6, 2003, Retrieved from http://www.openvms.org/stories.php?story=03/02/06/8131783 on July 8,#2010.
  • Robert Gezelter “Logical Names: Part 3” The OpenVMS Consultant, OpenVMS.org, November 4, 2002, Retrieved from http://www.openvms.org/stories.php?story=02/11/04/2738906 on July 8,#2010.
  • Robert Gezelter “Logical Names: Part 2” The OpenVMS Consultant, OpenVMS.org, October 17, 2002, Retrieved from http://www.openvms.org/stories.php?story=02/10/17/9372652 on July 8,#2010.
  • Robert Gezelter “Logical Names: Part 1” The OpenVMS Consultant, OpenVMS.org, September 24, 2002, Retrieved from http://www.openvms.org/stories.php?story=02/09/24/5441505 on March 11,#2010.
  • Picture of Robert Gezelter, CDP
    Bringing Details into Focus, Focused Innovation, Focused Solutions
    RLGSC Logo
    http://www.rlgsc.com
    +1 (718) 463 1079