Top
PowerBSORT V7.0 User's Guide
FUJITSU Software

7.5.18 BSSELE structure

The BSSELE structure is a structure to define an individual selection field.

typedef struct {
    unsigned char        sele_cmpoprat;
    unsigned char        sele_type1;
    unsigned char        sele_type2;
    unsigned char        sele_option;
    unsigned long        sele_position1;
    unsigned long        sele_length1;
    union {
        unsigned long    sele_position2;
        BSPTR_UCHAR      sele_literal;
    } pos2;
    unsigned long        sele_length2;
    unsigned char        sele_trueop;
    unsigned char        sele_falseop;
    unsigned char        sele_mask;
    unsigned char        sele_option2;
    unsigned long        sele_truejmp;
    unsigned long        sele_falsejmp;
    BSPTR_VOID           subfield_addr;
} BSSELE;

BSSELE structure member

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

sele_cmpoprat

This specifies the comparison operator.
The following table shows comparison operators and their true conditions.

Comparison operation

Meaning(True condition)

BSCOND_EQ

Compared field = Comparing field or literal value

BSCOND_NE

Compared field != Comparing field or literal value

BSCOND_GT

Compared field > Comparing field or literal value

BSCOND_GE

Compared field >= Comparing field or literal value

BSCOND_LT

Compared field < Comparing field or literal value

BSCOND_LE

Compared field <= Comparing field or literal value

sele_type1

This specifies the data format of the compared field.
For more information, refer to the Data formats that can be specified in the compared field and comparing field.

sele_type2

This specifies the data format of the comparing field.
For more information, refer to the Data formats that can be specified in the compared field and comparing field. When a literal value is specified for the comparing field, BS_LITERAL is specified for sele_type2.

Note

  • When the data format of the compared field and comparing field are different, it compares the data after adjusting them to the data format of the compared field.

  • When the data format of the compared field is character, it compares data in the shorter length of the compared field and comparing field.

  • When the data format of the compared field is numeric or number, the shorter field of the compared field and comparing field are compared with the longer one after moving to the right end.

sele_option

This specifies operation of compared field.
It is effective only for text files. 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 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 contains signs are compared with arithmetic value. The result is not guaranteed when characters other than the numbers exist in the character string. When the data format is ASCII code or Unicode, it can be specified. It is in the exclusive relationship with BSOPT2_WCHR of sele_option2.

Note

If modify collation sequence (BSKEY_COL) is specified as the data format of the compared field, compared field operations cannot be specified.

sele_position1

This specifies the position of the compared field.
To specify the binary files and text file fixed fields, specify the byte position where the head of the record was assumed to be 0. For the specification of the text file floating field, text file CSV format, and text file TSV format, specify the field number counted from 0.

sele_length1

This specifies the length of the compared field.
For the text file floating field specification, text file CSV format, and text file TSV format, process with the length specified here when the actual fields are longer than the specified field length. When the actual fields are shorter than the specified field length, the actual field length is processed.

Note

In text file CSV format and text file TSV format specification, the length of the compared field does not contain double quotation marks (") that enclose the field. When two consecutive double quotation marks ("") are included in the field, they are interpreted as one double quotation mark (").

Example: Compared field and length in text file CSV format
Compared field    Characters effective as compared field    Length of compared field
ABC               ABC                                       3bytes
"ABC"             ABC                                       3bytes
"A""B""C"         A"B"C                                     5bytes
"A,B,C"           A,B,C                                     5bytes

pos2.sele_position2

This specifies the position of the comparing field.
To specify the binary files and text file fixed fields, specify the byte position where the head of the record was assumed to be 0. For the specification of the text file floating field, text file CSV format, and text file TSV format, specify the field number counted from 0.
pos2.sele_literal is defined in a union. When a literal value is specified, set in pos2.sele_literal.

pos2.sele_literal

This specifies the address of a literal value.
pos2.sele_position2 is defined in a union. When specifying other values than literal value, set in pos2.sele_position2.

Note

  • When you specify a text file fixed field, literal values cannot contain record separation character.

  • When you specify a text file floating field, literal values cannot contain field separation character or record separation character.

  • For text file CSV format and text file TSV format, double quotation marks (") do not need to enclose literal values.

sele_length2

This specifies the length of the comparing field or a literal value.
For the text file floating field specification, text file CSV format, and text file TSV format, process with the length specified here when the actual fields are longer than the specified field length. When the actual fields are shorter than the specified field length, the actual field length is processed.

Note

In text file CSV format and text file TSV format specification, the length of the comparing field does not contain double quotation marks (") that enclose the field. When two consecutive double quotation marks ("") are included in the field, they are interpreted as one double quotation mark (").

Example: Comparing field and length in text file CSV format
Comparing field    Characters effective as comparing field    Length of comparing field
ABC                ABC                                        3bytes
"ABC"              ABC                                        3bytes
"A""B""C"          A"B"C                                      5bytes
"A,B,C"            A,B,C                                      5bytes

sele_trueop

This specifies processing when a comparison result is true.
Specify the definition value that shows the end of the comparison processing in sele_trueop and sele_falseop of the last entry. For information about the processing of the comparison result, refer to the following table.

Table 7.2 Method of processing comparison result

Type of processing

Define value

Meaning

INCLUDE

BSSEL_INCLUDE

This shows the end of the comparison processing. And, it is shown to process the record.

OMIT

BSSEL_OMIT

This shows the end of the comparison processing. And, it is shown not to process the record.

Processing next field

BSSEL_NEXT

This shows to move to the next comparison processing.

Skipping to specified selection field

BSSEL_JUMP

This shows to move to the specified comparison processing.

sele_falseop

This specifies processing when a comparison result is false.
Specify the definition value that shows the end of the comparison processing in sele_trueop and sele_falseop of the last entry. For information about the processing of the comparison result, refer to the Method of processing comparison result.

sele_mask

This is an unsupported member. Do not set anything.

sele_option2

This specifies operation of the compared field.
This member is in the exclusive relationship with BSOPT_NUMERIC of sele_option. Specify the following according to the necessity.

Define value

Meaning

BSOPT2_WCHR

Even if there are consecutive multi-byte characters, each character is compared.
Only when the data format is ASCII code, Shift JIS code or Unicode and the input code system (cdmode of BSRTPRIM structure) is ASCII code system or Unicode system, this option can be specified.

Note

If modify collation sequence (BSKEY_COL) is specified as the data format of the compared field, sele_option2 cannot be specified.

sele_truejmp

This specifies the jumping destination when BSSEL_JUMP is specified for sele_trueop.
If i is specified for sele_truejmp, processing moves to the selection field of sele_entry[i] when the comparison result is a true. The value within the range of entry number from +1 to entry_no-1 is set in sele_truejmp.

sele_falsejmp

This specifies the jumping destination when BSSEL_JUMP is specified for sele_falseop.
If i is specified for sele_falsejmp, processing moves to the selection field of sele_entry[i] when the comparison result is a false. The value within the range of entry number from +1 to entry_no-1 is set in sele_falsejmp.

subfield_addr

When using the modify collation sequence function, this specifies the address of the BSCOL structure that defined the modify collation sequence.
The modify collation sequence function can be used when BSKEY_COL is specified in sele_type1 or sele_type2.

Information

One selection field expresses one logical expression. Therefore, the compound condition can be specified by specifying two or more selection fields. The specification method when the record where it meets the compound condition is selected is shown as follows.

Compound condition

(Logical expression 1 AND Logical expression 2) OR Logical expression 3
    AND:Logical product OR:Logical sum

Specification method

entry_no = 3
[0] Logical expression 1  true BSSEL_NEXT     false BSSEL_JUMP 2
[1] Logical expression 2  true BSSEL_INCLUDE  false BSSEL_NEXT
[2] Logical expression 3  true BSSEL_INCLUDE  false BSSEL_OMIT