File1 has 100 records and file2 has 200 records i want to
copy 50 records which r in both file into file3

Answer Posted / madhavi chava

This can be coded as given below

//SORT1 EXEC PGM=SORT
//SORTJNF1 DD *
00000111111 000001234567 LOCAL =====
00000333333 000003456789 LOCAL =====
00000555555 000005678901 EXTRN =====
00000666666 000006789012 EXTRN =====
00000777777 000007890123 LOCAL =====
//SORTJNF2 DD *
00000222222 000002345678 ===== BCDEF
00000444444 000004567890 =====
DEFGH
00000666666 000006789012 ===== FGHIJ
00000888888 000008901234 ===== HIJKL
00000999999 000009012345 ===== JKLMN
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(1,11,A,13,12,A)
JOINKEYS FILES=F2,FIELDS=(1,11,A,13,12,A)
REFORMAT FIELDS=(F1:1,31,F2:32,5)
SORT FIELDS=COPY

output of the file3
00000666666 000006789012 EXTRN FGHIJ

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can values be passed from the job stream to an executable program?

885


Name the parameters which can be used to limit the number of records written to a sysout dataset?

662


What is the format of comment statement?

688


What does it mean by Restart and Checkpoint in JCL ? How are checkpoints being taken and what is their usage ? How to use Checkpoint macro on a JOBSTEP ?

9230


Explain dfsort utility?

685






Name what parameter directs the output of the job log dataset?

570


What is the difference between the positional and keyword parameters? Give examples.

726


Explain how can the disposition of sysout datasets be set for an entire jobstream?

645


what EXEC statement is and what is the syntax of EXEC statement used in JCL?

640


What is the function of the steplib dd statement?

752


In sms datasets, what is the function of the dd avgrec keyword?

660


What is notcat 2 - gs?

946


by using cond parameter maximum 8 cond can be coded in single cond means ?explain

983


What is the purpose of dd dummy statement?

960


Explain the function of dd disp parameter?

607