You can select records on the basis of the content of characters that start in a specific position in the record or field.
You can use the INCCHAR parameter with the FROMKEY or FROMRCD parameter. You can select records first by their key value or relative record number, and then by characters in some position in the record or field.
You can test for any character string of 1 through 256 bytes. If the character string contains any special characters or blanks, you must enclose the entire string in apostrophes.
You can also specify *CT (contains) as the operator for the INCCHAR parameter. This specifies that the copy command should scan each record in the from-file for the selection character string. You can specify any valid starting position in the field or record for the start of the scan. The data will then be scanned from that position to the byte to the extreme right of the field or record.
If you specify both the INCCHAR and INCREL parameters, the copy command copies a record only if it satisfies both the INCCHAR and INCREL conditions.
CPYF FROMFILE(DBIN) TOFILE(DKTOUT) + INCCHAR(*RCD 80 *EQ XXX)
CPYF FROMFILE(DBIN) TOFILE(DKTOUT) + INCCHAR(FLDA 6 *EQ XXX)
A field name cannot be specified if RCDFMT(*ALL) is specified when copying from a multiple-format logical file, or if the from-file is a device file or inline data file.
For binary character fields, the INCCHAR parameter will use the binary character comparison rules. Comparisons will be performed by CPYF and no padding or truncation will be performed.