Top
PowerBSORT V7.0 User's Guide
FUJITSU Software

7.5.1 BSRTPRIM structure

The BSRTPRIM structure is a structure to specify primary basic information of the sort processing, the merge processing, the copy processing, and etc.

typedef struct {
    unsigned long    reserve1;      /* reserved */
    unsigned char    function;
    unsigned char    recform;
    unsigned char    optionfunc;
    unsigned char    fileoprat;
    unsigned char    recoprat;
    unsigned char    msglevel;
    unsigned char    cdmode;
    unsigned char    chklevel;
    unsigned long    rec_len;
    unsigned long    input_string;
    unsigned long    memory_size;
    BSPTR_VOID       memory_addr;
    unsigned long    input_recno;
    BSPTR_UCHAR      fldchar_addr;
    unsigned char    debuginfo;
    unsigned char    fieldmode;
    unsigned char    keyoption;
    unsigned char    keyoption2;
    unsigned char    linedlmt;
    unsigned char    error_happened;
    unsigned char    altmode;
    unsigned char    reserve4;      /* reserved */
    BSPTR_UCHAR      reserve5;      /* reserved */
} BSRTPRIM;

BSRTPRIM structure member

In the following, it explains about the member of the BSRTPRIM structure.

function

This specifies the main options in PowerBSORT.
Select one out of the following. This specification cannot be omitted.

Define value

Meaning

BS_SORT

Sort option

BS_MERGE

Merge option

BS_COPY

Copy option

recform

This specifies record format.
Select one out of the following. In the text file, recform need not be specified.

Define value

Meaning

BS_FREC

Fixed-length record format

BS_VREC

Variable-length record format

optionfunc

This specifies option functions.
Specify the following according to the necessity. When selecting two or more values specify the logical sum.

Define value

Meaning

BS_FIFO

This shows the first-in first-out (FIFO) option is specified.
When specified at the same time as the suppression option or the record summation option, the specification of the first-in first-out (FIFO) option is ignored. When omitted, the output order is not necessarily first-in first-out.

BS_SUPPRESS

This shows the suppression option is specified.
It is in the exclusive relationship with the record summation option.

BS_SUM

This shows the record summation option is specified.
It is in the exclusive relationship with the suppression option. When this specification is set, you need to set an address of the summation table (BSRTSUM structure) in BSRTOPT structure.

BS_SELECT

This shows the record selection option is specified.
When this specification is set, you need to set an address of the selection table (BSRTSELE structure) in BSRTOPT structure.

BS_RECON

This shows the record reconstruction option is specified.
When this specification is set, you need to set an address of the reconstruction table (BSRTRCON structure) in BSRTOPT structure.

BS_REVERSE

This shows the sort processing or merging processing is executed in reverse order.
This is effective when the key field is omitted.

BSMSG_STDERR

This shows messages are output to the standard error output. (Note)

NOTE

The output message depends on msglevel of BSRTPRIM structure or environment variable BSORT_MSGLEVEL.

fileoprat

This specifies input output information.
Specify the following according to the necessity. When selecting two or more values specify the logical sum.

Define value

Meaning

BS_OVERWRITE

This shows the processing is continued when the sort option is specified and one of input files is the same as the output file.
Note that the data of the I/O file might not be guaranteed when this option is specified and an error occurs in the sort processing.

BS_STDIN

This shows record is input from standard input.
This cannot be specified in the merge option. When the input file is specified in BSRTFILE structure, it is ignored.

BS_STDOUT

This shows result is output to standard output.
When the output file is specified in BSRTFILE structure, it is ignored.

recoprat

This specifies method of handing over record with PowerBSORT.
When selecting two or more, select each one method from handling methods for input and ones for output and specify the logical sum.

msglevel

This specifies level of the message that PowerBSORT outputs.
Select one out of the following.

Define value

Meaning

BSMSG_LEVEL_N

Nothing is output.

BSMSG_LEVEL_E

Error message is output.

BSMSG_LEVEL_W

Error message and warning message are output.

BSMSG_LEVEL_I

Error message, warning message, and information message are output.

The level of the message used in previous versions can also be specified.

Define value

Meaning

BSMSG_LEVEL0

Nothing is output.

BSMSG_LEVEL1

Error message and warning message are output.

BSMSG_LEVEL2

Error message, warning message, and information message are output.

Note

To output the message to the standard error output, BSMSG_STDERR should be set in optionfunc of BSRTPRIM structure.

cdmode

This specifies code system of the input file.
Select one out of the following.

Define value

Meaning

BSZD_AU

ASCII code system (NetCOBOL form)

BSZD_AC

ASCII code system (Micro Focus COBOL form)

BSZD_EBCDIC

EBCDIC code system (Note)

BSZD_UCS2

Unicode system (UCS-2 form)
(Byte order of system standard)

BSZD_UCS2B

Unicode system (UCS-2 form)
(Byte order of big endian)

BSZD_UCS2L

Unicode system (UCS-2 form)
(Byte order of little endian)

BSZD_UTF32

Unicode system (UTF-32 form)
(Byte order of system standard)

BSZD_UTF32B

Unicode system (UTF-32 form)
(Byte order of big endian)

BSZD_UTF32L

Unicode system (UTF-32 form)
(Byte order of little endian)

BSZD_UTF8

Unicode system (UTF-8 form)

NOTE

The EBCDIC code system can be specified for binary file.

chklevel

This specifies check mechanism of the BSORT function.
Select one out of the following.

Define value

Meaning

BSCHK_LEVEL0

Nothing is checked.

BSCHK_LEVEL1

The interface check validates parameters in the bsrtput function, the bsrtget function, and the bsrtmrge function.

rec_len

This specifies length of the input record.
For binary files, the record length is specified when the record format is a fixed-length record form. When the record format is a variable-length record form, the maximum record length is specified. For text files, the maximum record length including the line feed code is specified.

Note

In the binary file (variable-length record form) and the text file, if the record length specified by recsize is longer than the actual maximum record length, it is possible to process. However, when the record length that is longer than the actual maximum record length is specified by recsize, it becomes the factor of the performance deterioration according to the difference between a specified record length and the actual maximum record length.

input_string

This specifies the number of input strings.
When the sort option or copy option is specified, set to 0. When the merge option is specified, set the number of strings.

Information

A group of records that have been sorted is called a string.

memory_size

This specifies size of the work area (memory size) that PowerBSORT uses in the number of bytes.
Specify it within the range from 32768 to 2147482624 bytes. 0 is specified when omitting it. When omitted, if the environment variable BSORT_MEMSIZE is specified, the work area of the size is used. If not, the work area is automatically set. When the value of 2147482625 or more is specified, 2147482624 is imposed.

memory_addr

This specifies address in the work area that PowerBSORT uses.
NULL is specified when omitting the specification. When memory_addr is specified, the size should be specified in memory_size.

Note

  • When an invalid value is specified, the processing of PowerBSORT is not guaranteed.

  • Specify the area to which the address doesn't move by controlling the system for the work area of PowerBSORT.

input_recno

This specifies the number of input records in rounded number.
Set 0 when unknown.

fldchar_addr

This specifies address of field separation character string.
When text file floating field is specified, it is valid. The field character is a character string that ends with \0. When the specification of the field separation character string is omitted, NULL is specified. When the specification of the field separation character string is omitted, the tab and the blank are treated as a field separation character.

debuginfo

This is an unsupported member. Do not set anything.

fieldmode

This specifies how to decide field for text files.
Always specify for text files. Select one out of the following.

Define value

Meaning

BS_FLTFLD

This shows text file floating field specification.
Each field is specified in the number of the field delimited by the field separation character string. Because field position is decided by the position of the field separation character, field position depends on each record.

BS_FIXFLD

This shows text file fixed field specification.
Each field is specified by byte position.

BS_CSVFORM

This shows the text file CSV format specification.
Each field is specified in the number of the field delimited by the comma (,). Because field position is decided by the position of the comma, field position depends on each record.

BS_TSVFORM

This shows the text file TSV format specification.
Each field is specified in the number of the field delimited by the tab. Because field position is decided by the position of the tab, field position depends on each record.

keyoption

This specifies operation of the key field.
When the specification of the key field is omitted in the case of text file, it is effective. Specify the following according to the necessity. When selecting two or more values specify the logical sum.

Define value

Meaning

BSOPT_BLANK

Blanks and tabs in the head of the key field are disregarded.

BSOPT_DICTIONARY

Only the blank and the alphanumeric character are compared.

BSOPT_IGNORE

Control character codes are disregarded.

BSOPT_JUMBO

Lowercase letters are compared as uppercase letters.

BSOPT_NUMERIC

Character strings of the numbers that contain signs are compared with arithmetic value.
The result is not guaranteed when characters other than the numbers exist in the character strings. It is in the exclusive relationship with BSOPT_CHARNUM and the BSOPT2_WCHR of keyoption2.

BSOPT_CHARNUM

Connected data of alphabet and numbers (for instance, data123 ) are evaluated and sorted separately for the alphabet and the numerical value.
After only alphabets are targeted for the comparison and compared, character strings exclusively with numbers are compared with arithmetic values. Data is evaluated from the left of the specified field, and the data that appeared after effective data is disregarded. It is in the exclusive relationship with BSOPT_NUMERIC and BSOPT2_WCHR of keyoption2.

keyoption2

This specifies operation of the key field.
When the specification of the key field is omitted for text file, it is effective. This member is in the exclusive relationship with BSOPT_NUMERIC and BSOPT_CHARNUM of keyoption. Specify one out of the following according to the necessity.

Define value

Meaning

BSOPT2_WCHR

Even if there are consecutive multi-byte characters, each character is compared.

linedlmt

This specifies record separators.
It is effective for text file. Select one out of the following.

Define value

Meaning

BSLDM_LF

LF is treated as a record separator.

BSLDM_CR

CR is treated as a record separator.

BSLDM_CL

CRLF is treated as a record separator. (Default value)

Note

When two or more record separator exists in the input file, it is not possible to operate normally.

error_happened

This is an unsupported member.

altmode

This specifies code conversion method between the EBCDIC code and the ASCII code.
Select one out of the following.

Define value

Meaning

BSALT_ASCII

It executes the code conversion between the EBCDIC code and the US ASCII code. (Default value)

BSALT_JIS8

It executes the code conversion between the EBCDIC (Japanese kana) code and the ASCII (JIS8) code.

BSALT_JIS7

It executes the code conversion between the EBCDIC (Lowercase letters) code and the ASCII (JIS7) code.

Information

In the following cases, the code conversion between the EBCDIC code and the ASCII code is done.

  • Comparison of key field when data form of key field is EBCDIC code and when input code system (cdmode of BSRTPRIM structure) is ASCII code system.

  • Comparison of key field when data form of key field is ASCII code and when input code system (cdmode of BSRTPRIM structure) is EBCDIC code system.