Pathmaker Programming Guide

Coding Custom Services
Creating Services and Servers
4–54 067868 Tandem Computers Incorporated
File Error Handling There are several ways that you can handle server errors within Pathmaker
applications. You can:
Do nothing and allow the default error handling within the generated server
handle all file errors.
Add code to your custom service that interprets the outcome of a file operation.
Rewrite portions of the server skeleton to change the text or format of error
messages.
For C services, rewrite portions of the common service utility library, PMSVCULC,
to change the text or format of error messages.
In most cases, Tandem recommends that you add code to your Custom Source File if
you want to write your own error messages. If you alter the server skeleton, the
changes you make apply to every service in the server and could restrict your ability to
repackage services within servers.
Information about default error handling and Custom Source File error handling
appears on the following pages. See “Modifying a Server Skeleton or Service
Skeleton,” in Section 9, for information about changes that you can make to the server
skeleton to reformat or rewrite error messages.
File Error Handling in a COBOL Custom Source File
You can either code all error handling for a service yourself in the Custom Source File
or allow the COBOL Declarative Section to handle some file errors.
The Declarative Section error handling is limited in its usefulness; although it is
adequate for WRITE and DELETE operations, you should always provide error
handling for READ operations. Error handling for SQL tables and views is discussed
in the a later subsection.
Pathmaker servers do all file operations with a file-status data item declared. The file-
status data item is assigned a value that reflects the outcome of the file operation.
Pathmaker servers return file-status messages to the requester depending on the value
of the file-status data item. A value of 97, for example, means that the record was
locked; a value of 23 means that the record was not found. Refer to Table 4-5 for a list
of these values.
Whenever the server performs a file operation, it moves a file-status message into
T9154-FILE-ERROR-MSG in the Declarative Section. The message contains:
The logical (SELECT) file name
COBOL and operating system error values
Text if the error is a COBOL error
The generated server moves the error message text to T9154-ADVISORY-MSG-TEXT
and moves the advisory-only reply to the reply flag. This information is returned to
the requester, where the error message is displayed to the end user.