more than one file, you must indicate which file's value is to be used. JREF(1) (Join Reference)means that the value of CUSNBR is to be taken from the first file, SLSHIST.Defining a key field lets us read it in a sorted sequence. All key fields must be from the primaryfile.You may also include select/omit specs, but if you do, you must add the DYNSLT (DynamicSelect) keyword at the file level (before the R spec).Join logicals have a few limitations which you need to keep in mind. One, you can't do exception joins with join logicals. Two, the key fields must all come from the primary file. Three, joinlogicals can only join physical files. (Ideally, you shouldn't have to worry about whether a file isa physical or a logical.) Four, you can't update through a join logical file. Instead, you mustupdate through a physical or a non-join logical. You can get around all of these limitations byusing Open Query File (OPNQRYF), except for the last one.Joining files with OPNQRYFIf you want to get around limitations one and three, you'll have to let OPNQRYF join the files.OPNQRYF handles inner, partial outer, and exception joins with the JDFTVAL parameter, whichlooks like its DDS counterpart, but differs in that it takes a parameter value. JDFTVAL(*NO), thedefault, is for inner joins. You can get a partial outer join with JDFTVAL(*YES). If you want anexception join, specify JDFTVAL(*ONLYDFT). If any of the files being joined is itself a joinlogical, it must agree with this parameter.To overcome the second limitation, when you need to order a join logical by a field from thesecondary file, specify the key field on an OPNQRYF command. 7 illustrates how we could sortthe CUSHIST file on sales rep number, which comes from the secondary file.To overcome the second limitation, when you need to order a join logical by a field from thesecondary file, specify the key field on an OPNQRYF command. Figure 7 illustrates how wecould sort the CUSHIST file on sales rep number, which comes from the secondary file.You'll also have to work with the FILE, JFLD, FORMAT, and MAPFLD parameters when joining with OPNQRYF. List the files you are joining, primary first, in the FILE parameter. Usethe FORMAT parameter to tell OPNQRYF how the high-level language expects the data to look.Put the name of any file here, and if the file is a multi-format file, add the name of the format touse. (If no file has exactly the fields you need, create a physical file with no members in it.) Besure to code the same file in your HLL program as well. When you override the format file to the primary join file, the program will not read the actual data, but the query.The JFLD parameter, like the JFLD keyword in DDS, tells which fields to use to join the files. Itssyntax is different, in that one JFLD parameter is used in place of several JFLD keywords.If the same field name is found in more than one file, use the MAPFLD parameter to indicatefrom which file to retrieve the field value.8 illustrates these keywords. WORK is a file which has all of the fields needed for the HLL program. The actual data will come from the sales rep master file and the join logical calledCUSHIST. Since CUSHIST is a partial outer join logical, OPNQRYF must also indicate a partialouter join with JDFTVAL(*YES). The SLSREP field is used to make the join. The MAPFLDtells OPNQRYF to get the value of SLSREP from the sales rep master file. (If we told it to get thevalue of SLSREP from the CUSHIST file, it would return a zero sales rep number for sales repswith no sales.)Figure 8 illustrates these keywords. WORK is a file which has all of the fields needed for theHLL program. The actual data will come from the sales rep master file and the join logical calledCUSHIST. Since CUSHIST is a partial outer join logical, OPNQRYF must also indicate a partial