Top
PowerBSORT V7.0 User's Guide
FUJITSU Software

7.5.20 BSRCON structure

The BSRCON structure is a structure to define an individual reconstruction field.

typedef struct {
    union {
        unsigned long    rcon_position;
        BSPTR_UCHAR      rcon_literal;
    } pos;
    unsigned long        rcon_length;
    unsigned char        rcon_consinf;
    unsigned char        rcon_option;
    unsigned char        reserve[2];        /* reserved */
} BSRCON;

BSRCON structure member

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

pos.rcon_position

This specifies the position of the reconstruction 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. Specify 0 when you specify BS_EMPFLD for rcon_consinf. pos.rcon_literal is defined in a union. When a literal value is specified, set in pos.rcon_literal.

pos.rcon_literal

This specifies the address of a literal value.
pos.rcon_literal is defined in a union. When the field in the input record is specified, set in pos.rcon_position.

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.

  • Output text file CSV format and text file TSV format with literal values enclosed in double quotation marks (") when the literal values contains the field separation character, the record separation character (Note) or double quotation marks ("). In this case, a literal value double quotation mark (") is output when two double quotation marks (") are consecutive.

    Note: Enclose literal values with double quotation marks (") when it is included by not only the record separator of the input file but also one of CRLF, CR, and LF permitted as a record separator.
    Example: The data output to the reconstruction field when literal values contain the field separation character (comma) or the double quotation marks (") is as follows:
    Specification of literal values    Data output to reconstruction field
    FIELD"2"                           "FIELD""2"""
    FIELD2,3                           "FIELD2,3"
    FIELD"2",3                         "FIELD""2"",3"

rcon_length

This specifies the length of the reconstruction 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. Specify 0 when the BS_RECEND or the BS_EMPFLD is specified in rcon_consinf.

Note

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

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

rcon_consinf

This specifies whether to set a field in an input record to be a reconstruction field or literal value to be a reconstruction field.
When the text file floating field specification, text file CSV format, and text file TSV format, PowerBSORT adds and reconstructs the field separation character strings.

Define value

Meaning

BS_FIELD

This specifies field in input record for the reconstruction field.

BS_LITERAL

This specifies literal value for reconstruction field.

BS_RECEND

This specifies from the specified position to the record end for the reconstruction field.

BS_EMPFLD

This specifies the empty field for the reconstruction field. BS_EMPFLD can be specified for text file CSV format and text file TSV format.

rcon_option

This specifies the operation of the reconstruction field.
In text file CSV format or text file TSV format, when the literal values or the empty field is treated in the reconstruction field, this operation can be specified. When this specification is omitted, BSFE_L is assumed.

Define value

Meaning

BSFE_A

Enclose the reconstruction field with double quotation marks (").

BSFE_L

Do not enclose the reconstruction field with double quotation marks (").
However, enclose it with double quotation marks (") when a field separation character, a record separation character (Note) or double quotation marks (") is included in the reconstruction field.

NOTE

Enclose literal values with double quotation marks (") when it is included by not only the record separator of the input file but also one of CRLF, CR, and LF permitted as a record separator.

Information

  • In text file CSV format and text file TSV format, when format 1 of recon-def or format 3 of recon-def is specified, enclosing the reconstruction field with double quotation marks (") depends on the condition. When the field on the input record is enclosed with double quotation marks ("), the field after the record is reconstructed is enclosed with double quotation marks (").

    Example: Specify the second field for three bytes and the third field for two bytes for a reconstruction field.
    Input record                 Output record
    "001","ABC",60               "ABC",60
    "002","ABCDE",50             "ABC",50
    "003","AB,CDE",40            "AB,",40
    "004","AB"CDE,30 (Note)      "AB"C,30
    
    NOTE
    "AB" is enclosed by double quotation marks (") in the second field and "CDE" continues afterwards.