OSF DCE Administration Guide--Core Components

Using the DCE Control Program Command Language
You could also modify DCE files that aren’t manipulated easily by using the dcecp
hostdata object. For example, you could write a function that added a new attribute
to the cds_attributes file.
DCE as provided by OSF currently supports file operations only for UNIX systems or for
systems that support POSIX system calls. However, some vendor DCE versions may
support file operations on other systems.
2.15.1 Specifying Filenames
Specify filenames using customary UNIX rules. For instance,
/opt/dcelocal/dcecp/server_snap.dcecp refers to a file named server_snap.dcecp in a
directory called /opt/dcelocal/dcecp. You can also refer to files by using relative
filenames, for example ~dce_admin/scripts/server_snap.dcecp and
~/admin/server_snap.dcecp. You can print the current working directory by using the
pwd command and set the current working directory by using the cd command. The
following command sets the current directory to be ˜dce_admin/scripts:
dcecp> cd ˜dce_admin/scripts
dcecp>
You can view a list of files in a directory by using the glob command. This command
returns a list of filenames that match pattern arguments to the command. Here is an
example:
dcecp> glob *
help local_lib.dcp
dcecp>
You can view lots of other information about files by using the file command with
various options. The file commands can help select a file based on its age, its size, or its
permissions (whether it is executable, or readable, or writable by the current user).
2.15.2 Reading and Writing Files
The dcecp commands for reading and writing to files look and act like their C language
counterparts fopen, fclose, and so on.
Open a file for reading and writing using the open command. The second argument to
the open command (shown in the following example as +r) specifies the file access
mode. You can open files for reading, or writing, or both and you can specify whether to
replace existing files or to add to them with new information. You can also set the initial
access position to the beginning or the end of a file. The default access mode is read-
only (the file must already exist).
dcecp> open server_snap.dcecp +r
124243 Tandem Computers Incorporated 2 33