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. |
BS_SUPPRESS | This shows the suppression option is specified. |
BS_SUM | This shows the record summation option is specified. |
BS_SELECT | This shows the record selection option is specified. |
BS_RECON | This shows the record reconstruction option is specified. |
BS_REVERSE | This shows the sort processing or merging processing is executed in reverse order. |
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. |
BS_STDIN | This shows record is input from standard input. |
BS_STDOUT | This shows result is output to standard output. |
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.
Method for handling over input
Define value | Meaning |
---|---|
BS_IS | This shows each record is passed to PowerBSORT by one record by using the bsrtput function or bsrtmrge function. |
BS_IM | This shows two or more records are passed to PowerBSORT by using the bsrtput function. |
Method for handling over output
Define value | Meaning |
---|---|
BS_OS | This shows each record is received from PowerBSORT by one record by using the bsrtget function or bsrtmrge function. |
BS_OM | This shows two or more records are received from PowerBSORT by using the bsrtget function. |
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) |
BSZD_UCS2B | Unicode system (UCS-2 form) |
BSZD_UCS2L | Unicode system (UCS-2 form) |
BSZD_UTF32 | Unicode system (UTF-32 form) |
BSZD_UTF32B | Unicode system (UTF-32 form) |
BSZD_UTF32L | Unicode system (UTF-32 form) |
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. |
BS_FIXFLD | This shows text file fixed field specification. |
BS_CSVFORM | This shows the text file CSV format specification. |
BS_TSVFORM | This shows the text file TSV format specification. |
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. |
BSOPT_CHARNUM | Connected data of alphabet and numbers (for instance, data123 ) are evaluated and sorted separately for the alphabet and the numerical value. |
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.