Top
PowerBSORT V7.0 User's Guide
FUJITSU Software

3.2.2 Reconstruction field option (-e)

To use the record reconstruction option, specify the reconstruction field.
The field specified for the reconstruction field is output from right after the left of the output record sequentially. When the reconstruction field is specified, specify the field positions after the reconstruction for the key field and the summation field.

Format

-e recon-def [ ,recon-def ...]

pos

This specifies positions 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.

len

This specifies a length of the reconstruction field in the number of bytes.
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.
In the specification of description format 1, the length is not limited. For the information about each data format that can be specified in the description format 2, refer to Data formats that can be specified in the literal value of the reconstruction field.

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

self

This specifies literal value. The description form of self is shown below.

Note

  • The description method when a literal value is specified is different according to the shell used. The description example in a typical shell is shown below. When a literal value is specified for the argument file (argument file option (-a)), it is same as the method of describing the Bourne shell.

    • Bourne Shell

      • To specify a character string with a command argument, enclose the entire argument as shown below.

        Example) When you specify character string "ABC"
        -e "'ABC'.3asc"
      • To specify a character string including a double quotation with a command argument, specify a backslash (\) immediately before the double quotation (").The character with a special meaning as a shell is similar. (example: $, \, `)

        Example) When you specify character string ""ABC""
        -e "'\"ABC\"'.5asc"
      • To insert a quotation (') into a character string, specify two quotations in succession.

        Example) When you specify character string "'ABC'"
        -e "'''ABC'''.5asc"
    • C shell

      • The backslash(\) is specified before quotation (') before and behind the character string when the character string of a literal value is specified.

        Example) When you specify character string "ABC"
        -e \'ABC\'.3asc
      • The backslash (\) is specified before double quotation (") when the character string of a literal value which contains double quotation (") is specified. The character with a special meaning as a shell is similar. (example: $, &, (, ), |, \, `, {, }, ;, *, <, >, ?, blank)

        Example) When you specify character string ""ABC""
        -e \'\"ABC\"\'.5asc
      • When the character string of a literal value which contains quotation (') is specified, it is continued two specification of the backslash (\) before quotation (').

        Example) When you specify character string "'ABC'"
        -e \'\'\'ABC\'\'\'.5asc
  • When the character string of a literal value is specified, the character string should be one character or more.

  • When you specify a decimal number of a literal value, signs can be specified.

  • 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"
  • When a value specified with a literal value and the length specified with len are different, process them as shown below.

    • When the literal value is character strings, the literal value is specified to start at the left and any blank spaces to the right is filled with the appropriate number of spaces if the length of the character strings specified in the literal value is shorter than the length specified in len. If the length of the character strings specified in the literal value is longer than the length specified in len, it is an error.

    • If the literal value is number, convert the value specified in the literal value into the data format and the length specified in typ and len, and embed them. If the conversion result is more than len, it is an error.

  • When specifying literal value of fixed-point binary numbers, unsigned fixed-point binary numbers, fixed-point binary numbers - little endian, unsigned fixed-point binary numbers - little endian, fixed-point binary numbers - system dependent, and unsigned fixed-point binary numbers - system dependent as decimal numbers, a literal value can specify even the value expressible by the length specified with len.

    Example

    Length

    Signed Data Format

    Unsigned Data Format

    1 byte

    -128 - 127

    0 - 255

    2 byte

    -32768 - 32767

    0 - 65535

    3 byte

    -8388608 - 8388607

    0 - 16777215

    4 byte

    -2147483648 - 2147483647

    0 - 4294967295

    :

    :

    :

typ

This specifies the data format of literal values.
For the information about each data format that can be specified, refer to Data formats that can be specified in the literal value of the reconstruction field.

Note

  • Unicode UCS-2 form can be specified, except when the Input code system option (-q) is EBCDIC at the binary file. When the Input code system option (-q) is Unicode (UCS-2 form), the Unicode UCS-2 form can be specified in case of the text file. In both cases, when C or UTF-8 locale is defined in the LANG environment variable, the Unicode UCS-2 form can be specified.

  • Unicode UTF-32 form can be specified, except when the Input code system option (-q) is EBCDIC at the binary file. When the Input code system option (-q) is Unicode (UTF-32 form), the Unicode UTF-32 form can be specified in case of the text file. In both cases, when C or UTF-8 locale is defined in the LANG environment variable, the Unicode UTF-32 form can be specified.

  • Unicode UTF-8 form can be specified, except when the Input code system option (-q) is EBCDIC at the binary file. When the Input code system option (-q) is Unicode (UTF-8 form), the Unicode UTF-8 form can be specified in case of the text file. In both cases, when C or UTF-8 locale is defined in the LANG environment variable, the Unicode UTF-8 form can be specified.

END

Specify the fixed string 'END' at format 3 of recon-def.

EMPTY

Specify the fixed string 'EMPTY' at format 4 of recon-def.

opt

This specifies the operation of the reconstruction field.
It can be specified in text file CSV format or text file TSV format, at format 2 of recon-def or format 4 of recon-def. When this specification is omitted, it operates assuming that L is specified.

opt

Meaning

A

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

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 "-e1.3,2.2" for the 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.

Example

  1. To reconstruct a 10 byte field from the 5th byte of the input record, specify as follows.

    -e 4.10
  2. To specify the character strings of literal value (abc), specify as follows.

    For Bourne shell
    -e "'abc'.3asc"
    For C shell
    -e \'abc\'.3asc
  3. To specify the character strings of literal value (ab"cd) that contain double quotation mark ("), specify as follows.

    For Bourne shell
    -e "'ab\"cd'.5asc"
    For C shell
    -e \'ab\"cd\'.5asc
  4. To specify the character strings of a literal value (abc'd) that contain quotation mark ('), specify as follows.

    For Bourne shell
    -e "'abc''d'.5asc"
    For C shell
    -e \'abc\'\'d\'.5asc
  5. To specify hexadecimal number of a literal value (abc), specify as follows.

    -e x616263.3asc
  6. To specify external decimal number of a literal value (-32) by 4 bytes, specify as follows.

    -e d-32.4zdl
  7. To reconstruct the field from the 5th byte of the input record to the end of the record, specify as follows.

    -e 4.END
  8. To reconstruct a 8 byte field from the 3rd byte of the input record, and character strings of a literal value (,), and 5 byte field from the 20th byte of the input record, specify as follows.

    For Bourne shell
    -e "2.8,','.1asc,19.5"
    For C shell
    -e 2.8,\',\'.1asc,19.5
  9. Enclose with double quotation marks ("), and specify the field in the text file CSV format and text file TSV format to specify the character string of literal value (abc).

    For Bourne shell
    -e "'abc'.3ascA"
    For C shell
    -e \'abc\'.3ascA
  10. In text file CSV format and text file TSV format, specify the empty field enclosed with double quotation marks (") between the first field in the input record and the second field.

    -e 0.1,EMPTYA,1.END