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

Answer Posted / mani

First need to sort both files
READ FILE1
READ FILE2
PERFORM UNTIL EOF = 'Y'
IF FILE1-ID > FILE2-ID THEN
READ FILE2 AT END MOVE 'Y' TO EOF
ELSE IF FILE1-ID < FILE2-ID
READ FILE1 AT END MOVE 'Y' TO EOF
ELSE IF FILE1-ID = FILE2-ID
WRITE FILE3
READ FILE1 AT END MOVE 'Y' TO EOF
READ FILE2 AT END MOVE 'Y' TO EOF
END-PERFORM

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How would you understand error(execution phase)?

621


How to pass data to a program that is coded in an exec statement?

820


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

746


How gdg are concatenated?

668


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

627






How to compare two files in SYNCSORT and on the mismatch record should be deleted from second file.

5058


What do you understand by the term notcat 2 – gs?

751


Can we call instream to catalog and catalog to instream?

681


What is the job entry system used in your project? based on what criteria the sequence of jobs are picked if priority is not mentioned in the job card?

1805


In job processing, what happens in conversion stage?

734


define cond parameter in jcl?

771


I have a COBOL program that ACCEPTs some input data. How do you code the JCL statement for this?

694


What do you know about jcl?

645


how you can access an uncataloged dataset in a JCL?

649


how to do automated restart when a job abends?

842