srv_mem_describe()

This function was removed from the DP4 C library as of release 4.620. Old programs that used this function will continue to work, but must be altered not to use this function before they can be built using a 4.620 or later copy of the C library.

Purpose

Initialises the memory workfile. (This is a potentially dangerous function, because incorrect use can cause the database manager to malfunction, use mem_describe() instead.)

Old name

#define _amem_describe srv_mem_describe

Syntax

void srv_mem_describe(type_nr, key_size)

Parameters

int type_nr

Table number of records to be used in work file

 

int key_size

Size of key of table. The key is assumed to be at the beginning of the record

Description

The DP4 memory work file function srv_mem_describe() allows data records to be stored and retrieved from a work file. This function must be called on each table to initialise the operation.

The memory functions beginning with srv_ call the file handling support in the database manager, and the functions beginning with trm_ call the file handling support in the terminal manager. The srv_ version of the functions is used by a few DP4 utilities, such as auxdistr, which implement DP4 functionality. Previous editions of this page suggested the srv_ functions could be used in programs that did not use the DP4 terminal manager. A much better plan is either to implement your own functionality in this area or to use the trm functions in a program that uses only the file handling functionality of the terminal manager, and not the user interface functionality. The srv_ functions should be avoided in all circumstances.

Another set of workfile functions are available which allow you to access records in a workfile file with an index. See the function wkf_open().

The parameter key_size used to differentiate between records in the workfile is assumed to be at the beginning of the record. You cannot use srv_mem_describe() with database records where the key fields are spread throughout the record.

To use the srv_ memory workfile functions, follow the steps below:

  1. Call the function srv_mem_describe() to define the table and key size. You muse ensure that table numbers are always used with the same key size - if srv_mem_describe() is called with different key sizes on the same table number, even from different applications, the second keysize will be silently ignored, even if the first application has already terminated (unless there has been a time when all DP4 processes have ended in the mean-time).

  2. Call the function srv_mem_post() to post records to the workfile

  3. Call the function srv_mem_find() to fetch records with a specified key from the work file

You can define your own tables, but use type numbers greater than 4096. You cannot delete records from the workfile.

See also

srv_mem_post(), srv_mem_find(), wkf_open()