Buffer Types

This chapter describes the buffer types supported in Tmax.

1. Overview

If you are using multiple servers with different hardware devices and operating systems, you encounter an issue when you need to transfer data among the servers: you need in-depth knowledge about all the operating systems and data conversion process.

To avoid this problem, the Tmax system supports various types of standard buffers. The buffers bring the following benefits:

  • Developing flexible business programs using various buffers.

  • Saving development time that could be otherwise spent on data conversion.

  • Suffering less network overhead that arises from converting data intro character strings. With the Tmax buffers, you can send and receive the data whose type is specified before a transaction begins.

2. Buffer Types

To decrease network overhead and enhance the development process, the following buffers are supported.

figure buffer type
Tmax Communication Buffer Types
  • String buffer

    Used for strings that end with NULL. The buffer length is not required. This buffer is platform-neutral.

  • CARRAY and X_OCTET buffers

    Used for strings with a specified data transmission length (usually binary data). This buffer is platform-neutral.

  • Struct and X_C_TYPE buffers

    Used for structure data in C (language). This buffer can have all primitive types, declared structs, and arrayed of structs as members.

  • X_COMMON buffer

    A C program structure that can have only char, int, and long as members.

  • Field buffer

    Used for data with a field key. This buffer can have all primitive types as members. It is used to pass flexible data types because it supports various data access methods and conversion APIs.

3. Managing a Buffer

To guarantee buffer integrity, a standard communication buffer is used, which sets the standards for the data type and memory allocation. Before it is sent, data is converted to the standard communication format, and before it is received, the data is converted back into the original format. In this way, structure and string buffers are passed for communication between heterogeneous machines.

Tmax uses sdlc to convert data to the standard format. On the client side, the sdlc program generates a conversion information table. On the server side, the sdlc program creates a conversion/reversion program for standard communication. The client encrypts data to a standard recognized by the server. A program on the server decrypts the data and then encrypts the result to the client in the standard type. Throughout this process, struct buffers or field buffers that have string or primitive data types can be used without any constraints.

The STRUCT, X_C_TYPE, and X_COMMON struct buffers must be converted to standard communication types and added during compilation. STRING, CARRAY, and X_OCTET buffers do not need to be converted to standard buffer types because they allow string type communication between heterogeneous machines.

For more information about buffers and related functions, refer to Buffer Management or Tmax Reference Guide.

3.1. Struct Buffers

Developers write the structures they want to use in a struct file (xxx.s), which is referenced to create the conversion table and conversion program. A struct file cannot include commands such as typdef and include. All primitive and structure types can be members of a struct.

To use the struct buffer, you must use the sdlc program to create a conversion table and the conversion/reversion program that convert the struct buffer to and from the standard communication buffer. The information table is automatically used when the structure is used, and the conversion/reversion program is compiled and used together with the service routine.

The following is the process of compiling a server/client program when developing an application that uses a struct buffer (STRUCT, X_C_TYPE, and X_COMMON). demo.s is the struct buffer.

chap3 1
Compiling an Application Program that Uses a Struct Buffer

3.2. Field Buffers

Developers write field buffers they want to use in a field buffer file (xxx.f), which is referenced to create the conversion table. To convert a field buffer to the standard communication format, you must use the fdlc program to create the conversion table, which is automatically used by the system when the field buffer is used.

The following is the process of compiling a server/client program when developing an application that uses a field buffer. demo.f is the field buffer.

chap3 2
Compiling an Application Program that Uses a Field Buffer