The FIND Function

The FIND function, used with COMBINE structures in FOCUS MODIFY procedures or with any file in a Maintain procedure, verifies the existence of a value in another file structure. The FIND function sets a temporary field to 1 if the value exists in the other file and to 0 if it does not. FIND does not return any actual data values. (See Additional Topics, for information on read-only access to IMS data from DB2 MODIFY procedures.)

Use FIND only with a table referenced in a COMBINE command or a MAINTAIN FILE command. With COMBINE, if the FIND is for a field in a VSAM file, this field must be the index or alternate index field. For Maintain, the field must be indexed only if it is in a FOCUS data source.

The syntax for the FIND function is

rfield/I1 = FIND(fieldname AS dbfield IN file);

where:

rfield
Contains the return code (1 or 0) after the FIND function executes.

fieldname
Is the comparison field from one COMBINE table or one table referenced in a MAINTAIN FILE command.

dbfield
For MODIFY, is the field in another COMBINE file structure or an indexed field in a VSAM file, to use for the value comparison. The AS dbfield clause is optional if rfield and dbfield have the same name.

For Maintain, is a fieldname from one of the files listed in the MAINTAIN FILE command, qualified with its filename.

To use this feature most efficiently with an RDBMS, specify a field for which an RDBMS index has been established.

file
In MODIFY, names the table or VSAM file in which dbfield resides. In Maintain, is ignored.

The FIND function is only supported within MODIFY or Maintain procedures. For more information, consult your FOCUS documentation on maintaining databases.


Information Builders