Sign in

docs DDS Physical

JDFTVAL (Join Default Values) keyword—join logical files only

JDFTVAL (Join Default Values) keyword—join logical files only

JDFTVAL (Join Default Values) keyword—join logical files only

The JDFTVAL keyword is valid only for join logical files. If this keyword is in effect, the system provides default values for fields when a join to a secondary file does not produce any records.

This keyword has no parameters.

The default values for the system are blanks for character and hexadecimal fields and zeros for numeric fields. You can change the default for specific fields by specifying the DFT keyword for the fields in the physical file.

If you specify JDFTVAL, your program retrieves records for which a secondary file does not have a corresponding record. If you do not specify JDFTVAL, a record in the primary file for which there is no corresponding record in a secondary file is skipped.

If you are joining three or more files, and you specify the JDFTVAL keyword for fields used as join fields, default values of fields missing in secondary files are used in the same way that a field value is used. For example, records are selected and omitted based on the default value. Also, if this field is used as a join field to join to other secondary files, records from the other secondary files are returned to your program based on the default value.

Example

The following example shows how to specify the JDFTVAL keyword.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A                                      JDFTVAL
00020A          R RECORD1                   JFILE(PF1 PF2)
00030A          J                           JOIN(PF1 PF2)
00040A                                      JFLD(NAME NAME)
00050A            NAME                      JREF(1)
00060A            ADDR
00070A            BAL
     A

PF1 is the primary file and PF2 is a secondary file. Assume that PF1 and PF2 have the following records:

PF1 NAMEADDRPF2 NAMEBAL
Anne120 1st St.Anne5.00
Doug40 PillsburyDoug6.50
Mark2 Lakeside Dr.Sue2.00
Sue120 Broadway

With JDFTVAL specified in the join logical file, the program reads the following records (shown in arrival sequence):

NAMEADDRBAL
Anne120 1st St.5.00
Doug40 Pillsbury6.50
Mark2 Lakeside Dr.0.00
Sue120 Broadway2.00

Without JDFTVAL specified in the join logical file, the program can read only three records (no record is found for Mark).

In this example, if you specified JREF(2) instead of JREF(1), the records returned to the program might be different, as follows:

NAMEADDRBAL
Anne120 1st St.5.00
Doug40 Pillsbury6.50
2 Lakeside Dr.0.00
Sue120 Broadway2.00