How to: |
You can define a dynamic join in a Master File using the SEGTYPE attribute. There are two types of dynamic Master File defined joins: one-to-one (SEGTYPE DKU) and one-to-many (SEGTYPE DKM).
The difference between static and dynamic joins deals with storage, speed, and flexibility:
This makes static joins much faster than dynamic ones, but harder to change. You can redefine or remove a static join only using the REBUILD facility. You can redefine or remove a dynamic join at any time by editing the Master File.
You specify a dynamic Master File defined join the same way that you specify a static join (as described in Specify a Static Unique Join), except that the value of the SEGTYPE attribute for the cross-referenced segment is DKU (standing for dynamic keyed unique) for a one-to-one join, and DKM (standing for dynamic keyed multiple) for a one-to-many join.
For example:
SEGNAME = JOBSEG, SEGTYPE = DKU, PARENT = PAYINFO, CRFILE = JOBFILE, CRKEY = JOBCODE, $
You declare linked segments in a dynamic join the same way that you do in a static join. In both cases, SEGTYPE has a value of KLU for unique linked segments, and KL for non-unique linked segments.
The following Master File includes the relevant sections of EMPLOYEE and the segments joined to it, but with the static joins replaced by dynamic joins (nonessential fields and segments are not shown):
FILENAME = EMPLOYEE, SUFFIX = FOC, $ SEGNAME = EMPINFO, SEGTYPE = S1, $ FIELDNAME = EMP_ID, ALIAS = EID, FORMAT = A9, $ . . . SEGNAME = PAYINFO, SEGTYPE = SH1, PARENT = EMPINFO, $ FIELDNAME = JOBCODE, ALIAS = JBC, FORMAT = A3, $ . . . SEGNAME = JOBSEG, SEGTYPE = DKU, PARENT = PAYINFO, CRFILE = JOBFILE, CRKEY = JOBCODE, $ SEGNAME = SECSEG, SEGTYPE = KLU, PARENT = JOBSEG, CRFILE = JOBFILE, $ SEGNAME = SKILLSEG,SEGTYPE = KL, PARENT = JOBSEG, CRFILE = JOBFILE, $ SEGNAME = ATTNDSEG,SEGTYPE = DKM, PARENT = EMPINFO, CRFILE = EDUCFILE, CRKEY = EMP_ID, $ SEGNAME = COURSEG, SEGTYPE = KLU, PARENT = ATTNDSEG,CRFILE = EDUCFILE,$