Previous Topic: $JUL2GREG()Next Topic: $TIME()


$SERVER()

This function provides linkage to server IMODs. It also provides services to the server IMODs themselves, permitting easy implementation of the server IMOD conventions.

Syntax

Form 1:

x = $SERVER(REQUEST,service,[arg],[control])

Form 2:

$SERVER(action,service,imod,[desc])

Form 3:

$SERVER(command,service,[option])

Form 4:

$SERVER(INTERNAL,[service],subcmd,[reqimid,reqstk],[retstk],[string])

Parameters

x

Result string from the server IMOD.

REQUEST

Queues a request for execution by a server IMOD.

service

Name of the service to be invoked.

arg

Argument string to be passed to the server IMOD. The content of this string depends on the service being requested.

control

A control option. Specify:

WAIT

Returns control after the request is processed.

NOWAIT

Queues the request and returns control immediately to the requestor.

action

Action to be taken. Specify:

DEFINE

Defines or redefines a new server IMOD to the system.

DELETE

Deletes an existing server IMOD definition. Deleting an operating server IMOD does not affect it in any way, except that its existence becomes unknown to the system for any future requests or commands.

imod

Name of the IMOD that is invoked to start the named server.

desc

Description of the service. This description is made available for reports and displays.

command

Command to be issued to the server IMOD. This can be one of the predefined server commands that are listed in "Server Commands" or another command that the server specifically supports.

option

Modifiers that affect how the server IMOD executes a command. The options are listed with the server commands in the following section.

INTERNAL

Indicates that the request deals with the internal operation of a server IMOD. The INTERNAL requests are only made from within a server IMOD and provide a convenient mechanism for providing standard services.

subcmd

Tailors the INTERNAL service by the specification of subcommands that are listed in "INTERNAL Subcommands".

reqimod

IMOD ID of the IMOD task that originated a request.

reqstk

Stack number, where results of a request are returned.

retstk

Stack number that contains stack records to return.

Default: Current stack

string

String of data to be returned to the requesting IMOD task.

Server Commands

In addition to REQUEST, DEFINE and DELETE, a series of commands have been defined for operating server IMODs:

CANCEL

Cancels the server IMOD. Avoid this command because the current request (and all queued requests) is abandoned and the requesting IMODs are not notified.

CYCLE

Cancels the current server IMOD and starts a new server. The queued requests are transferred to the new server.

DEQUEUE

Transfers all queued requests to the current stack of the IMOD task issuing the command.

DISPLAY

Returns information about all currently defined servers on the stack. The first character of each stack record serves as a delimiter character. The returned fields, in order, are Service, IMOD name, IMOD task ID (if running), and Description.

HOLD

Continues to permit requests to be queued, but does not permit processing of any requests from the queue.

PAUSE

Prevents acceptance of any further requests for queuing. Processing of queued requests is deferred.

PURGE

Fails each request in the current request stack and notifies any waiting requestors of the failure.

QUIESCE

Prevents queuing of more requests, but permits processing of any queued requests.

RESET

Deletes all unprocessed requests. Processing is not performed and the requestors are not notified.

RESUME

Cancels the effects of any outstanding HOLD, PAUSE, or QUIESCE.

START

Starts the named service. Any specified options are passed to the server IMOD in the argument string, following the service name.

STATUS

Returns the status of a particular server IMOD on the stack. The returned information is formatted for display purposes.

STOP

Performs a QUIESCE function and then a TERMINATE function when all queued requests have been completed.

TERMINATE

Terminates processing immediately. Ignores any unprocessed requests.

TEST

Returns the current status of the server as the result. Values are UNDEFINED, STOPPED, STOPPING, PAUSED, HOLDING, QUIESCED, and AVAILABLE.

INTERNAL Subcommands

The INTERNAL service is used only from within a server IMOD. It permits the easy implementation of server IMOD conventions and standardized coding. The following lists each available subcommand and any modifiers that are appropriate. For a detailed explanation and examples of writing server IMODs, see the server IMOD administrating topics.

AUTO

Intercepts all COMMAND functions and handles them without the knowledge of the server. The interception and execution are performed whenever the WAIT subcommand is issued. The effect of AUTO can be canceled with the NOAUTO subcommand.

COMPLETE

Posts a request as complete and returns the results to the requesting IMOD. This option requires specification of reqimod and reqstk. You can use string to return a result string.

HOLD

Prevents the processing of any additional requests. Requests continue to be queued. Commands continue to be processed.

NOAUTO

Cancels a previously issued AUTO subcommand.

PAUSE

Prevents queuing of more requests. Processing of any queued requests is deferred.

PURGE

Fails each request in the current request stack and notifies waiting requestors. If string is specified, it is returned as the result. If omitted, the results are: FAILED: REQUEST PURGED.

QUIESCE

Prevents further requests from being queued. The WAIT subcommand returns commands and queued requests.

RESET

Deletes all entries from the request stack. Processing is not performed and waiting requestors are not notified. Use extreme care when using this option.

RESUME

Cancels the effects of any outstanding HOLD, PAUSE, or QUIESCE.

SETUP

Performs all functions necessary to establish a server IMOD. Invoke this service once when the server IMOD task is first started.

TERMINATE

Terminates processing immediately. Any unprocessed requests are ignored and discarded.

WAIT

Waits for a command or request to be entered. The returned value is REQUEST (indicating that a request has been received), COMMAND (if a command is processed), TERMINATE (if immediate termination is to occur), or FAIL: text (if a failure has occurred).

Usage Notes

For more information and examples of coding and using server IMODs, see server IMOD administrating topics.

Results

The $SERVER() function returns various result strings, depending on the request. All requests can return a result in the form: FAIL: text, where text is descriptive of the condition causing the failure.

In lieu of specific results, the string SUCCESS is returned to the caller.