OSF DCE Application Development Guide--Core Components
Using the DCE Serviceability Application Interface
the index of the message text within the subtable.
By convention, cmp is a three-character code identifying the application as a whole;
serviceability uses it to group all of an application’s message and table data together.
Specifying svc_c_sev_error gives the message the severity of ‘‘error;’’ the significance
of severity in serviceability will be explained in the following sections. DCE_SVC() is a
macro that helps simplify the coding of dce_svc_printf() calls; as will be seen, another
macro mechanism can be used to make the calls much simpler still.
4.1.2 Simple Serviceability Interface Tutorial
In this section, we’ll see how to go about creating a simple C program that uses the
serviceability interface to print the familiar ‘‘Hello World’’ message.
All that is necessary to do this is to replace the first call that follows with something like
the second:
printf("Hello World\n");
dce_svc_printf( hello_world_message);
However, making the dce_svc_printf() call requires the following preliminary steps:
1. Defining the message in a sams file.
2. Processing the sams file to obtain a set of files that contain code used by the
serviceability routines.
3. Coding some serviceability initialization calls into the C program itself.
4. Coding the dce_svc_printf() call.
The next several sections describe each of these steps.
4.1.2.1 Defining the Message
In order to print any message through the serviceability interface, we must first define the
message in a sams file and process the file with the sams utility. For the hello_svc
program, we will define a sams file with the ‘‘bare minimum’’ contents necessary.
Additional information on the use of sams can be found in the sams(1dce) reference
page.
Each line in a sams file consists of a simple header and value combination. The header
indicates the meaning of the value being specified, and value is the value itself. A sams
file for serviceability use is made up of three parts. The first part consists of a minimum
of one line that specifies the name of the component (that is, the application) that is to
use the messages that will be generated from the file.
124245 Tandem Computers Incorporated 4−3