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

Explain about Cobol Subroutines

1 Answers  


How to print data of sequential file to Spool..?

2 Answers  


Hi, all suppose i have 5 steps (S1,S2,S3,S4,S5) what will happen if cond is true or false (which of the other steps get executed)? 1) //s3 exec pgm=abc,cond=(0,le) 2) //s3 exec pgm=abc,cond=(0,le,step2) 3) In the jobcord RESTART=step3,cond=(0,le) 4) can i code COND=TRUE in jobcard, if yes what will happen?

3 Answers   TCS, Tech Mahindra,


what happens when time=0 is given in jcl code. what happens when blksize=0 is given in jcl code. what is symbolic and overriding parameters and a example program.

6 Answers   HCL,


I have a file in which I have 20 records. I want my first record to go into file 1 and second record to go in second file. I want to copy the alternate records like this in the two output files. How can I do this using JCL?

4 Answers  






How can we see data in TEMPARARY DATA SET in JCL ?

7 Answers   CSC, Polaris,


Is there any command to check wether the ps file is in sorted order?

0 Answers   IBM,


i want to avoid the positional parameter how to code it ?

3 Answers   TCS,


In a proc i will concatinate 4 dd statements.i want to overide 3 dd statement through jcl how?

3 Answers  


//ERFDS JOB //STEP1 //STEP2 //STEP3...COND=(4,LT) //STEP4 1.CONDITION IN STEP3 REFERS TO WHICH STEP'S RETURN CODE (STEP1 OR STEP2)? 2.IN ABOVE PROGRAM IF CONDITION SATISFIES IN STEP3 WHICH STEPS WILL EXECUTE?? AND WHY? IF CONDITION IN STEP3 SATISFIES

5 Answers   IBM,


Explain about Specifying compiler options in the PROCESS (CBL) statement

1 Answers  


how to identify the file used in the JCL is an VSAM file. Just seeing the JCL code how can we track the file as VSAM file?

6 Answers   CSC,


Categories