DYNSLT (Dynamic Select) Keyword for Logical Files Only--Examples

The following examples show how to specify the DYNSLT keyword.

Figure 36 shows how to specify dynamic select with arrival sequence.

Figure 36. Specifying the DYNSLT Keyword (Example 1)

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A                                      DYNSLT
00020A          R RECORD1                   PFILE(PF1)
00030A            FLD1
00040A            FLD2
00050A          S FLD1                      COMP(GT 2)

The DYNSLT keyword is required because there are no key fields.

The logical file supplies records to your program in arrival sequence. Assume that physical file PF1 has the following records:

FLD1
FLD2

1
aaaa

2
dddd

3
jjjj

4
bbbb

As your program does input operations, the system tests the first two records according to the select/omit values, but does not supply them to your program. Your program only sees the last two records:

FLD1
FLD2

3
jjjj

4
bbbb

Figure 37 shows how to specify dynamic select with keyed sequence access path.

Figure 37. Specifying the DYNSLT Keyword (Example 2)

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A                                      DYNSLT
00020A          R RECORD1                   PFILE(PF1)
00030A            FLD1
00040A            FLD2
00050A          K FLD1
00060A          S FLD2                      COMP(GT 'bbbb')
     A

In Figure 37, the DYNSLT keyword is not required. The logical file supplies records to your program in keyed sequence. Assume that physical file PF1 has the following records:

FLD1
FLD2

1
aaaa

2
dddd

3
jjjj

4
bbbb

When your program requests a record, the system tests the value of FLD2 for that record according to the select/omit values. Your program only sees the following records:

FLD1
FLD2

2
dddd

3
jjjj

Figure 38 shows how to specify a join logical file with select/omit comparing fields from two physical files.

Figure 38. Specifying the DYNSLT Keyword (Example 3)

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A                                      DYNSLT
00020A          R RECORD1                   JFILE(PF1 PF2)
00030A          J                           JFLD(FLD1 FLD3)
00040A            FLD1                      JREF(PF1)
00050A            FLD2                      JREF(PF1)
00060A            FLD3                      JREF(PF2)
00070A            FLD4                      JREF(PF2)
00080A          S FLD1                      COMP(GT FLD4)
     A

FLD1 and FLD2 come from the primary file (PF1), and FLD3 and FLD4 come from the secondary file (PF2). The select specification compares FLD1 from the primary file with FLD4 from the secondary file. Therefore, the DYNSLT keyword is required.

Figure 39 shows how to specify a join logical file with select and omit using fields from more than one physical file.

Figure 39. Specifying the DYNSLT Keyword (Example 4)

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A                                      DYNSLT
00020A          R JREC                      JFILE(PF1 PF2)
00030A          J                           JOIN(PF1 PF2)
00040A                                      JFLD(FLD1 FLD2)
00050A            FLD1                      JREF(PF1)
00060A            FLD2                      JREF(PF1)
00070A            FLD3                      JREF(PF2)
00080A          K FLD1
00090A          S FLD1                      COMP(GT 0)
00100A          O FLD3                      COMP(GT 4)
     A

FLD1 and FLD3 come from different physical files and are specified in a mixture of select and omit statements. Therefore, the DYNSLT keyword is required.