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 ...]
Format 1 of recon-def
pos.len
Format 1 specifies a field in the input record.
When the specified field does not exist on the record of the input, it is an error.
Format 2 of recon-def
self.len typ [ opt ]
Format 2 specifies literal values.
Format 3 of recon-def
pos.END
Format 3 specifies from the position of the input record specification to the end of the reconstruction field.
If the specified field does not exist in the input record, an error occurs.
Format 4 of recon-def
EMPTY [ opt ]
Format 4 specifies an empty field.
Format 4 can be specified for the text file CSV format and the text file TSV format.
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.
Format 1 of self
'Character string'
Format 2 of self
xHexadecimal number
Format 3 of self
dDecimal number
Note
To specify character strings of a literal value in option argument, enclose the entire option argument with double quotation marks (").
To specify character strings of a literal value that contains double quotation marks (") in option argument, specify backslash (\) before the double quotation marks (").
To specify character strings of a literal value that contains quotation marks (') in option argument, specify successive 2 quotation marks (').
When the character string of a literal value is specified, the character string should be one character or more.
When the data form is Unicode UTF-32 form, the character string of a literal value can specify only the character within the range of ASCII code.
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
In the binary file processing, when Input code system option (-q) is excluding EBCDIC, ASCII code can be specified.
In the text file processing, when Input code system option (-q) is ASCII, ASCII code can be specified.
When the Input code system option (-q) is EBCDIC, EBCDIC code can be specified.
When the Input code system option (-q) is ASCII, Shift JIS code can be specified.
In the binary file processing, when Input code system option (-q) is excluding EBCDIC, Unicode (UCS-2 form) can be specified.
In the text file processing, when Input code system option (-q) is Unicode (UCS-2 form), Unicode (UCS-2 form) can be specified.
In the binary file processing, when Input code system option (-q) is excluding EBCDIC, Unicode (UTF-32 form) can be specified.
In the text file processing, when Input code system option (-q) is Unicode (UTF-32 form), Unicode (UTF-32 form) can be specified.
In the binary file processing, when Input code system option (-q) is excluding EBCDIC, Unicode (UTF-8 form) can be specified.
In the text file processing, when Input code system option (-q) is Unicode (UTF-8 form), 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 ("). |
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
To reconstruct a 10 byte field from the 5th byte of the input record, specify as follows.
-e 4.10
To specify the character strings of literal value (abc), specify as follows.
-e "'abc'.3asc"
To specify the character strings of literal value (ab"cd) that contain double quotation mark ("), specify as follows.
-e "'ab\"cd'.5asc"
To specify the character strings of a literal value (abc'd) that contain quotation mark ('), specify as follows.
-e "'abc''d'.5asc"
To specify hexadecimal number of a literal value (abc), specify as follows.
-e x616263.3asc
To specify external decimal number of a literal value (-32) by 4 bytes, specify as follows.
-e d-32.4zdl
To reconstruct the field from the 5th byte of the input record to the end of the record, specify as follows.
-e 4.END
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.
-e "2.8,','.1asc,19.5"
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).
-e "'abc'.3ascA"
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