30.06.2013 Views

File Management - IBM

File Management - IBM

File Management - IBM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

characters are removed before doing the comparison. The position specifies the<br />

DBCS character position in which to begin the comparison.<br />

Selecting records based on field value (INCREL Parameter)<br />

Note: You can use this parameter on the CPYF command only.<br />

You use the INCREL parameter to select records for copying by testing for the<br />

value of an entire field. Unlike the INCCHAR parameter, you can use the INCREL<br />

parameter only when you are copying from a database file, and you can test for<br />

different values in different fields on one copy command.<br />

You can use as many as 50 AND and OR relationships on one INCREL parameter.<br />

The OR relationship groups the AND relationships. For example, the following<br />

INCREL parameter essentially says this: If field FLDA is greater than 5 and field<br />

FLDB is less than 6, select the record. If FLDB is equal to 9 (FLDA is any value),<br />

select the record.<br />

INCREL((*IF FLDA *GT 5) (*AND FLDB *LT 6) +<br />

(*OR FLDB *EQ 9))<br />

The value you specify must be compatible with the field type. You must enclose<br />

each INCREL relational set in parentheses.<br />

The value *IF must be specified as the first value in the first set of comparison<br />

values, if there is only one set or several sets of comparison values. If more than<br />

one set of comparison values are specified, either *AND or *OR must be specified<br />

as the first value in each set after the first set of values.<br />

In the following discussion, an IF group refers to an IF set, optionally followed by<br />

one or more AND sets. An OR group refers to an OR set, optionally followed by<br />

one or more AND sets. All the comparisons specified in each group are done until<br />

a complete group, which is a single IF set or OR set having no AND sets following<br />

it, yields all true results. If at least one group has a true result, the copy command<br />

includes the record in the copied file.<br />

The first set of comparison values (*IF field-name operator value) and any AND<br />

sets logically connected with the IF set are evaluated first. If the results in all of the<br />

sets in the IF group are true, the testing ends and the record is copied. If any of the<br />

results in the IF group are false and an OR group follows, another comparison<br />

begins. The command evaluates the OR set and any AND sets that follow it (up to<br />

the next OR set). If the results in the OR group are all true, the record is included.<br />

If any result is false and another OR group follows, the process continues until<br />

either an OR group is all true or until there are no more OR groups. If the results<br />

are not all true for any of the IF or OR groups, the record is excluded (not copied<br />

to the to-file).<br />

If you specify both the INCCHAR and INCREL parameters, the copy command<br />

copies a record only if it satisfies both the INCCHAR and INCREL conditions.<br />

You cannot specify the INCREL parameter if you specify RCDFMT(*ALL) when<br />

copying from a multiple-format logical file.<br />

See the following for additional information on specifying data for:<br />

v “Variable-length fields used by the INCREL parameter” on page 102<br />

v “Date, time, and timestamp fields used by the INCREL parameter” on page 102<br />

Chapter 4. Copying files 101

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!