Top
PowerBSORT V7.0 User's Guide
FUJITSU Software

7.4.1 bsrtopen function

The bsrtopen function loads the dynamic link library (DLL) of PowerBSORT into the virtual memory storage, and sets the address of each function in parameter func. In addition, the execution environment of PowerBSORT is prepared.

Format

#include "bsrt.h"
int bsrtopen (long int BSRTVL, BSPTR_BSRTFUNC func,
              BSPTR_BSRTPRIM prim, BSPTR_BSRTREC rec,
              BSPTR_BSRTKEY key, BSPTR_BSRTFILE file,
              BSPTR_BSRTOPT opt);

Function explanation

The function of the bsrtopen function is shown below.

Parameter detail

In the following, it explains the parameter of the bsrtopen function.

BSRTVL

This specifies version levels (BSRTVL) of PowerBSORT.
BSRTVL is defined in header file (bsrt.h). This parameter enables PowerBSORT to be operated without changing the C language program even if there is a change in the interface of the BSORT function.

func

This sets each address of the BSORT function (bsrtput function, bsrtget function, and bsrtmrge function).

Information

BSPTR_BSRTFUNC is a pointer of BSRTFUNC structure.

prim

It is a parameter that specifies the sort option, merge option, copy option, record selection option, record reconstruction option, first in first out (FIFO) option, the record summation option, and the suppression option.

Information

BSPTR_BSRTPRIM is a pointer of BSRTPRIM structure.

rec

No information is specified in the bsrtopen function. The detail code is set when an error occurs.

Information

BSPTR_BSRTREC is a pointer of BSRTREC structure.

key

The key field in the sort option or merge option is specified.

Information

BSPTR_BSRTKEY is a pointer of BSRTKEY structure.

file

It is a parameter that specifies file information such as an input file, output file, and temporary file.

Information

BSPTR_BSRTFILE is a pointer of BSRTFILE structure.

opt

It is a parameter that specifies option options.
The pointer of each structure to specify the summation field, selection field, reconstruction field and the number of skipping records is specified. When neither of pointers of the above mentioned structures is specified, NULL is specified for opt parameter of the bsrtopen function. When specifying any, specify it after the area is secured respectively.

Information

BSPTR_BSRTOPT is a pointer of BSRTOPT structure.

Return value

The return values of the bsrtopen function are as follows.

Return value

Meaning

0

This shows that the bsrtopen function ended normally.
Issue the bsrtput function, bsrtget function, bsrtmrge function or bsrtclse function continuously.

-1

This shows that an error occurred in the bsrtopen function.
Detailed information is set in errdetail or sub_error_code of BSRTREC structure. Issue the bsrtclse function continuously.

-2

This shows that an error occurred in the bsrtopen function.
Detailed information is set in errdetail or sub_error_code of BSRTREC structure. The bsrtclse function need not be issued for this return value.

Note

  • Other parameters than BSRTVL should be cleared to be 0 before the bsrtopen function is issued even when the value is not set. As for the parameter to which value is set, clear 0 in field before setting.

  • Among parameters of the bsrtopen function, BSRTVL, func, prim, and rec cannot be omitted. The key, file, and opt can be omitted. Specify NULL for the pointer in the parameter of the bsrtopen function when omitting them.

    Example) Specification when key, file, and opt are omitted

    bsrtopen(BSRTVL, func, prim, rec, (BSPTR_BSRTKEY)NULL, (BSPTR_BSRTFILE)NULL, (BSPTR_BSRTOPT)NULL);