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

in ways data can be passed to a COBOL program from JCL?

677


What is one line to pass PARM from JCL to COBOL?

1202


Is their any set of rules for dd? Explain.

676


What are steplib and joblib?

731


what is the purpose of coding class parameter in job statement?

732






write a jcl to execute a job by 7:00 am on jan 20,1986?

708


How to run cobol program using jcl?

662


What is the function of job statement in jcl?

644


how JCL works?

806


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

869


what is the compile process of cobol program expalin with code

2011


A dd statement consists of 4 fields. Name them?

942


What is the significance of addrspc parameter in the exec statement?

628


How does the jcl specify the job to os?

704


Explain how can the submitting users racf authority be overridden in a job stream?

683