Use the MODIFY LOOKUP function to retrieve data values from cross-referenced data structures. To use LOOKUP with VSAM data sources, issue a JOIN command to link them and then issue a LOOKUP on the key field or alternate index.
LOOKUP is required because, unlike TABLE requests, MODIFY requests cannot freely read cross-referenced files. The LOOKUP function enables you to issue requests containing retrieved data values in computations and messages.
LOOKUP is valid in both COMPUTE and VALIDATE statements. Requests can use the data retrieved in the computations or validations within MODIFY procedures. Use LOOKUP to locate values in any data sources that can be linked with the JOIN command.
You cannot modify data in the cross-referenced file. To modify files other than the host file in a request, use the COMBINE command described in Modifying Multiple Data Sources: The COMBINE Facility.
rcode = LOOKUP(field);
where:
Syntax note: no space is permitted between LOOKUP and the left parentheses. LOOKUP can exist by itself or as part of a larger expression. If it is used by itself, it must end in a semicolon.
The extended syntax of the LOOKUP function, described in your FOCUS documentation, does not apply to the VSAM Interface. You can only retrieve exact match values.
When using LOOKUP, the MODIFY request reads a transaction for the host field value. LOOKUP then searches the cross-referenced segment for an instance with this value in the cross-referenced field:
If no such instances exist, the rcode variable is set to 0. If you use the field specified by the LOOKUP function in the request, that field assumes a value of blank if alphanumeric or 0 if numeric.
If a record containing the transaction value is found, the function sets the rcode variable to 1 and retrieves the LOOKUP field value from the first matching segment found. All field values in the segment are then available for COMPUTE or VALIDATE operations.
Information Builders |