You are on page 1of 10

Join Logical File

Day 5
Join Logical File:
Overview:
This module enables the student to understand the concept of Join Logical File.
Outline:
Topics covered,
Join Logical fle creation
Types of Join Logical File
Keyords related to fles
Objective:
!y the end of this module, the student should be able to"
#reate a Join Logical fle
$nderstand the types of Join Logical fles.
Keyords related to fles.
JOIN LOGICAL FILES
Join logical fles concatenate the felds from the records in to or more physical fle and
process them as one record. The advantages of %oin logical fles include the folloing
& Du'e(tar Technologies )vt. Ltd. *+*,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Join Logical File
Day 5
Increased productivit: !ecause multiple -./D operations area not re0uired ith
%oin logical fles the coding in -)1+2,, programs is simplifed.
I!proved per"or!ance: !ecause a %oin logical fle builds only one record the
processing, program performance is improved. 3nly one -./D 4or #5/678 operation
has to be specifed instead of multiple -./D9s 4or #5/67s8 to open for non%oin
logical fle processing. Furthermore, if a program has feer open data paths, the
%ob9s )/1 4)rocess /ccess 1roup8 si:e is reduced. This saves data storage and
facilitates faster program loading.
#ore $e%ible database: /s compared to non%oin logical fles, %oin logical fles
supported by 6!;9s /(+2,, computer are the folloing"
Features of Join Logical Files&
The features uni0ue to %oin logical fles supported by 6!;9s /(+2,, computer are the
folloing"
Join logical fles are -./D only fles and may not be used in update processing.
Join logical fles support only inner and left outer %oins. 3uter %oin processing is not
supported.
They may reference from < to =< physical fles. The physical fle specifed may be in
'ey or arrival se0uence. / common 'ey 4or Keys8 is not re0uired to lin' the fles. 6n
addition, because the same physical fle may be specifed as lin' the fles. 6n
addition, because the same physical fle may be specifed as the base fle more
than once, it may be %oined to itself.
/ny 'ey feld specifed must be included in the primary fle.
(elect+ 3mit criteria may be specifed for any feld in a %oin logical fle.
Join Logical File Keywords. The steps in building a %oin logical fle include the folloing.
7ame all the physical fles that ill be accessed by the %oin logical fle.
(pecify the felds from each physical fles to each other.
Defne all the felds from each physical fle that ill be included in the %oin logical
fle9s record format.
The creation of a %oin logical fle depends on 'noledge of the seven 'eyords"
JFILE' JOIN' JFL(' J)EE' J(*+(E,' J(F-.AL' and (/NSL-& The function and synta> of
each of these 'eyords are e>plained in the folloing paragraphs.
JFILE Keyword (Record Level): This record level 4hich re0uires the letter - in
column*? of the Data Description statement8 'eyord is used to identify the physical fles
to be accessed in a %oin logical fle. /t least < physical fles and no more than =< may be
specifed in one JF6L. 'eyord.
The general format of the LF6. 'eyord follos"
JFILE00librar na!e1p2sical 3le na!e 4&&5678
The frst fle included in a JF6L. 'eyord is called the primary fle, and it is this fle from
hich the %oin processing starts.
@hen a user formats a JF6L. 'eyord, the physical fle has the smallest number of data
records should be specifed frst 4as the primary fle8 The se0uence in hich the physical
fles are specifed in the JF6L. 'eyord can aAect both performance and the results of %oin
logical fle processing.
JOIN 9eword 0Join Level8: The J367 'eyord is 'eyord is re0uired in the ending for a
%oin logical fle to %oin to physical fles for processing. 6f three physical fles are accessed
by the %oin logical fle, to J367 'eyords must be included , and so forth. The general
format of a J367 'eyord is as follos"
& Du'e(tar Technologies )vt. Ltd. <+*,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Join Logical File
Day 5
J3674fromBfle toBfle8
The fromBfle and toBfle entries may be the names or relative numbers of to physical fles
that ere included in the JF6L. 'eyord. 6n the frst e>ample that follos, relative numbers
* and < are used in the alternative coding in the J367 'eyord. To %oin the third fle to the
master fle, the second e>ample uses * and =.
JFILE0C*#AS- C*S-)AN C*S+AI(8
The JOIN 'eyord may be formatted as"
JOIN0C*S#AS- C*S-)AN8 :or;JOIN0< 68
/nd
JOIN0C*S-#AS- C*S+AI(8 :or;JOIN 0< 58
@hen duplicate physical fle names are specifed in a JF6L. 'eyord, the J367 'eyord
must use the relative number format. Defnition of the J367 'eyord re0uires that the
letter J be included in column *? of the DD( statement.
JFL( 9eword 0Join Level8: / JF6L. 'eyord identifes the from feld and the to feld that
ill %oin to physical fles. The related felds must have the same attributes 4type, si:e and
decimal positions 8 but they do not need to have the same name. /ny from feld si:e, and
to feld that does not have the same attributes may be redefned in the %oin logical fle. /ny
felds specifed in a JFLD 'eyord must have been defned in the related physical fle.
#onse0uently, %oin felds do not have to be defned in the %oin logical fle. The general
format of the JFLD 'eyord is
JFL( 0"ro! :3eld na!e to;3eld na!e8
7otice that to felds may be specifed in a JFLD 'eyord. 6f the physical fles are to be
%oined by other felds, then additional JFLD 'eyords must be defned.
J)EF 9eword0Field Level8:The J-.F 'eyords is used hen the physical fles accessed
by the %oin logical fle have some or all of the same feld names. J-.F is used to identify the
physical fle in hich the feld is related. The general format of the J-.F 'eyord is
J)EF03le :na!e relative;3le;nu!ber8
/ fle name or the relative positions of the fle9s name in the JF6L. 'eyord in the JF6L.
'eyord may be included in the J-.F statement. The related feld name must be entered in
the 7ame feld 4columns *CB<D8 of the DD( statement.
JDUPE! Keyword (Join Level)" / JD$)(.E 'eyord specifes the order in hich the
records from physical fles that have duplicate %oin felds ill be processedF The general
format format the JD$)(.E 4se0uencing fleBname GHD.(#.7DI8
6f =(ESCEN( is included in the 'eyord, the duplicate records 4same feld value ill be
retrieved in a descending order instead of a ascending default order.
JDF#$%L Keyword (File Level)" The JDFTJ/L 'eyord enables primary fle records that
do not have matching secondary fle records to be included in the %oin, @ithout the
JDFTJ/L 'eyords, any primary fle record that did not have a matching secondary fle
record ould be s'ipped. The general format of the JDFTJ/L 'eyord is
J(F-.AL0no para!eter8
D&'L# Keyword (File Level) : The DK7(LT 'eyord is re0uired hen the JDFTJ/L
'eyord is specifed in a %oin logical fle. @hen specifed, it causes record selection to
& Du'e(tar Technologies )vt. Ltd. =+*,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Join Logical File
Day 5
occur hen a record is read instead of after it is stored. The general format of the DK7(LT
'eyord is
(/NSL-0no para!eter8
-pes o" Joins in Join Logical Files
*. (.LF J367
<. 677.- J367
=. 3$T.- J367
Join logical fles combine diAerent felds from more than one physical fle into a single
record. Kou must specify the JF6L. 'eyord at the record level for %oin logical fles.
(pecify the entries in the folloing order to defne a %oin logical fle"
FileBlevel entries 4optional8.
-ecordBlevel entries.
JoinBlevel entries.
FieldBlevel entries.
Key feldBlevel entries 4optional8.
(elect+omitBfeld level entries 4optional8.
3nly one record format is alloed in a %oin logical fle.
e.g . @e are using to )hysical Files to create a Join Logical File

*. #3-(
Columns . . . : 1 71 Edit
PB01U01D/MYDDS
SEU==> CORS
FMT PF ...............T.!"m#$$$$$$R%#n$$TD&B......Fun'tions$$$$$$$$$$$$$$$
$$$
((((((((((((((( B#)innin) o* d"t"
(((((((((((((((((((((((((((((((((((((
0001.00 R RCORS
000+.00 CCD ,S 0 CO%-D./0COURSE CODE01
000,.00 C!M 2 CO%-D./0COURSE !ME01
0003.00 FEES 2 CO%-D./0COURSE FEES01
0002.00 4 CCD
(((((((((((((((((( End o* d"t"
((((((((((((((((((((((((((((((((((((((((











F,=E5it F3=P6om&t F2=R#*6#s7 F8=R#t6i#9# F10=Cu6so6 F11=To))l#
F1:=R#&#"t *ind F17=R#&#"t '7"n)# F+3=Mo6# ;#<s
COPYR=.-T =BM CORP. 18>1? +00+.
& Du'e(tar Technologies )vt. Ltd. 2+*,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Join Logical File
Day 5
<. (T$D.7T
Columns . . . : 1 71 Edit PB01U01D/MYDDS
SEU==> STUDE!T
FMT PF ...............T.!"m#$$$$$$R%#n$$TD&B......Fun'tions$$$$$$$$$$$$$$$$$$
((((((((((((((( B#)innin) o* d"t" (((((((((((((((((((((((((((((((((((((
0001.00 U!=@UE
000+.00 R RSTUD
000,.00 RO%% ,S 0 CO%-D./0RO%% !UMBER01
0003.00 S!ME 2 CO%-D./0STUDE!T !ME01
0002.00 CCD ,S 0 CO%-D./0COURSE CODE01
000:.00 CORS 2 CO%-D./0COURSE !ME01
0007.00 DD 2 CO%-D./0DDRESS01
000>.00 4 RO%%
(((((((((((((((((( End o* d"t" ((((((((((((((((((((((((((((((((((((((((








F,=E5it F3=P6om&t F2=R#*6#s7 F8=R#t6i#9# F10=Cu6so6 F11=To))l#
F1:=R#&#"t *ind F17=R#&#"t '7"n)# F+3=Mo6# ;#<s
/C1 COPYR=.-T =BM CORP. 18>1? +00+.
Join Logical File&
9ewords:
JFILE 0Joined Files8 >eword
$se this recordBlevel 'eyord to identify the physical fles containing the data to be
accessed through the %oin logical fle you are defning.
The format of the 'eyord is"
JFILE0 4librar;na!e17 p2sical;3le;na!e 4&&567 8
JOIN 0Join8 >eword
$se this %oinBlevel 'eyord to identify hich pair of fles are %oined by the %oin specifcation
in hich you specify this 'eyord.
The format of the 'eyord is"
JOIN0 "ro!;3le to;3le 8
JFL( 0Joined Fields8 >eword
$se this %oinBlevel 'eyord to identify the from and to felds hose values are used to %oin
physical fles in a %oin logical fle. These felds are both referred to as %oin felds.
The format of the 'eyord is"
JFL(0 "ro!;3eld;na!e to;3eld;na!e 8
J)EF 0Join )e"erence8 >eword?join logical 3les onl
$se this feldBlevel 'eyord in %oin logical fles for felds hose names are specifed in more
than one physical fle. This 'eyord identifes hich physical fle contains the feld.
The format of the 'eyord is"
J)EF0 3le;na!e @ relative;3le;nu!ber 8
& Du'e(tar Technologies )vt. Ltd. 5+*,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Join Logical File
Day 5
E%a!ple For Inner Joint
Columns . . . : 1 71 Edit PB01U01D/MYDDS
SEU==> CRSSTD
FMT %F ...............T.!"m#$$$$$$.%#n$$TD&B......Fun'tions$$$$$$$$$$$$$$$$$$
((((((((((((((( B#)innin) o* d"t" (((((((((((((((((((((((((((((((((((((
0001.00 R R=!FO AF=%E/CORS STUDE!T1
000+.00 A AO=!/CORS STUDE!T1
000,.00 AF%D/CCD CCD1
0003.00 CCD AREF/CORS1
0002.00 C!M
000:.00 FEES
0007.00 RO%%
000>.00 S!ME
(((((((((((((((((( End o* d"t" ((((((((((((((((((((((((((((((((((((((((








F,=E5it F3=P6om&t F2=R#*6#s7 F8=R#t6i#9# F10=Cu6so6 F11=To))l#
F1:=R#&#"t *ind F17=R#&#"t '7"n)# F+3=Mo6# ;#<s
/C1 COPYR=.-T =BM CORP. 18>1? +00+.
OUTPUT
Dis&l"< R#&o6t
R#&o6t Bidt7 . . . . . : :3
Position to lin# . . . . . S7i*t to 'olumn . . . . . .
%in# ....$....1....$....+....$....,....$....3....$....2....$....:....
COURSE CODE COURSE !ME COURSE FEES RO%% !UMBER STUDE!T !ME
000001 100 'om& 10000 1 """
00000+ +00 "s300 ,0000 + CCCCC
00000, ,00 D"9" 10000 , ''''
000003 300 9C +000 3 dddd
(((((( (((((((( End o* 6#&o6t ((((((((











Bottom
F,=E5it F1+=C"n'#l F18=%#*t F+0=Ri)7t F+1=S&lit

JDFTVAL (Join Default Values) keyword (OUTER JOI)
This 'eyord has no parameters.
& Du'e(tar Technologies )vt. Ltd. L+*,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Join Logical File
Day 5
Columns . . . : 1 71 Edit PB01U01D/MYDDS
SEU==> CRSSTD
FMT %F ...............T.!"m#$$$$$$.%#n$$TD&B......Fun'tions$$$$$$$$$$$$$$$$$$
((((((((((((((( B#)innin) o* d"t" (((((((((((((((((((((((((((((((((((((
0001.00 ADFTE%
000+.00 R R=!FO AF=%E/CORS STUDE!T11
000,.00 A AO=!/CORS STUDE!T11
0003.00 AF%D/CCD CCD1
0002.00 CCD AREF/CORS1
000:.00 C!M
0007.00 FEES
000>.00 RO%%
0008.00 S!ME
(((((((((((((((((( End o* d"t" ((((((((((((((((((((((((((((((((((((((((







F,=E5it F3=P6om&t F2=R#*6#s7 F8=R#t6i#9# F10=Cu6so6 F11=To))l#
F1:=R#&#"t *ind F17=R#&#"t '7"n)# F+3=Mo6# ;#<s
/C1 COPYR=.-T =BM CORP. 18>1? +00+.
OUTPUT
Dis&l"< R#&o6t
R#&o6t Bidt7 . . . . . : :3
Position to lin# . . . . . S7i*t to 'olumn . . . . . .
%in# ....$....1....$....+....$....,....$....3....$....2....$....:....
COURSE CODE COURSE !ME COURSE FEES RO%% !UMBER STUDE!T !ME
000001 100 'om& 10000 1 """
00000+ +00 "s300 ,0000 + CCCCC
00000, ,00 D"9" 10000 , ''''
000003 300 9C +000 3 dddd
000002 200 9' 2000 0
00000: :00 @ 12000 0
000007 1+, S300 10000 0
(((((( (((((((( End o* 6#&o6t ((((((((








Bottom
F,=E5it F1+=C"n'#l F18=%#*t F+0=Ri)7t F+1=S&lit

E%a!ple "or Sel" Join
& Du'e(tar Technologies )vt. Ltd. ?+*,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Join Logical File
Day 5
Columns . . . : 1 71 Edit PB01U01D/MYDDS
SEU==> CRSSTD
FMT %F ...............T.!"m#$$$$$$.%#n$$TD&B......Fun'tions$$$$$$$$$$$$$$$$$$
((((((((((((((( B#)innin) o* d"t" (((((((((((((((((((((((((((((((((((((
0001.00 R R=!FO AF=%E/STUDE!T STUDE!T1
000+.00 A AO=!/1 +1
000,.00 AF%D/CCD CCD1
0003.00 CCD AREF/11
0002.00 RO%% AREF/11
000:.00 S!ME AREF/+1
(((((((((((((((((( End o* d"t" ((((((((((((((((((((((((((((((((((((((((










F,=E5it F3=P6om&t F2=R#*6#s7 F8=R#t6i#9# F10=Cu6so6 F11=To))l#
F1:=R#&#"t *ind F17=R#&#"t '7"n)# F+3=Mo6# ;#<s
/C1 COPYR=.-T =BM CORP. 18>1? +00+.

OUTPUT
Dis&l"< R#&o6t
R#&o6t Bidt7 . . . . . : ,>
Position to lin# . . . . . S7i*t to 'olumn . . . . . .
%in# ....$....1....$....+....$....,....$...
COURSE CODE RO%% !UMBER STUDE!T !ME
000001 100 1 """
00000+ +00 + CCCCC
00000, ,00 , ''''
000003 300 3 dddd
(((((( (((((((( End o* 6#&o6t ((((((((





DYNSLT (Dynamic Select) keyword
$se this fleBlevel 'eyord to indicate that the selection and omission tests specifed in the
fle 4using select+omit specifcations8 are done at processing time. This 'eyord has no
parameters.

& Du'e(tar Technologies )vt. Ltd. D+*,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Join Logical File
Day 5
Columns . . . : 1 71 Edit PB01U01D/MYDDS
SEU==> CRSSTD
FMT %F ...............T.!"m#$$$$$$.%#n$$TD&B......Fun'tions$$$$$$$$$$$$$$$$$$
((((((((((((((( B#)innin) o* d"t" (((((((((((((((((((((((((((((((((((((
0001.00 DY!S%T
000+.00 R R=!FO AF=%E /CORS STUDE!T11
000,.00 A AO=! /CORS STUDE!T11
0003.00 AF%D /CCD CCD1
0002.00 ADUPSE@ /RO%%1
000:.00 CCD AREF /CORS1
0007.00 C!M
000>.00 FEES
0008.00 RO%%
0010.00 S!ME
0011.00 O CCD COMP /%T 1001
001+.00 S RO%% R!.E /+ 21
(((((((((((((((((( End o* d"t" ((((((((((((((((((((((((((((((((((((((((




F,=E5it F3=P6om&t F2=R#*6#s7 F8=R#t6i#9# F10=Cu6so6 F11=To))l#
F1:=R#&#"t *ind F17=R#&#"t '7"n)# F+3=Mo6# ;#<s
/C1 COPYR=.-T =BM CORP. 18>1? +00+.
OUTPUT
Dis&l"< R#&o6t
R#&o6t Bidt7 . . . . . : :3
Position to lin# . . . . . S7i*t to 'olumn . . . . . .
%in# ....$....1....$....+....$....,....$....3....$....2....$....:....
COURSE CODE COURSE !ME COURSE FEES RO%% !UMBER STUDE!T !ME
000001 +00 "s300 ,0000 + CCCCC
00000+ ,00 D"9" 10000 , ''''
00000, 300 9C +000 3 dddd
(((((( (((((((( End o* 6#&o6t ((((((((












Bottom
F,=E5it F1+=C"n'#l F18=%#*t F+0=Ri)7t F+1=S&lit

& Du'e(tar Technologies )vt. Ltd. C+*,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.
Join Logical File
Day 5
Assign!ent on above session:
E*. .>plain the function of the folloing %oin logical fle 'eyords"
JFILE JFL(J(*+SE,
JOIN J)EF(/NSL-
E< @hat is the function of the J-.F 4*8 'eyordM
E=. 5o ould a JDFTJ/L 'eyord control change the processing of the physical flesM
E2 @hat is the function of select+omit control for logical flesM
E5 7ame the 'eyords supported ith logical fle select+omit control.
EL 5o is an 3- relationship beteen to or more selection+omit statements
specifedM 5o is an /7D relationship indicatedM
E? #reate to )F9s .;) and (/L.
.;) ill have .mployee Details.
(al ill have (alary Details.
.;)(/L ill be the common feld beteen to )F9s.
$se J(*+SE, Join level 'eyord for a feld.
& Du'e(tar Technologies )vt. Ltd.
*,+*,
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies Pvt.
Ltd.

You might also like