how to compare multiple files using jcl

1.8k Views Asked by At

I have a requirement where in I receive 6 files from upstream application into a GDG. I want to compare those all 6 version with one another to see any duplicates, i.e., it is a possibility that two or more files that came in may be duplicates (erroneously sent by upstream twice or multiple times). Could you please help on providing a solution using JCL or Cobol ?

2

There are 2 best solutions below

7
On

If they are properly strucured datasets (they are not files) then they should have header records. All you need do is compare the first record of each dataset. You could use your sort product or use ISRSUPC in batch.

JCL cannot do this as JCL only tells the operating system what programs and resources are needed to do the task. So even a COBOL solution would require JCL.

And, finally, I believe you are talking about generations no versions. Versions relate to the numbering after the GxxxxV.

0
On

The best thing to do is to use the ISPF compare facility (ISPF 3.13 - SuperC or 3.13 - SuperCE) to compare the files but choose background execution rather than foreground. This will create a batch job which you can use as a template for steps to include in your job:

//SUPERC  EXEC PGM=ISRSUPC,PARM=(DELTAL,LINECMP,' SEQ','') 

//NEWDD   DD DISP=SHR,DSN=new.dataset 
//OLDDD   DD DISP=SHR,DSN=old.dataset   
//OUTDD   DD SYSOUT=* 

Bear in mind that ISPF compare only compares 2 files; to compare 6 you'll need 15 steps (I think).

If your site has PDSMAN, then you can use its PDSM37 module to generate a checksum for each datasets and a small REXX to easily compare the 6 checksums.