bdfp1m1eProgramming Concepts and Reference

dfmrg-Merge Logical Records from Two Subfiles

Use this function to merge two subfiles into one subfile.

Format

void dfmrg(dft_fil *file, dft_fil *input,
     dft_opt options, dft_kyl *key_list);



file
is a pointer to the base address of the SW00SR slot (defined in c$sw00sr.h) of the subfile that you want to access and is returned by the dfopn function.

input
is a pointer to the SW00SR slot of the input subfile that will be merged into the subfile referenced by file.

key_list
is a pointer to the key list of the merged output file. See Specifying Logical Records (LRECs) Using Keys for more information about key lists.

options
are the processing options for this function. Use the following values:

DFMRG_FULLFILE
merges LRECs from the entire input file to the output subfile referenced by file.

DFMRG_RELEASE
releases the SW00SR slot of the input file after processing the merge.

DFMRG_RELFC
releases the input subfile and deletes it from DASD. All overflow blocks are released. If the file is a pool file, the prime block is also released. If the file is a fixed file, the prime block is initialized to empty.

0
specifies that you do not want to use any processing options.

Entry Requirements

You must open both subfiles before calling dfmrg.

Normal Return

None.

Error Return

 See Identifying Return Indicators and Errors for information about how to check the error indicators. 

Programming Considerations

Examples

The following example merges the two open subfiles referenced by file_ptr and input_ptr. All the LRECs go into the file_ptr subfile.

/* first set up keys */
 
dft_fil *input_ptr;
dft_kyl keys;
 
df_nbrkeys(&keys, 1);
df_setkey(&keys, 1, offsetoff(struct gr95sr, gr95nam),
          member_size(struct gr95sr, gr95nam), 0, NULL, 0, DF_UPORG, DF_CHAR);
 
dfmrg(file_ptr, input_ptr, 0, &keys);

Related Functions

dfsrt-Sort a Subfile.