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
How can an in-stream dataset be terminated?
How can unused space allocation be returned to the system when a dataset is closed?
Explain the purpose of dd * statement in jcl?
what is “Cond= even” and “Cond=only”?
How to remove the spaces at end of each record in the output file Via COBOL program? note: The file has a VB length ----TRY
what are JCLLIB and STEPLIB in JCL?
What is the function of dd name parameter with a 2 part structure; audit.report?
what JCL Procedures?
how do you access an uncataloged dataset in a jcl?
1) SORT FIELDS=(20,4,CH,D,10,3,CH,D) OUTREC FIELDS=(7:20,4,C' FUTURE ',20,2,10,3,1Z,1,9,13,7, 24,57,TRAN=LTOU,6X'FF') This example illustrates how a fixed-length input data set can be sorted and reformatted for output. The SORTIN LRECL is 80 bytes. The reformatted output records are fixed length with a record size of 103 bytes. SOLRF (the IBM-supplied default) is in effect, so unless the SORTOUT LRECL is specified or available, it will automatically be set to the reformatted record length of 103. in the above example i have some doubts that a) sort fields=(20,4,CH,D,10,3,CH,D) -what exactly it does and this fields related to output record fields or input record fields b)outrec used to refprmat the records after sorting that means could please reply me as soon as possible Thanks. Venkat
Explain how can the disposition of sysout datasets be set for an entire jobstream?
Why include statement is used in a jcl?
why should SYSIN DD * statement should not be included inside a PROCedure snippet??? please answer this.. i need to know.
if we want to use a gdg which is already created by some job, then how to use the reference of the last generation in a jcl?
in ways data can be passed to a COBOL program from JCL?