2 Top DFSORT Examples on JOIN KEY

Join keys..DFSORT

Ex:1

//Step1  EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//Input1 DD DSN=...   GDG(-1) - FB/80
//Input2 DD DSN=...   GDG(0)  - FB/80
//SORTOUT DD DSN=...  output file - FB/80
//SYSIN DD *
  JOINKEYS F1=Input1,FIELDS=(1,80,A)
  JOINKEYS F2=Input2,FIELDS=(1,80,A)
  JOIN UNPAIRED,F2,ONLY
  SORT FIELDS=COPY
/*

Description: Unpaired, F2==> F2 non matching record write to o/p file.

Ex:2

//SYSIN DD *
  JOINKEYS FILE=F1,FIELDS=(15,2,A,7,4,A)
  JOINKEYS FILE=F2,FIELDS=(21,2,A,23,4,A)
  REFORMAT FIELDS=(F2:1,70,F1:1,60)
  SORT FIELDS=COPY
/*

Description: Reformat says the o/p record structure. For more details refer: 

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.