We have two PS files,want to compare those files and put
the duplicate records in one file.
Input file 1 contains(1,2,4,9,10)
Input file 2 contains (1,4,5,11,12,14,16).

Help me with jcl.

Answers were Sorted based on User's Feedback



We have two PS files,want to compare those files and put the duplicate records in one file. Input..

Answer / shriram supalwar, dharmabad

//jobcard
//step1 exec pgm=iebgener
//sysprint dd sysout=*
//sysut1 dd dsn=proj.test.file1,disp=shr
// dd dsn=proj.test.file2,disp=shr
//sysut2 dd dsn=proj.output,disp=shr
//sysin dd dummy
//if (step1.rc eq 0) then
//step2 exec pgm=sort
//sysprint dd sysout=*
//sortin dd dsn=proj.output,disp=shr
//sortout dd dsn=proj.sortout,disp=shr
//sortxsum dd dsn=proj.duplicate,disp=shr
//sysin dd *
sort fields=(1,5,ch,a)
sum fields=none,xsum
/*

Now, all these records are copied to proj.output
and out of those records the duplicate records are copied to
proj.duplicate

Correct me if i am wrong

Is This Answer Correct ?    3 Yes 1 No

We have two PS files,want to compare those files and put the duplicate records in one file. Input..

Answer / aditi

hi,

I have also faced the same question.

as we have the two seperate input files.
Nitika, U have taken only one input file so how we sort it
using only one file?

Is This Answer Correct ?    1 Yes 0 No

We have two PS files,want to compare those files and put the duplicate records in one file. Input..

Answer / nitika

Use SORTXSUM utility in JCL to get the output.
//JOB1 JOB ,, CLASS = A
//STEP1 EXEC PGM=SORT
//SORTIN DD DSN=TEST.PS.INPUT
//SORTOUT DD DSN=TEST.PS.OUTPUT
//SORTXSUM DD DSN=TEST.PS.OUTPUT
//SYSIN DD *
SORT FIELDS = (1,1,CH,A)
SUM FIELDS = (NONE,XSUM)
/*

Now SUM FIELDS = NONE means no duplicates in the output file
(TEST.PS.OUTPUT)and XSUM means duplicates, in the two files
being matched, should be sent to the file mentioned in
SORTXSUM ddname.

So, output file will have 1,4.

Is This Answer Correct ?    3 Yes 3 No

We have two PS files,want to compare those files and put the duplicate records in one file. Input..

Answer / karthik

@aditi n nikita

i think we can use ibm utility iebcompare

Is This Answer Correct ?    0 Yes 0 No

We have two PS files,want to compare those files and put the duplicate records in one file. Input..

Answer / mdv

@Shriram Supalwar, Dharmabad

You don't need the IEBGENER STEP.

Your second step sort can have both the files concatenated
as one and given as Input.


Thanks

Is This Answer Correct ?    0 Yes 0 No

We have two PS files,want to compare those files and put the duplicate records in one file. Input..

Answer / abhusha

Use join keys
//STEP01 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD DSN=INPUT.FILE.ONE,DISP=SHR
//SORTJNF2 DD DSN=INPUT.FILE.TWO,DISP=SHR
//SORTOUT DD DSN=OUTPUT.FILE,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(100,200),RLSE),
// DCB=(RECFM=FB,BLKSIZE=0,LRECL=80)
//SYSIN DD *
SORT FIELDS=COPY
JOINKEYS FILES=F1,FIELDS=(1,10,A)
JOINKEYS FILES=F2,FIELDS=(1,10,A)
REFORMAT FIELDS=(F1:1,71,F2:1,9)
/*

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More JCL Interview Questions

ihave ten flatfile in that iwant to concatinate all the files except file 5,6 into output file by uing jcl? how to do this? give me detail yntax for tis?

4 Answers   IBM,


Explain concatenating datasets?

2 Answers   CTS,


In your JCL, run the even numbered steps if date is even and run odd numbered steps if date is odd . Where do you generate the date ??in cobol or JCL ??

2 Answers   CSC,


How can an in-stream dataset be terminated?

0 Answers  


Why do you use a control card?

3 Answers   IBM, iNautix,






If a jcl has just 1 step and the input file to this does not exist, then what will happen if we submit this job?

3 Answers  


What is the function of the dd dcb keyword?

0 Answers  


How is the keyword DUMMY used in JCL?

4 Answers  


I have 255 procedures in a job, each procedure contain 2 steps.can we execute this job?

2 Answers  


how to concatenate datasets

5 Answers   EDS,


There are a set of 10 files and a customer will be selecting random no of files(i.e they may be more than 2, may not be in the order).Sometimes he might just select one file or sometimes no files at all.How do you code a JCL for this? Is it possible to code just JCL alone for this problem?

9 Answers   Infosys,


i have 3 steps in my jcl, where i want to run only one step at a time depending on the variable. How should i give the condition statement... I have tried this with two steps which is working but not able to add condn for the 3rd step. can anyone help me... I want to know the cond stmt which i can code in step 3 and step4, so that only either step2 or step3 or step4 executes

3 Answers  


Categories