Top
PowerBSORT V7.0 User's Guide
FUJITSU Software

3.2.15 Selection field option (-p)

To use the record selection option, specify the selection field (selection condition).
Two or more selection fields can be specified. When two or more selection fields are delimited by the comma (,), it becomes the logical product of the selection condition. When two or more Selection field options (-p) are specified, it becomes the logical add of the selection condition.

Format

-p sel-def [ ,sel-def ...]

pos

This specifies the position of the compared field or 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 text file floating field, text file CSV format, and text file TSV format, specify the field number counted from 0.

len

This specifies the length of the compared field or the comparing field in the number of byte.
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.
To specify an unsigned binary number for the data format, specify mask values. Compare the logical product of the mask value and field values. The mask value specifies the same value as the compared field and the comparing field.
For information about the lengths of each data format, refer to the Data formats that can be specified in the compared field and the comparing field.

Note

In text file CSV format and text file TSV format specification, the length of the compared field or 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: 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

self

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

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.

  • Literal value is compared after adjusting to the data format of the compared field.

  • 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.

  • 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 16 bytes.

typ

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

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.

  • 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.

opt

This specifies the operations of the compared field.
To specify two or more operations, describe them successively. The operations that can be specified are shown below. Others than "w" can be specified only when the text file is processed.

opt

Meaning

b

Blanks and tabs in the head of the field are disregarded.

d

Only the blank and the alphanumeric character are compared.

i

Control character codes are disregarded.

j

Lowercase letters are compared as uppercase letters.

n

Character strings of the numbers that contain signs are compared with arithmetic values. 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 "w".

w

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 (-q) is ASCII or Unicode, can this option be specified. It is in the exclusive relationship with "n".

Note

If modify collation sequence is specified as the data format of the compared field or comparing field, field operations cannot be specified in opt.

cmp

This specifies the comparison operator.
The following shows comparison operators and their meanings.

cmp

Meaning(True condition)

eq

Compared field = Comparing field or literal value

ne

Compared field != Comparing field or literal value

gt

Compared field > Comparing field or literal value

ge

Compared field >= Comparing field or literal value

lt

Compared field < Comparing field or literal value

le

Compared field <= Comparing field or literal value

Example

  1. To select records that the field of packed decimal number in 4 bytes from the 32nd byte and the field of the external decimal number in 4 bytes from the 12th byte are equal, specify as follows.

    -p 11.4zdl.eq.31.4pdl
  2. To select records that have more than 30 fields of the fixed-point binary number in 4 bytes from the 12th byte, specify as follows.

    -p 11.4fbi.ge.d30
  3. To select records that have less than -1000 fields of the external decimal number in 4 bytes from the 10th byte, specify as follows.

    -p 9.4zdl.lt.d-1000
  4. To select the record in which the character string 'abcde' exists in the field of ASCII code in 5 bytes from the 10th byte, specify as follows.

    -p "9.5asc.eq.'abcde'"
  5. To select the record in which the character string 'ab"cd' exists in the field of ASCII code in 5 bytes from the 10th byte, specify as follows.

    -p "9.5asc.eq.'ab\"cd'"
  6. To select the record in which the character string 'abc'd' exists in the field of ASCII code in 5 bytes from the 10th byte, specify as follows.

    -p "9.5asc.eq.'abc''d'"
  7. To select the record in which the character string 'abc' exists in the field of ASCII code in 3 bytes from the 4th byte and character string 'abc' in the field of ASCII code in 3 bytes from the 10th byte, the record in which the character strings 'abcde' in the field of ASCII code in 5 bytes from 4th byte, specify as follows.

    -p "3.3asc.eq.'abc'","9.3asc.eq.'abc'" -p "3.5asc.eq.'abcde'"