JCL SORT CARD to filter data

If you have 2 input files with redundant data. For example
INP1 INP2
A B
B D
C E
D F
-----------------------
How will fetch records of INP1 which are present in INP2 to a new output file and also fetch the records which do not match in another output file.
Please tell me the SORT CARD to achieve this task.

Showing Answers 1 - 3 of 3 Answers

Vignesh

  • Aug 13th, 2015
 

Using SORT and JOIN KEY

Code
  1. //STEP1 EXEC PGM=SORT

  2. //SORTJNF1 DD DSN=INP1, DISP=SHR

  3. //SORTJNF2 DD DSN=INP2, DISP=SHR

  4. //SYSOUT DD SYSOUT=*

  5. //SOROUT DD SYSOUT=*

  6. //SYSIN DD *

  7.   JOINKEYS FILE=F1,FILEDS=(1,1,A)

  8.   JOINKEYS FILE=F2,FILEDS=(1,1,A)

  9.   REFORMAT FILEDS(F1:1,F2:1)

  10.   SORT FIELDS = COPY

  11. /*

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions