PreviousNext

Processing the .sams File

The entire sams file for the hello program is as follows:

# Part I

component hel


# Part II

start

code hello_msg

text "Hello World"

action "None required"

explanation "Greeting message for sample messaging program"

end

We create the file with these contents and name it hel.sams.

A sams file containing DCE messaging API message definitions (in other words, a sams file not containing definitions for DCE serviceability API messages) should be compiled by invoking sams as follows:

sams -o thmc sams_filename

where:

-o Introduces output flags as follows:

t Specifies that a file containing source code to generate an in-memory message table be output by sams.

h Specifies that a header file defining codes for the message numbers be output by sams.

m Specifies that a .msg file be output by sams.

c Specifies that sams call gencat (with the .msg file as input) to produce a message catalog.

Running the command as shown will result in four files being output:

dcehel.cat
XPG4 message catalog file created by gencat. If you wish to use the message catalog, you must install it yourself.

dcehel.msg
Message input file for gencat.

dcehelmsg.c
Code defining the in-memory table of message texts. By using this table you can avoid depending on extracting message texts from the message catalog.

dcehelmsg.h
Header file containing definitions for dcehelmsg.c.

The header file should be included in the program source code. The dcehelmsg.c module should be compiled and linked with the program object module. The message catalog should be installed in the correct platform-dependent location.

All that remains now is to create a simple C program that calls a DCE messaging routine to output the "Hello World" message.