Modifying Multiple Data Sources: The COMBINE Facility in VSAM

To update multiple unrelated data sources with a single transaction, use the COMBINE command, which enables you to modify two or more VSAM data sources in one MODIFY request. The command combines the logical structures of the two sources into one structure while leaving the physical structures untouched.

COMBINE structures, which can contain up to 16 files and 64 segments, last for the duration of a FOCUS session or until you enter another COMBINE command. Only one combined structure can exist at a time.

In this section:

Accessing Fields in Combined Data Sources With the FIND Function in VSAM

Syntax:

COMBINE Command in VSAM

FIND Function in VSAM

Syntax: COMBINE Command in VSAM

COMBINE FILES file1 [PREFIX string1] [AND]
file2 [PREFIX string2] [AND] ...
filen [PREFIX stringn] AS newname

where:

filel ... filen
Are the names of the VSAM files to be modified (up to 16 files).

PREFIX stringn
Adds the specified string as a prefix for all fieldnames in the file, thereby avoiding the possibility of duplicate fieldnames in combined files.

AND
Is an optional word included to enhance readability.

newname
Is the name of the combined structure to be used in the subsequent MODIFY and CHECK commands.

Note: You can type the command on as many lines as necessary.

In your MODIFY procedure, use newname as follows:

MODIFY FILE newname

Placing statements pertaining to each file in different cases helps clarify the request logic.


Top of page

Accessing Fields in Combined Data Sources With the FIND Function in VSAM

The VSAM Write Data Adapter supports the MODIFY FIND function for verifying the existence of incoming data values in VSAM data sources. The fields named must be keys or alternate indexes.

FIND sets a temporary field to 1 if a value exists or 0 if one does not. You can test this value and branch on it using Case Logic.

To use FIND, include the VSAM data source in a COMBINE statement. The MODIFY procedure acts on the combined structure. Any fieldname used with the FIND function must be unique across the combined sources.


Top of page

Syntax: FIND Function in VSAM

rfield = FIND(fieldname AS dbfield IN file);

where:

rfield
Is a variable you specify to receive a return code value. This value is 1 if the FIND function can locate the data value or 0 if it cannot.

fieldname
Is the full name (not the alias or a truncation) of the incoming tested field.

dbfield
Is the full name (not the alias or a truncation) of the VSAM field containing the values being compared with the incoming data field. This must be a primary key or an alternate index.

file
Is the name of the VSAM data source where the dbfield resides.

Note: There is no space between FIND and the left parenthesis.


Information Builders