Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

Answers were Sorted based on User's Feedback



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

Answer / harsha

Give both input files in concatenation to SORTIN.
SORT FIELDS=NONE,XSUM

This will copy all duplicate records from both files to
SORTXSUM dataset.

Is This Answer Correct ?    5 Yes 1 No

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

Answer / 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

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

Answer / harsha

correction to the above.
it is SUM FIELDS=NONE instead of SORT FIELDS

Is This Answer Correct ?    3 Yes 2 No

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

Answer / 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

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

Answer / kamaldeep

We can't use SUM FIELDS=NONE,XSUM as mentioned by Harsha.
if we merge 2 files then it may be the case that input file already has duplicate records, so it will not give required output.

Is This Answer Correct ?    0 Yes 0 No

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

Answer / ayusman

First you have to join the two files with help of JOJNKEYS
in jcl sort . after that copy first 50 records by using
sort utility

Is This Answer Correct ?    0 Yes 1 No

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

Answer / muttaiah

Hi Ayusman,
I hope u didn't get the question properly.
Question.
file1: (3 records assumption)
100 ayusman
200 muttaiah
300 allinterview

File 2: (3 records
400 google
500 yahoo
100 ayusman

File3:
100 ayusman

This is what the question is, they want all the duplicates
in both file1 & file2 in file3(first 50 records).

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More JCL Interview Questions

how to eliminate the duplicates in sorting

4 Answers   Fidelity,


How to concatenate different LRECL of files?

2 Answers   IBM,


can we have more than one job in a single job card that is we are specifying only one 'job' statement in the jcl.

7 Answers   Accenture,


What are the rules employed while naming the steps in a job?

0 Answers  


I have two files each contains 10 records. I would like to copy both files into one output file but in alternate sequence. for e.g. first record from file1 then record 2 from file2.....

3 Answers   RBS,


what is static and dynamic call with examples?

4 Answers   IBM,


Explain about LMINIT - generate a data ID for a data set

1 Answers  


What is the purpose of the dd keylen parameter?

0 Answers  


Can we find specific member without knowing the name of PDS or can we search a member to which PDS it belongs to? if so how?

6 Answers  


I have 2 steps in my exec statement , in first step I am creating a gdg, and the output of this step is going into second step as a input, and this second step is abended , now how could i approach in this case.

5 Answers   Bank Of America,


Could you provide an example and its effect OF, Using COND on JOB and EXEC both ?

4 Answers   IBM,


if we compile the cobol+ db2 program now ofter 5 years we need to compile again?

1 Answers   TCS,


Categories