Selecting related files based on name links

Another way to add files to your report is by defining temporary relations when you design the report. These temporary relations are based on name links between fields and access keys.

1. Select the first file you want ReportWriter to read.
2. To add additional files to the Files to Read list, select File functions > Add file via name link.
Note

To access this function, either you must have a repository cross-reference file called RPSDAT:rpsxref.ism, or the environment variable RPSXFIL must be set to the name of the cross-reference file that corresponds to the repository you’re using.

The Link Fields from filename list contains a list of fields in the current file that have name links to other files.

3. Select the field you want ReportWriter to use in accessing a secondary file.

The Available Files list contains a list of files that can be accessed using the selected link field.

4. Select the next file you want ReportWriter to read from the Available Files list.

Because a secondary file can have multiple structures assigned to it, you may need to select the one you want. In addition, if the selected link field matches the link field in more than one access key for the selected structure, the Available Relations list is displayed. This list provides the name of the link field (the “from” key) and the name of the access or “to” key involved in the temporary relation. (If you would like to view more information about these keys to help you make your selection, see Examining a relationship between files.) Select the desired relation.

Once you select the secondary file, the Name Link Relation input window is displayed (see figure 1), showing you the temporary key and relation that ReportWriter will be creating to access the secondary file. The name of the “from” key will be “NAME_LINK_KEY.”

1. Defining a temporary name link relation.

Depending on the segments in the “to” key, ReportWriter may be trying to match the full key size, in which case you can’t modify the “from” key, or it may be doing a partial key match, and you can optionally add other name link fields or literal segments to the “from” key to make it a full key match.

If the “to” key consists of more than one segment, ReportWriter will match as many segments as possible with name linked fields. You can change to a literal or clear any of the NAME_LINK_KEY segments other than the first. You may not skip any segments; segment definitions must be contiguous. If you clear a Field type segment, when you set the type back to Field, ReportWriter redisplays the appropriate name linked field.

Press Enter to accept the current temporary relation.

When you’ve selected your secondary file, it is displayed in the Files to Read list in the following format:

file description.structure description.to key

An “X” appears in the PARENT column to identify this relation as temporary based on a name link.

5. Continue to add any files that you want in your report.
6. When you’re finished selecting files, press the Exit shortcut from the Files to Read list.

For information about how ReportWriter determines the list of secondary files based on name links, see Selecting files to read.

Modifying name link relations

To modify a name link relation, highlight the “to” file in the Files to Read list and select File functions > Modify name link relation.

The Name Link Relation input window is displayed. You can change to a literal or clear any of the NAME_LINK_KEY segments other than the first. You may not skip any segments; segment definitions must be contiguous.